Ultra simple simulator running

Getting two processes talking to each other over UDP/IP with Twisted was no problem. There was a Win32 one hack the author’s had put in that would have been a show stopper; however, they did it in such a way that it was possible put in a hack to remove their hack, so no problem.

I was a little premature on networking though. The simulator process doesn’t need to talk to the process with the 3D rendering GUI (we’ll call that the player for simplicity) from to actually do a simulation, and there is yet another process that will actually be starting both of those (we’ll call that the client), so putting in communication between the simulator and the player without the client would just be throw away work. Anyway, the simulator needs to be able to create a file that the player can use to render the course of the simulation from the perspective of one of the entities in the simulation. What the player shows is like watching a demo for a first person shooter, or if you saw the Robin William’s movie Final Cut it’s like how the Zoe implant recorded everything in a person’s life from their perspective.

At this point I have simple simulator coded up that runs a simulation on a hard coded input of two equally matched combatants duking it out (they tie every time). So the next step is to have the simulator write out one of the combatants perspective to to a file and then have the player playback the contents of the file like a movie.

Thus it is time to delve into Python object serialization and deserialization. In looking at the Twisted docs it has some support for this. I’ve also encountered the term “pickling” regarding Python object serialization, but I don’t yet know if that is part of standard Python or yet another library. Another way to go is to use SQLAlchemy with a SQLite database. SQLite runs in process and now is included standard with Python (at least Win32 installs of Python) so there is no database server product to be installed and no seperate SQL server that has to be configured and the database is contained in just one file, so its nice and simple compared to big iron databases. SQLAlchemy can be used to get Python object mapped into a database, but it also allows for a lot of more control over how this happens if you need unlike most other Object Relation Mappers.

This entry was posted in Coding, Game Development and tagged , , , . Bookmark the permalink.

Have something to say?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s