Help with conquest file saving

Discuss anything not covered by any of the other categories.
Post Reply
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Help with conquest file saving

Post by Wazat »

1)
I'm confused on what the best way to do this is. When the player beats a level, the next map in line needs to be saved in a file and then the player should go to the town instead. The reason I want it saved is so that after the player has bought all the weapons etc he needs from town, and is ready to fight again, he can go to the warp gate and select which level to go to. The next map he would have gone to is the default, but below that is a list of all the other maps he's beaten, which he can replay for gold and experience if he wants to.

a) The first step is easy in its simplest form: just append the next map's name to the maplist file (maplist.tsav). But here's my first question: how do I keep different saved games separate? For example, if I'm playing through the e2 maps, and I save my game, and then my brother gets on and starts a new game, my map list file will be deleted as soon as he beats the first level. So, I need to keep different files separate for different instances of the game.
Should I generate a random number between 1 and 2 billion at the beginning of the game, and use that to identify all the client and maplist save files, so they have a very low chance of conflicting?
Perhaps I could save the files based on the date and time the player started? Is there a command in DP to get that info?

b) The second step is displaying the contents of that file. I could traverse the file *every* time I want to refresh the menu, but all too often files = evil because disk access is so slow. So, my guess is that when the player enters the menu, the file is read once and a linked list of entities is created, each holding the map name in "netname" and other values such as times played, best time, secrets found, monsters killed, etc in various .floats. This can create a lot of entities (assuming the player has beaten the ID1 campaign and a host of other custom campaigns), but it's the best solution I've thought of so far.

2)

My friends and I played Conquest in single player, and it was lots of fun, except for two frustrations. One, DP was crashing on map change, but I think that's because I'm using an old version of DP and I forgot to download the new one over the weekend. The game was also not deleting some entities (for some clients: lost net messages?), so we'd get some interesting things like the tesla mine leaving behind bits of its lightning. Probably something wrong my code.
The second problem was that I had not set up Coop's gameplay very well. When one of us died, we respawned with the same shields, weapons and money we had when we started the map. This was annoying because of it takes time to re-buy weapons and ammo and such, assuming you even have the money to do so. They also had to walk all the way back to where they were when they died, so we had to wait around for them in the mean time. Thus, I really need to figure out a good system for coop.
a) One idea is to let the player keep everything when he dies. His shields, weapons, items, armor, money, etc are not lost, and he respawns with 100 health.
b) Alternately, every time the player touches a shop, it updates his save file, kind of like a check-point. So, when the he dies, he starts at the last shop he contacted, with all the stuff he had at that time (losing anything gained afterwords). I'll have to make sure there's a limit on how often the shop updates (otherwise it'll be re-writing the file 60 times a second or so when the player is near a shop), or maybe I could make it cost the player something to set a checkpoint, and he has to consiously set them with some command at the shop (open the shop menu, press 9, close the shop menu).

What does everyone think? Any other ideas on either subject?
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Tei
Posts: 193
Joined: Mon Oct 25, 2004 12:22 pm

Re: Help with conquest file saving

Post by Tei »

Wazat wrote:1)
Should I generate a random number between 1 and 2 billion at the beginning of the game, and use that to identify all the client and maplist save files, so they have a very low chance of conflicting?
I agree.
b) The second step is displaying the contents of that file. I could traverse the file *every* time I want to refresh the menu, but all too often files = evil because disk access is so slow.
Not that slow, maybe. Except If you are doing something ridiculous

a) One idea is to let the player keep everything when he dies. His shields, weapons, items, armor, money, etc are not lost, and he respawns with 100 health.
I knows Counter Strike has the same problem.
Supa
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Re: Help with conquest file saving

Post by Supa »

Wazat wrote:The second problem was that I had not set up Coop's gameplay very well. When one of us died, we respawned with the same shields, weapons and money we had when we started the map. This was annoying because of it takes time to re-buy weapons and ammo and such, assuming you even have the money to do so. They also had to walk all the way back to where they were when they died, so we had to wait around for them in the mean time. Thus, I really need to figure out a good system for coop.
I think you should try something like Diablo - instead of completely losing their weapons when they die, players could drop a backpack filled with their stuff. Only they would be able to pick up the pack, so you wouldn't griefers make life harder for others by stealing packs. Of course, you could also implement a system that could allow a player to authorize another to carry their pack until they met up with the rest of the players. Only problem I can think of would be that if the pack fell into lava or some other inaccessable place, that player would be screwed..
aut viam inveniam aut faciam
Gilgamesh
Posts: 67
Joined: Tue Oct 26, 2004 6:08 pm
Location: Brazil
Contact:

Post by Gilgamesh »

...or when the player die, there is a countdown to the respawn. The player should respawn at the same place, and the countdown should be proportional to the amount of live players. When the countdown reach zero, the player will be forced to respawn.
Why? Well, this way the players will be forced to hold position and help his fallen friend.
#EOP
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Thanks all. I still don't know what the best way to print the map list would be.

I'm also agonizing over how to do ammo. I've come up with lots of ideas for how to fill the player's ammo, and what weapon fills from what ammo. Most of the ideas are similar, simply giving the player's weapons a certain percent of ammo when picked up (cell boxes heal more than shells, etc). A couple other ideas involve making some weapons be refilled only by cells, other by nails, etc.

The unique one, which I'm seriously considering using, is closest to Ratchet and Clank, where the player breaks a crate, and an ammo refill for one of his guns pops out. If one of his weapons needs ammo, then that's the ammo he'll get; otherwise when they're all full he'll randomly get ammo for one of the 5 weapons. Basically, all the ammo items become crates that heal different amounts based on what item they used to be. Cells refill more than rockets, rockets more than nails, etc.

Also like Ratchet and Clank, I'm considering having gold, ammo, and other items pulled toward the player when he gets close, to make collection less annoyingly precise.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Post Reply