The Dink Network

How FGO works

Fairy Goodness Online

December 5th 2007, 02:24 AM
Peasant Male Australia
(Note, FGO is incompatible with the v1.08 patch, so don't bother trying it. Single player works though, up until the last level.)

I was looking through the reviews of FGO (why people who hadn't played it online were reviewing it was beyond me) and I noticed someone asked how it worked. It's never my nature to hide my code, but I didn't explain it because it was Silencer's idea and he asked me to.

However Silencer is unlikely to still be working on what he was working on, so here's how it works for anyone who hasn't figured it out yet: there is a global variable that has the score. Dink constantly saves the game. gonline.exe reads the save game, extracts the score, and sends it to the gonline.exe on the other person's computer. That gonline.exe then creates some file that reads something like this:

void main(void)
say_xy("Other person's score: <score here>",0,20);

which is being constantly spawned() by DinkC. And of course this process is going in the other direction as well. Also, obviously, reading from the memory directly would be more efficient than from the save game, but save games worked well enough.

The other file, run.exe, is not involved in the process at all and is not necessary to run Dink.

So the mechanics behind FGO could be adapted to have a lot more functioning, e.g. in the file constantly being spawned have instead something like this:

void main(void)
&p2x = 25;
&p2y = 30;
&p2hit = 1;

then a representation of a second player can update based on the input information. Though this is a lot less interesting/fun now that the source is released.

I don't intend to update FGO to make it compatible with v1.08. (Although I'm a little tempted to remove most of the mentions of "IkkeJW", since he made two minor updates to it and added his name in every possible place, to the extent the DMOD actually has more instances of his name than mine..!)