Monday, February 26, 2018

New Marshal in Town

Counting bytes saved
So I'm in the process of getting the main game running. When creating a new game, all the relevant game variables are saved into the disk and then your commander is "locked in" to that scenario. The game data is kind of a culmination of all the past structs I've worked with all rolled into one big blob. Right now I'm hand serializing all the data and comparing it to a game file I created in the original game. This requires lots of byte counting and making sure each variable is saved in the right order. I want to chat about marshaling for a bit.

It seems lots of people use marshaling and serializing interchangeably. It would appear that  serializing is the conversion of data blocks into a stream of data that can be saved. This is what I'm doing right now...by hand. Marshaling seems to be the active "teleportation" of data from one place to other via a serialized method. When I was a database programmer once upon a time, I just had to pass whatever data object to a serialization method and it was automatically marshaled away. I don't have such a luxury in C. I also have to contend with the old 2 byte/4 byte/big-endian/little-endian integer issues.

So the big question is why am I doing this?

Well, one of the game's touchstones is that it interconnects with other games. "Rules of Engagement" links with "Breach 2". The interprocess communication (IPC) between the games was done via file transfer. Right now the game is binary-compatible with the original. This means, that I should be able to link the new version of ROE to the old version of Breach 2 and have them talk back and forth. (Also, if things go well, port Breach 2 next).

 Also, in today's networked world, it would also be cool to trade captains, ships, races, missions, and systems online. Each are stand alone and don't require dependencies. (You don't need the G'shook Empire race on your HDD to share a mission with them in it.)

The game file serialization is the second to last filesystem thing I have to convert. The last is the auto-play demo files. It's partially implemented now, but is broken.




No comments:

Post a Comment