Monday, April 23, 2007

Almost a game...

Today I merged the UI code with the Gamestate code. And lo and behold: Something that looks like a game.

Almost a game, almost.

I discovered there is something severely messed up(I nearly wrote fucked up) with my Post-Build step. It doesn't update the revision in the bottom of the screen properly. It probably has to do with TortoiseSVN and it not going a proper update after the commit. Because if I do an update after the commit and recreate the file, it works like a charm. Pretty weird.

Also, I'm thinking about how I am going to handle building of stuff. First of all, I need something that manages buildings. We shall call this the BuildingManager. The BuildingManager contains a list of all buildings in possession of the player. When a building is destroyed, it will remove it, etc. Also, I need something to uniquely ID the buildings across the network(Yes, I'm also thinking about). So, each building will have an unique identifier, which is nothing more but a sequential integer.

When a building is being constructed, the BuildingManager will receive it's application and store it. It will then return the unique identifier to the building and inform the network about a newly constructed building. When it is the first building of it's kind, it will also contact the ConstructionManager. The construction manager will look in TechTree and see if there are any changes needed. If for instance the building just placed is a construction yard, it will see that after a construction yard has been built, the slab and windtrap will be unlocked. It will then add these to the construction sidebar.

For a networked game, there will be a RemoteBuildingManager(RBM) and a RemoteConstructionManager(RCM). The RCM will not schedule any construction, it will only pass the order to the correct building. The LocalConstructionManager(LCM) however, will find an idle building and post the build order there to be completed. This has the added pro of the game being able to check if a player is using hacks(Because, it can see how long it takes before the next build order arrives. If the remote player has an instant build hack, it can see that the player still has to wait for the construction to be completed).

So, still a lot of work to do, and I'll start out with the techtree loader tomorrow.

1 comment:

Anonymous said...

That interface is really bringing back memories :)

I was thinking, maybe a BuildingManager should be a member of a Player. This way you could use the same BuildingManager class for either a local human player, AI player or a remote human player. I'm not aware of the rest of your setup so I don't know if this is of any use, but I thought I'd drop in my 2 cents.