Sign in to follow this  

RPG implementation questions

Recommended Posts

Hello everyone! In the RPG I'm programming, there is going to be a myriad (possibly in the order of thousands) of different items, all with different effects. The same with all the different attacks and spells, and NPCs. I'm having a little trouble visualizing how all that would work out in code. The approach I'm currently thinking of involves: A) several large resource files with all the info for the attacks, characters, and items, divided up by what is available in each level. B) a bunch of functions divided up in different namespaces based on their properties C) either some huge switch/case if/else decision trees to decide which function to run (e.g. when an item is activated or when an enemy attacks) or use a function pointer in the class to point to the proper function as mentioned above. I'm not sure if this model would work, and I'm even more unsure about how I should go about making such large resource files. (excel perhaps?) Thanks in advance for the help, it's always apprecated!

Share this post

Link to post
Share on other sites
What you are describing is a quite common (afaik) problem, and solvable in so
many ways.

<name>Great scimitar</name>

The XML above will be located in a big file and will mostly be manipulated using an itemgenerator application you write.

Since the XML has a tag '<damage>' we know the item does damage and we can input the value of the tag '1,8'.
If it was an armor it might have a tag '<armorrating>100</armorrating>' and we would know that it could protect. We don't need to know anything else.

The textures are placed in a folder, or you can write a custom file structure to contain this as well (Like Homeworld's .big files).

The best here is that it's very easy to add new items, new spells, new graphics and so forth without having to recompile everything.

Say you introduce a new <fireresistance> tag, just add this to some items and the relevant tag will be taken into consideration when protection is beeing calculated.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this