Re: Question about development of prototyping tools.

Jon Watte <[email protected]> Sun, 24 Apr 2011 12:22:42 -0700
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
On Sat, Apr 23, 2011 at 5:28 AM, Massimo Del Zotto <[email protected]>
 wrote:

> I'd still want to support dynamic reloading again in some future iteration
> so I'd like to read some directions on solving those issues.
>
>
I've found two things being useful:

1) Use indirection properly. Assets are just data containers, and are
exposed to the rest of the game through some abstraction (which could be an
ID and a library call, if you're data centric, or an object if you're OO
centric). Pointers straight into the asset data are only allowed by the
abstraction, and not surfaced outside that point. When you reload assets,
you reload the data, and patch up the pointers kept by the ONE THING that
knows about the asset internals; the rest of the game accesses the necessary
data through that one thing, potentially using temporary handles that are
invalidated each frame (in debug mode, physically invalidated, so you catch
people trying to keep them around).

2) Save/Load. If you have a "perfect" save/load system, then if you change
too much for the state to be properly patch-able, you "save" the game (to
RAM) and reload the level as if the user had done a "load" of the game. This
does impact scripting, though -- you can't implement timed triggers using
native coroutines, for example; you have to have enough data hooks into
EVERYTHING that you can properly save and restore all the state that
matters. It turns out that when all your state lives in data, rather than
implicitly in active call stacks and stuff, there are some other nice
structural benefits that come out of that, too, but it does require a
different way of thinking about writing script code for someone who's used
to banging it all out as sequential code.

Sincerely,

jw


--
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world. Nevertheless,
whether we get there willingly or not, we shall soon have lower consumption
rates, because our present rates are unsustainable.




>

_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com