~ DAGOVAR :: A VISUAL BASIC GAME ~
Defining charactersCharacters are a type of entity that is essential in a major part of games. Depending on the game type, they will be defined with more or less detail. For instance, in strategy-type games, characters are usually defined with a few stats, while in role-play games characters have a wide range of stats. In many games, apart from their stats or personal attributes, characters have an inventory attached to them. That is the case of Dagovar games, too. In the image below you can see the character's stats to the right and the inventory items to the left.
Games, as any other application, are made up of a great amount of data definitions (variables) where we store values that are used to control what the game has to do in any moment. There are different types of variables to be used, but what they all have in common is that they store numbers. These numbers have a meaning in the world of the game, and their values can be shown as they are - numbers - or can be assigned to a certain object or concept, that has to be shown as an image or a behaviour on the program.
A character is simply made up of certain kinds of numeric - or alphanumeric - variables that arranged together define it. And I say arranged, because they are included in user-defined types, a type of variable that allows to manage with ease large amounts of data. If you read further these chapters, you will see that nearly any type of entity will be defined with an user-defined type. The complexity of an application such as a game, will make necessary as well to nest certain user-defined types inside another user-defined types of higher hierarchy.
As you can see in the image, the character has a bunch of attributes, labelled in green color, starting by her name, Arcania, and some attributes with a current and maximum value. That is because our character will be able to increase these attributes when she earns experience points. There are two additional attributes on the top of the list, labelled in yellow. They are apart from the others because they are a particular type of attributes; they are just limits imposed to the character, so she cannot surpass a certain thresold of value (attributes and items have a cost in points that adds up until reaching a limit value for the character).
You can see as well an antibullet vest, labelled as ARMOR, on the central space between the attributes and the inventory; the antibullet vest is an atribute on itself, but it is represented as an image instead of a number, and it is an attribute that can be altered in a particular way during gameplay - the character can wear it or not, or pass it to another character -. The colors of the character's skin and hair are also attributes whose value is shown in a graphical manner, and these can be changed only while creating the character on the CharEdit application.
Well, as I said, each attribute is just a numeric - or alphanumeric - value, but in the game all these values will be used in many different ways. For instance, the alphanumeric data that form the name of a character is just used to make that character recognizable for the player, while the stats and the antibullet vest obviously influence many algorithms that work during the game.
Now to the left we can see a serie of items that are included on the inventory; these objects could be considered also as attributes, since they add something to its owner. But each of these objects is more than that; it is an entity on itself, with its own attributes. As I said before, an user-defined type can be nested inside another user-defined type that is higher in hierarchy. In this case, inventory items are 'inside' characters. Now I will show you the source code as it would be programmed in Visual Basic 6 to define these lovely creatures:
Let us see now some definitions of constants that the program will use:
Finally, we have to declare the variables that will make use of our fascinating user-defined types:
And this is the foundation of the CharEdit application and the seed from which the game can be born. I am not going to write here all the source code of the application, since that would be just sick. Remember that the complete game has around 20000 source code lines. I just wanted you to see how data is conceptualized and arranged to be used efficiently. The rest of the program is just the manipulation of this data; click here to change this or that other attribute, save all the variables to a file, load all the variables from a file, and so on... the limit is your own imagination, your skill or your patience...
In successive chapters I will enlighten your spirit with more subjects around the Dagovar project, that can be used as an inspiration to create other games.
~ About Dagovar ~
~ Desert Vixens 2 maps ~
~ Desert Vixens 3 maps ~
~ Tile-based terrains ~
~ Random maps ~
~ Screenshots ~
~ Algorithms ~
~ API functions for games ~
~ Source code examples ~
Return To Index