About networking....

You must understand the Game Editor concepts, before post here.

About networking....

Postby Thanx » Tue Apr 27, 2010 6:14 pm

Hey folks! 8)

Lately I've been promising through my signature, and maybe in a post or few (or was that just chat with some of you?) that I was coming up with a networked game created with the current stable version of GE (to be exact, I use 1.3.9).
I realized lately that the method I was going to use to achieve this would actually create a security breach to the server you use. So I decided not to do the networking, since I didn't want to take the risk for security problems.

BUT

I decided also to share the idea, because I think it might be something to provoke thinking, and maybe somebody comes up with an idea to make the method safe...
So here's the way it works in theory:
You get a website, and you create a PHP registration, and login. Now the page that leads to tells you simply to also open the game program on your local computer. So here's the trick: the PHP page, has itself auto-refreshed every 3 seconds or so (faster or slower could be chosen depending on the system resources). The GE created game could also have a timer which is set to so many seconds. It is at the page reload and the ontimer events that synchronization happens, in the following way:
Let's suppose that the game directory was given to the online user database. When the page loads, it checks for a txt file in the game directory. First of all, it checks the date the txt file was last modified (which would be marked in the first line).
Based on that, it opens a database of actions, in which each action has the issue date, as well as all the information to fully describe its meaning. All actions since the time of the txt file modification are copied from the database, in text form, to another txt file in the same directory, as well as the current time (and the number of actions it copied).
The GE game then on the ontimer event opens this file PHP wrote to, reads the timestamp, and copies it to the file it writes to, which is the same file PHP read from! It then executes the actions which it received, and it copies all actions the user did in the meantime, into that file PHP read from. It then deletes the contents of the file it read from.
In the PHP code's turn it reads those actions, and copies it into its action's database. With the appropriate timestamp it read. It also deletes all information it read.

The reason they delete what they read is so that they do not read the same thing twice, therefore no single action may be actually done twice, causing different game statuses by the different users.

Timestamps are all written by PHP code, since it can get it, while GE can't (FEATURE REQUEST!!!).
Disadvantage of the method: to have a networked non-turn-based game, you'd need to figure such upgrades every split second, which demands many resources both from your computer, plus at least twice that amount from the server...
Action databases need to have frequent deletions with many active users, since if nothing is deleted, the database may grow too big, too fast...
And the greatest disadvantage... On your computer the game uses 2 text files, I call communication files. Now PHP always needs to download and upload the current communication file to view, otherwise it cannot read its contents, since it's a server side interface. Javascript may possibly used, but it may have similar consequences, but most importantly, it basically restricts users to Win IE, which means most people wont play, since most people nowadays use Mozilla, Chrome, Safari, Opera...
Though you could say, you're controlling what PHP uploads for itself, it's actually not true. Have a hacker rename their codes' file to the appropriate name in disguise, start the game, and PHP downloads a dangerous file... Even if you have your own game start up before the online PHP codes, so it may write into the file first, even then, with the right timing, the user can put in a virus code, instead of the info...

I thought I'd share the ideas, even if they can't be used seriously... You may have an idea... You may not even understand :lol: Any questions, discussion is appreciated. :D
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score

Re: About networking....

Postby Hblade » Tue Apr 27, 2010 6:50 pm

I cant wait to see the networking! :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: About networking....

Postby Thanx » Tue Apr 27, 2010 8:09 pm

Another risk-free method would be having GE constantly using the openURL function, or what was it, that opened webpages...
That would open pages like index.php?q=2&wer=4
The stuff after the ? are actually setting variables for PHP to use. Having GE create the appropriate string then open the URL, then have the PHP code use the defined codes would be a way to have networking done... The problem would be, that the openURL actually creates an instance of the browser application, and opens it... And now we don't want browsers popping up in our view constantly, do we? So here are 2 methods of networking in the CURRENT version of GE, but one is insecure, the other is inconvenient... What a pitty... We'll still need to wait for that new version, eh? :P
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron