Advice needed for RPG Strategy 'em up!

Blitz3D Forums/Blitz3D Beginners Area/Advice needed for RPG Strategy 'em up!

Uraliss(Posted 2003) [#1]
Hi Folks,
Another question for you gurus!
Continuing the work on my strategy rpg thingy, Ive reached a point where I need to come up with some way of storing the characters, creatures and objects in the game. This is now looking to be more complex than I initially thought it would be. Here is the sort of information I need to store for each entity in the game.

Name
Information
Class
Race
Level
Health
Skill
Strength
Power
Morale
Movement Points
Initiative
Graphics Pointers
Sound Pointers

Each entity will have lists of the following also:

Inventory
Spells Known
Status
Powers
Currently Equipped

Now, whats the best way of storing all this data? Should I ivestigate Types, Arrays, Mem Banks, Text Files....

The game structure is a turn based tiled strategy fest - no fast graphics other than spell effects and small stuff.


Cheers


Dr Derek Doctors(Posted 2003) [#2]
I was thinking about doing a big SRPG and I thought I'd just store everything in a HUGE array, that way it's very easy to parent objects to creatures and stuff like that. As for how I was gonna' access the stats I was going to use a set of CONSTs as offsets within the array structure, ie.

strength = entity (id,STAT_STRENGTH)

Where id is just the id of the creature and STAT_STRENGTH the constant. The only problem with this approach is that all your data has to be of the same type (no doubt integer in an RPG I would think) so things like name$ would have to be dealt with separately. Though in mine the would be a very finite number of names as it was really a wizard against a load of creatures who'd all be "skeleton"'s or "zombie"'s.

As for how I was going to store the default settings for everything, I was gonna' opt for text files with a parser, just because it's a really nice and readable way to store stuff and you can edit the values very easily that way.

But that's just me. What do I know? :)


Waz(Posted 2003) [#3]
I am new but I was thinking what about types? I aint learnt this prooper yet but wouldent it be done like

Type Player
Field Name
Field Information
Field Class
Field Race
Field Level
Field Health
Field Skill
Field Strength
Field Power
Field Morale
Field Movement Points
Field Initiative
Field Graphics Pointers
Field Sound Pointers
End Type


then do something like

player1.player = new player
player1\name$ = "Maximus"
player1\information = "His tall, dark skinned and sexy! STR is 10, Dex is 100 etc etc"





Am I way over my head here? I just guessing sorry and trying to contrubite to the community as much as they have helped me. Sorry if this is all rubbish.

Or how about a 3 dim array? LOL


Waz(Posted 2003) [#4]
sorry not sure how double post happend my mistake.


Phil Newton(Posted 2003) [#5]
If you create an array of types, it can be a little easier to get individual character stats up (at least, I find it easier).

Dim Players.player(10)
players(1) = new player
players(1)\name$ = "Ty"

etc.

There's no right or wrong way of doing this, but I'm from the Types camp. So Waz, that was a great contribution :)

Uraliss: Does your game play anything like Shining Force? Just curious ;)


Waz(Posted 2003) [#6]
I am new but I was thinking what about types? I aint learnt this prooper yet but wouldent it be done like

Type Player
Field Name
Field Information
Field Class
Field Race
Field Level
Field Health
Field Skill
Field Strength
Field Power
Field Morale
Field Movement Points
Field Initiative
Field Graphics Pointers
Field Sound Pointers


then do something like

player1.player = new player
player1\name$ = "Maximus"
player1\information = "His tall, dark skinned and sexy! STR is 10, Dex is 100 etc etc"





Am I way over my head here? I just guessing sorry and trying to contrubite to the community as much as they have helped me. Sorry if this is all rubbish.

Or how about a 3 dim array? LOL


Uraliss(Posted 2003) [#7]
Waz, are you using the back button after you have posted?
Thats probably the cause of your double-posts.

Ty, I haven't played Shining Force so I can't really comment on that game - I'm gonna check it out though.

I suppose my game will be a kind of D&D version of LaserSquad or RebelStar Raiders on acid.

When i get some time I will post some pics of the level editor i have made for it.


Dr Derek Doctors(Posted 2003) [#8]
Spookily, my game was going to draw inspiration (read: thieve ideas) from a Julian Gollop game, only I was gonna' do Lords Of Chaos in isometric with a nice over-arching story and non-linear play.


Tricky(Posted 2003) [#9]
What you could surely add to it, maybe not that important for the players but it is for the enemy, is a weakness system... What can an enemy bear, and what not...

Like this for a Hell-Hound

Fire - Resistant
Water - Weakness
Ice - Weakness
Earth - Normal
Thunder - Normal
Holy - Normal
Evil - Normal

And for a zombie you could set holy to weakness, and whatever, and so on... That can really power up... It's not really realistic if you can beat a Fire beast, like a hell-hound or a phoenix with fire, now is it?

What I also miss is the ammount of experience points... I think that's a vital value...

I'm also not sure what I should see for "Morale"...

Another thing is not to come up with too much statistics, they might easily be forgotten... Just like too much equipment... Just be sure only to add what you really need...

What I also miss it the supporting of status-changes, like Paralyzed, Poisoned etc... A good thing to enter in an RPG y'know...

As for if you should use types or not... In Blitz better not, but if you want to use them you can better use them in array style... Like if you need 6 players

Dim P(6).Player

For Ak=1 to 6
    P(Ak) = New Player
    Next


For each is definatly not going to work... (I'm an RPG creator myself, and that's what I know from experience)...

Array types are easier to track in an RPG especially since you need a value for the "Target"...

Are you still following me?



Another point is... I set up all statistics in an array of three...

Like this
Dim Strength(4,3) ; First digit, player number, last digit will be explained...

Then I would define it like this

Strength(1,1) = The character's strength without weapon
Strength(1,2) = How much points has the character's strength been increased by spells
Strength(1,3) = Characters strength with spells and equipment

Very important...

In fact I also work in my statistics in complete arrays...

Dim Stat(4,3,10)

First digit, player number you know, second digit for the adjustments discussed above, and the last one what kind of statistics... Like 1 = Strength, 2 = defense, etc...

Why this method? Can save you a lot of time...

For spells I use a semiliar array

Dim SpellStatAdjust(10)

In my database I can then very quickly change everything with a four-next loop, while otherwise I have to define every single field... I just love the quick way...

I do the same for equipment, statuschanges, and lots of things...

Please remember, I've been programming RPGs for 5 years now, and these methods have really been thought through...

One warning... Creating an RPG requires more than you can ever imagine... MUCH more...

You'll require tons of diffrent databases... Like stores, spells, equipment, Experience level gain tables, dungeon information, monster statistics, properties of persons you meet in the game, properties of items...

Are you sure you still want to go on with this?


Rottbott(Posted 2003) [#10]
Waz has it right, types all the way.


Tricky(Posted 2003) [#11]
Types is what I would use in other languages indeed...
Blitz structure of types learned me NOT to do that...
I've had very bad experiences on that... Trust me, I've been coding RPG for years now... (It's the only type of game I'm really good at) :)


_PJ_(Posted 2003) [#12]
I would suggest storingt the Spells and inventory as Types, because the actual nmber of objects wold be changing, at the start you may carry 3 items, bt eventally, yo may be carrying 10 items or more. unless you have a definite maximm, Types I believe are best for this sort of thing. Especially as memory is only used up by existing types.


Uraliss(Posted 2003) [#13]
Ok - looks like I need to learn a lot more before I start work on this next bit.
I'm just getting my head round types and then Tric comes along and mentions arrays of types.
Will keep you posted on my progress and thanks for the advice.


Tricky(Posted 2003) [#14]
One thing I learned from coding RPG... All other kinds of games may be complicated in engine and screenplay, and thus, more than an RPG, but when it comes to all data you need, RPG almost tops anything...

And one advise from an experienced RPG coder, be sure you have all data you need before starting to code...

If you forget something the results are horrible, and very hard to fix...


_PJ_(Posted 2003) [#15]
My rpg is gonna take a (very) long time. I still haven't finished collating ALL of the information I will need from general player stats to monster combat abilities to item properties etc. That's without even touching a keyboard, and to think - I have a whole world to create, then I have to make it come alive too...

A daunting prospect - but I am trying to plan it out and make it as efficient and organised as possible, so that I won't get 'lost in my own code' (if you know what I mean), and so that it will be easy to debug/enhance/alter for whatever reason etc.

Here are some ideas that I hope to implement that may be of use (the RPG is fantasy/dungeons & dragons - oriented, so lots of swords and spells):

(EXTREMELY) SIMPLIFIED HERE
Character Has basic stats:

Strength
Intelligence
Speed

These are visible to the player, and are the values that show roughly how strong, smart or fast the character is.


These are broken down within the program, whenever they are used into the following, but these are not necessarily visible to the player:

Strength: Combat Strength...Carrying Strength
Intelligence: Perception...Magic Points
Speed: Combat Speed...Running Ability

From here, Items can be defined with certain properties:

Magic Sword...has a weight (matched against Carrying Strength) and a combat effectiveness which is matched against Combat Strength. It also has a speed which affects Combat Speed, and may bestow a special power affecting Magic Points etc.

An enemy Dragon has similar stats, but only requires the broken-down versions.

Hope this
a) makes sense
and
b) is of some help!


_PJ_(Posted 2003) [#16]




Spookily, my game was going to draw inspiration (read: thieve ideas) from a Julian Gollop game, only I was gonna' do Lords Of Chaos in isometric with a nice over-arching story and non-linear play.








Awww you stopped this idea? I would've loved that! I'm still waiting for the 2nd LOC expansion levels for the speccy!


NTense(Posted 2003) [#17]
Uraliss, I would HIGHLY recommend the use of types. Essentially, you can create a relational database with them. For example:

Type PlayerTemplate
   field Name$

   ; Add a player ID number
   field playerID
   field Information$
   field Class$
   field Race$
   field Level 
   field Health 
   field Skill 
   field Strength 
   field Power 
   field Morale 
   field MovementPoints 
   field Initiative 
   field GraphicsPointers 
   field SoundPointers
End Type

Type InventoryList
   field playerID
   
   ; here you can store all of your object info
   ; such as weight, name, damage, abilities, etc..
   ; in an object type that is stored in a separate
   ; list

   field object.ObjectTemplate
End Type

Type SpellList
    field playerID
    field spell.SpellTemplate
End Type

; Essentially you could have a lookup function to return
; a player's inventory or spells

Function GetInventory.InventoryList(someplayersID)
    ; this function will cycle through the inventoryLists
    ; and compare the field playerID with the arguement
    ; someplayersID.. If they match, add the item to a 
    ; return list.  Then, after they're all compared,
    ; return a list holding the player's inventory
End Function


Anyway, this is the general jist of how it can work.. There's a lot of flexibility, in how you can make this happen, so hopefully this will give you a framework to go from.

Good luck!


Dr Derek Doctors(Posted 2003) [#18]
Malice, it's not completely stopped, just on hold for a bunch of other stuff. I'd still love to do it, but it'd require a crapload of graphics.

Uraliss, Tric's right. You gotta' nail down all your data structures from the off. Think about every feature of your game and all the most wacky and esoteric creatures and spells and items first because you've got to allow for them in as least a kludgy manner as possible.


Uraliss(Posted 2003) [#19]
Thanks for the advice guys.
Just to clarify - its more strategy than RPG - for instance the players won't be wandering around speaking to NPC's and accepting quests or anything like that. Its hard to describe but it will probably turn out like a boardgame.
Im hoping to have the level editor finished and up on my website soon so you can all have a gander.


podperson(Posted 2003) [#20]
In misc code under "Text and Data Utilities" I've put a bunch of code for storing arbitrary collections of data in strings. This is a lot more flexible than using types and also allows for easy storage of information in text files (for which I've also provided simple commands).

E.g. if you think of a new property to attach to a character you just do it and don't need to modify your type, the routines to load and save it, and so forth.

Likewise, you can just whack all the information associated with an entity in its name (which is a string).

The only restriction is that you can't include carriage returns (chr(13)) or tabs (chr(9)) in the properties.


Dr Derek Doctors(Posted 2003) [#21]
Podperson, that sounds useful and may well be something I look at when I get back to my game. Strings are slow but in a strategy game that's hardly a concern...