Savegames as save points are wrong?

Discuss programming in the QuakeC language.
necros
Posts: 77
Joined: Thu Dec 16, 2004 10:32 pm

Re: Savegames as save points are wrong?

Post by necros »

ew no, that's not what i was saying:
make some kind of extra copy in memory of the game state
so you take your snapshot of the game; "save" to another memory, essentially, and then slowly write it out over time. i'm just thinking it's probably way faster to duplicate everything in a save file in ram than it is to give it to the disk.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Savegames as save points are wrong?

Post by mh »

Ah, OK.

Tried it, didn't work.

Building the in-memory snapshot takes time - 25 ms for e3m7, for example. String concatenation in C is slow as hell - you'd need to build a pascal string interface to avoid having to scan over the entire buffer to find where it ends every time you want to add even a single char to it. Might test that sometime.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: Savegames as save points are wrong?

Post by qbism »

What's the performance hit of demo recording? Restore games from a demo. To load a savegame, engine would load demo and fast-forward in memory to a savepoint (or to the end of the demo). Save files would be "huge" in 1996 terms but so what. Optionally show it on-screen so player could jump in anywhere on the timeline. Not to derail into a discussion of an improved demo format, just daydreaming...
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Savegames as save points are wrong?

Post by mh »

I've no idea, but that sounds awesome.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
hogsy
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK
Contact:

Re: Savegames as save points are wrong?

Post by hogsy »

The performance hit from recording a demo seems pretty minimal from what I've seen.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Savegames as save points are wrong?

Post by Spike »

you would think otherwise if you have a half-broken disk drive that caused the machine to totally lock up for the duration of any read or write. :P
on any modern system, its pointless to make system calls for any data less than 4k. personally I'd aim for at least 64k.
fwrite is meant to have a certain level of buffering anyway, though I guess its buffer is conservative and only really there to cover really inefficient single-byte access.
Arkage
Posts: 66
Joined: Thu Nov 19, 2009 4:17 pm

Re: Savegames as save points are wrong?

Post by Arkage »

The demo save system sounds pretty cool.

Would make for a nice game mechanic, having the ability to rewind time and correct your mistakes. :D
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Savegames as save points are wrong?

Post by Baker »

qbism wrote:What's the performance hit of demo recording? Restore games from a demo. To load a savegame, engine would load demo and fast-forward in memory to a savepoint (or to the end of the demo). Save files would be "huge" in 1996 terms but so what. Optionally show it on-screen so player could jump in anywhere on the timeline. Not to derail into a discussion of an improved demo format, just daydreaming...
Demos record what the client knows (what the server tells it, which isn't much). The client doesn't know anything about entities except in single player (where you are both the client and server) and server stuff is never recorded into a demo.

A demo records: Visible entity positions and angles and frame, rendering effects flags. Your player's status bar info. And that's just about it. Well add static ends into that.

That monster that is on the other side of the map, a client doesn't know it is there. Doesn't know anything about triggers. Health other than your own. Etc.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Savegames as save points are wrong?

Post by frag.machine »

Baker wrote:
qbism wrote:What's the performance hit of demo recording? Restore games from a demo. To load a savegame, engine would load demo and fast-forward in memory to a savepoint (or to the end of the demo). Save files would be "huge" in 1996 terms but so what. Optionally show it on-screen so player could jump in anywhere on the timeline. Not to derail into a discussion of an improved demo format, just daydreaming...
Demos record what the client knows (what the server tells it, which isn't much). The client doesn't know anything about entities except in single player (where you are both the client and server) and server stuff is never recorded into a demo.

A demo records: Visible entity positions and angles and frame, rendering effects flags. Your player's status bar info. And that's just about it. Well add static ends into that.

That monster that is on the other side of the map, a client doesn't know it is there. Doesn't know anything about triggers. Health other than your own. Etc.
Worse than that, a demo won't record nothing that's not sent by network to the clients. So, if you have, let's say, a custom inventory in your entity represented by a bunch of floats in defs.qc... A demo won't record it. Your health ? The monsters current health ? Forget. Your game won't restore correctly. So while the idea is intriguing the current demo format is not suitable.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Post Reply