Progress

Published July 05, 2005
Advertisement
Ok, so after the last post I went and brought over some of the base Entity classes I had created, and ended up changing them some to accomodate the fact that there are no rooms in this game, etc.

After I did that I started to think about the retrival/storage of data and how I was going to handle it. In my mud I stored everything in XML and read and wrote it to the drive. I kind of want to store everything in SQL since it could be more efficient and I do SQL back end programming for my day job.

The problem is that all my SQL programming experience has been on windows using either MFC or Borland C++. I so far have been able to keep the code cross-platform and I'm developing it with Dev-C++. I'd like to keep it that way and use something like Postgres or Mysql for the backend, but in a half hour or so of searching didn't find any decent tutorials for their respective API's. I really don't feel like having to dig through them and figure them out myself.

So basically what I was thinking is to use SQL for a backend. When the server starts load all the entities except for the players into memory. Then as a player connects create a thread to load his data from the database while I send the rest of the entity data to him over the network. Finally send him the entity data for himself. Once the game is running, I can set up a timer that fires off every couple of minutes and fires off a thread to go through the entity data and update the database with any changes.

So the next thing to think about is how much data I want the client to hold client side. I definately don't want to send him the entire "universe" as that leads to hacking and mapping out everything without actually exploring it. What I was considering was to take the max "sensor distance" and maybe adding a small amount to it. Then use that as the distance to look in for sending entities to the player. Then I can tell the client to destroy any entities that are outside of X radius, which would allow the client to delete old objects from memory. I think that should work without giving the client too much to deal with. It would also allow me to send updates to clients based on the distance from them, obviously I don't need to do position and rotation updates several times a second on an object that is outside the players view radius but within his sensor radius.

The second part of the data question is how much do I want the client to know about each entity? Obviously I don't want to send the entire entity complete with scripts and the associated data. What I will most likely do is create a "Network Entity" with the basic position, rotation, model(sprite?) and speed info and use that to represent everything the player can see. That would decrease network load, limit what the client can see and still give enough information for the client to render it and do some basic prediction.

So the biggest hurdle I think is going to be the database. After that I will have to do something about writing the client, which I am not looking forward to. I will most likely do up something simple just to so I can get the networking portion working. I can use allegro and get something going fairly quickly.

So tonight after work my goal is to look into the database. If anyone has any suggestions or tutorials I'd appreciate it.
Next Entry Ah yup.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Advertisement