Pages

Friday, July 29, 2011

Persistence

I wrote this on my TIGSource Devlog, but I'll put it here, as well.

So, currently, I'm dealing with persistence. Persistence in a game is a staple of many RPG / adventure games in which a change the Player makes to one area stays that way for the rest of the game. An example would be giving an item to an NPC (Non-Playable Character), or opening a door via a switch - usually, you would want these changes to stay constant throughout the game. To achieve this, a developer would usually make a method to store the object's state between areas in the game by means of a global set of variables.

Today, I finished writing a whole Python class to do this persistence deal, but when I thought I needed to see if an object was destroyed or not, I ended up just going with a global dictionary (variable). It's simpler to deal with, anyway - less variables and data to store, though I still want to get some use out of my persistence class... Maybe I'll use it later (I doubt that to ever happen).

Right now, I've just got a global dictionary (logic.ge, which stands for Game Events), and store event changes, like talking to someone, in that dictionary. It works fine. Hopefully I can get some screenshots of something new out soon.

No comments:

Post a Comment