Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Open MMORPG Project's Skills System (DBPro 5.9)

Author
Message
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 28th May 2006 10:21
I really liked the way this skill system is turning out and I figured anyone looking to make some sort of RPG could really benefit from it. While technically, the whole project is a WIP (and threfore this skills system is too), it is only a particular section of our overall code, so I figured the snippets would be a good board for it to go in.

The premise is that writing code for skills can be quite a daunting task. If you want 100 skills in your RPG, you may try writing 100 functions to handle them all. This skills system cuts that work down considerably by using a parser system. Only Skill categories are hard coded into functions. Within each category, each skill can be detailed out using the parser script arguments, which allows for quite a lot of fexibility within the category.

I've included some sample code, sample skills, and sample Characteristic "skills", Attack skills, and Damage skills. The specific skill functions are set up for a test text environment, but can easily be converted for 3D game applications (all the actual, non-demo, skill functions are just data and logic management - no real user "output").

In the demo, I've included:
_ Two Characterisitics: Strength & Agilty
_ Two Attack Skills: Basic Attack & Fencing Attack
_ Two Damage Skills: Basic Damage & Fencing Damage

Characateristic do not have any true functionality as skills, but simply act as "Parent" skills for other skills to be based on. In the example, Basic Attack uses Strength as a 'parent skill', which adds to the attack total. Fencing Attack uses Agility as its 'parent skill'.

The Attack Skills can be activted by the user by pressing the key bindings (left [Ctrl] for Basic Attack, and [F] for the Fencing Attack). Deactive a skill by pressing [Shift] + the bound key.

The Damage Skills are not skills that can be activted by the user (like Characteristics). Instead, the Damage Skills are called at the completion of an Attack Skill. So each Attack Skill can call its own specific Damage Skill.

So, how would someone use this? Well first, there are two levels of use. There is a sort of administrative level of use, which is simply to write each skill's argument list to create new skills within each category. Then there is the coder's level of use. The coder would write the specific functions for each category of skill. For example, the coder would write the Craft Skills category function. Then the administrator would write the specific Crafting Skills following the argument structure for Craft Skills.
All the coder really needs to do is use the Skills functions like any DBPro commands to write the category functions. All the dirty work has been done already.

For coders:

There are two levels for skills in the skill code (not the specific skill code): Base Skills (array = Skill() as Skills) and Active Skills (array = ActiveSkill() as ActiveSkills). Skills hold all the base loaded data from the Arguments. Active Skills simply act as references to indicate the base skill is Active (in play). The active array also tracks timing information, such as Delay, Decay, and Reset. Each Skill can also have an unlimited number of assigned Integers, Floats, or Strings. These can be used effectively for any additional information a skill may require. For example: a craft skill that produces an object once it is complete can use these variables to store the object information (maybe a base object number, or a file name).

The only remaining concept to understand is that the specific skill functions are set up for this demo, and not for an actual game. In an actual game, the specific skills functions should be written to do as much of the work as is possible. For example: The Attack Skills function will be modified to actually compare the Attack Total to the Target's defense. Only if the Attack Total exceeds the target's defense will the Damage Skill be called. The Damage Skill will simply deduct the damage directly from the target's health. Any special effects and animations will also be handled by these functions as well.

There are also a lot of protections (and redundant protections) involved when calling these functions, so the code is hard to break (not that it can't be - this isn't a challenge). If you call most functions with an invalid reference, the function will likely return a 'null' response (commonly 0 or -1).

The generic_functions file is just our project global use generic functions. There are a few functions I used for the skills code from that file, so I included the whole thing. Feel free to use those other functions as well.


============================================

I have put a lot of hard work into this code. Feedback and suggestions are more than welcome as I want that work to "pay off". Please try to write your own skills (either parser arguments for the existing skill categories or new catagories). Let me know what works and what doesn't work. Ask questions (related to the code) - I will happy to answer if I can. Thanks in advance!

And remember - it is all Open Source, so feel free to use and abuse it.


Open MMORPG: It's your game!

Attachments

Login to view attachments
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th May 2006 16:00
I wish I could say it's good... But the link is down

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 28th May 2006 21:26
ik kan het nog gewoon downloaden hoor.

^
|

i can still download it.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Jun 2006 09:02
And now the reason is...?
Seriously, any feedback would be great. Thanks.


Open MMORPG: It's your game!
Kenjar
19
Years of Service
User Offline
Joined: 17th Jun 2005
Location: TGC
Posted: 4th Jun 2006 15:03
I think they are all gob smacked at it's sheer wonderfullness.

Your signature has been erased by a mod because it's larger than 600x120...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Jun 2006 16:24 Edited at: 4th Jun 2006 16:27
must've been temporary. I can download it normally now...

I'll test it in a moment.

[EDIT]
I don't really get what it does...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 7th Jun 2006 04:41
Quote: "I don't really get what it does..."


It's an insertable skills system. Insert it fairly easily into any RPG type game. It's self contained (doesn't rely on outside source code). It can handle combat skills, magic, characteristics, skill trees, and a whole lot more. The skill functionality I have in the demo are characteristics and attack skills. But other functionality can be easily added.


Open MMORPG: It's your game!
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 7th Jun 2006 06:46
RiiDii, this looks phenomenal. Right now in my RPG I've implemented a placeholder system for generic skills, but nothing that comes close to this. Now magically, this wonderful coding has dropped into my lap.

I'd love to adopt this to work in my RPG. I'll pick it apart later and see exactly how I'll do it.

Thanks!


Come see the WIP!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 7th Jun 2006 10:21
Quite welcome. Let me know if it needs anything.
And thanks for the comments.


Open MMORPG: It's your game!

Login to post a reply

Server time is: 2024-11-23 03:55:55
Your offset time is: 2024-11-23 03:55:55