Page 1 of 1

yay :)

Posted: Sat Nov 22, 2008 5:58 pm
by turshija
Hey guys ! :)
Even though I'm not active almost at all, I'm visiting forum from time to time, reading posts, comments, tricks ... Looking at your projects and I'm amazed how things are becoming better, and better ...
Finally the thing I've been waiting for ... Possibility to write to file ... :)
Only thing I think ZGE is missing that is very important, is some kind of network thingy, so we can make multiplayer games, but I'll satisfy with this also ... :)
One thing I did with friend few years ago in school in mighty PASCAL, was making multiplayer Snake game using files ! :roll:
Using very stupid (but somewhat working) way, we managed to get really good real-time synchronization ...
I want to try that in ZGE also, but I need a little new feature ...
Let me explain how we did it ...
It is totally unpractical but its fun ...
We put file.txt file for example in C:\folder\ on both of the computers and share that folder ... game writes snakes coordinates and direction in C:\folder\file.txt , and reads opponents coordinates and direction from \\PC2 (or PC1)\folder\file.txt (or something like that) ...
And it works ! :D
Small problem was, that when one client is writing in the file and other one tries to read it in the same time, the program would crash, but we just put that in some kind of "try-catch" so if that happens we would just skip reading for that iteration ...
I tried that in ZGE on single file, and it works pretty nice ! :)
I have attached the examples ... You start rwtest and client, and when you click somewhere in rwtest with your mouse, you write X and Y coordinates in test file so the client can read it ... AND IT WORKS ! :lol:
But the problem is that I can't set file path to something like C:\blah\ or \\PC2\ or something ... I can only use current EXE path or \folder\file (i hope you understand me at least something)...
If the exe is for example in D:\ZGE\project\ , I can only access files in that folder or folders located there ... I cant access file on C disk if the exe is on D:\ ... So, can ZGE accept absolute path (i hope its the name for it :D) ?

Dunno if its too rude from my side to ask for a new feature since I'm totally inactive here, but you decide ... :oops:

Posted: Mon Nov 24, 2008 1:09 am
by jph_wacheski
ha! nice hack!

I had been thinking about a some simple networking suport as well., I would like to see a bit more practical implementation,. Not to take away from your idea, as if it works and ppl can have fun with it, then more power to you,. However, even some simple net support for sending highscores to a site would be cool,. and of course in the end I would like to do a server based game,. I am learning about PHP now, to rebuild my web site, and having some interesting ideas about games that can be done,. but I will post a request when I have something more like this specific idea. trun based stratagy designs or even a Spore like server library/data exchange system should be trivial,. . peace

Posted: Mon Nov 24, 2008 9:19 am
by VilleK
Yes, it is very cool when someone thinks of new creative ways of using existing features! Good work Boris.

I don't know about allowing absolute paths... potentially a security risk if someone writes to c:\windows\system.dat or something :) . Since a shared path is needed anyway (such as \\net-drived) you might as well put both exe-files in that path and use relative paths.

No networking features are currently planned for zge, but simple stuff like what jph describe should be easy to add in a future version. We'll see.

Posted: Mon Nov 24, 2008 11:07 am
by turshija
VilleK wrote:I don't know about allowing absolute paths... potentially a security risk if someone writes to c:\windows\system.dat or something :) .
Well, that means every programming language has that security risk ... :P
But programming language shouldn't care if there are evil programmers at all ... :twisted:
Useful example:
If I want to make demo/trial game that unlocks with serial number, I would save some random unusual .dat file in C:\windows\system32\ with special code that game will read on every start to check if the game is registered or not ...

Only problem about adding absolute paths not multiplatform ...
What if the game tries saving something in C:\windows\system32\ on Linux? :lol:
VilleK wrote:Since a shared path is needed anyway (such as \\net-drived) you might as well put both exe-files in that path and use relative paths.
Just tried putting in share folder of other computer ... Copied exe files to \\PC1\share\ and when I try starting exe files from this computer I get "send/don't send" error ... :( I've checked the permissions, its not the problem ... Oh well, ill try hacking a little bit more ... :)

I'm not sure, but If we had absolute paths maybe we could be able to upload scores to FTP just by writing to file like this:

Code: Select all

ftp://username:password@ftpsite.com/scores.dat
Dunno if its possible, but only my guess ... :roll:

Posted: Mon Nov 24, 2008 3:07 pm
by Kjell
Hi guys,

Serial / license information is usually stored in either a encrypted file in the program's directory or the registry. Storing such information in for example the Windows directory is considered bad practice as far as I know.

Online highscore is something quite different to network based multi-player. Although both ( might ) use TCP/IP, you generally just query a SQL command or PHP/ASP page ( passing variables in the URL ), which is quite a bit more simple then what you usually need for online / LAN MP.

About ten years ago some classmates actually used a similar network trick to set up a simple multi-player game :) Unfortunately ZGE executables seem to crash when run through a Network from a other PC ( Windows Program Error ). It does work within the Editor, but it's laggy ( especially on the PC running from behind the network ) and you get invalid results when the file is being written to ( this can be solved by writing some kind of file cue though ).

I've attached a simple 2 player mouse example. Put the zgeproj in a shared folder on one of the PC's, load it up in the editor on both PC's, change the ClientIdentity constant in one of the projects to 1, and press Preview on both PC's to witness the horror :wink:

K

Posted: Tue Nov 25, 2008 6:15 pm
by diki
on the topic of communications, i was wondering how difficult/time consuming it would be to implement a most simple network protocoll component into zge (i was thinking of OSC, but that would just be an abstraction on TCP/IP or UDP, right?) ...

Posted: Tue Nov 25, 2008 7:33 pm
by turshija
yeah, any kind of network protocol would be pretty useful in ZGE, but I don't think it would be possible to implement it without some additional libraries, that would certainly increase the executable size ...

Posted: Wed Nov 26, 2008 8:12 am
by VilleK
I've never really attempted network coding so I don't know how much work it is or if external libraries are needed. There is a SDL NET library that could probably be used for platform independence though. I welcome anyone who have experience with network coding to share their knowledge and suggestions here, or start a new thread about it.

Posted: Wed Nov 26, 2008 9:33 am
by turshija
heh, coincidence I have started learning SDL 1 week ago, and I tried doing something in SDL_net ...
The bad thing is that when distributing exe file, you have to keep sdl.dll and sdl_net.dll files in the same directory as exe file, because the program cannot start without it ... And sdl.dll is 232kb, so that means no more 64kb games ... :)

Posted: Thu Nov 27, 2008 8:51 pm
by kattle87
the point is just this: if you are making a 64 kb game, it won't be multiplayer :P If the game is not multiplayer, no dll is needed :P