Okay, so I’m about 1/3 through the first bottle of wine. Its good :]
Anyway, I’ve been working on some prototypes for my generic game-system-within-a-game project. With some inspiration from other well-established systems (ie, TA) I’ve decided on a generic way to represent a player such that any given mini-game can both access and manipulate the character data.
Its by no means a new idea (in fact, I implemented something similar when I wrote my ‘generic text-based game engine’), but essentially a player is represented by an attribute map. At this point the map is a string-to-Attribute map, where Attribute is defined as
class Attribute {
std::string id;
float val;
};
Now, the clear-and-present problems with this -
There is no way to group attributes. Say, if you wanted to have an inventory. It wouldn’t be technically feasible to implement in this manner. One solution is to give each attribute flags, for example, something could be flagged with “FLAG_ITEM” and thus be a part of the inventory.
This isn’t what I really want to achieve at all – I want a generic way to represent a player’s attributes, but have a common interface such that its flexible enough to work between widely varying genres.
At the same time, if a given mini-game is going to look for a certain attribute (ie, “gold”) then its going to have to be pre-defined and used across all the games wanting that attribute. Which would mean that there has to be some agreeance on a common standard.
Another consideration is the target game genre – not RPG. I doubt that an inventory would be necessary, aside from a list of flags (of powerups, or quest items, or whatever).
That said, I think it is important to maintain a method to grab a set of attributes based on a common identifier. After writing this (as this is essentially a brainstorm for me) I’ve pretty much decided to add in a flags field to the Attribute class, and a method in the player class to grab a vector of all attributes displaying a certain flag.
So yeah. That’s the player system for you. The player system being, essentially, the only method of communication between mini-game “modules” (or whatever).
Time for more wine :)
Comments are off for this post