Reputation: 90
im working on a RPG system for my friend, and I was wondering on how to make the skills system, should I use ArrayList skills as a type and write every skill down, into a XML or in to a class?
Example
Skill s = new Skill();
ArrayList<Skill> skills = new ArrayList<Skill>();
s.name = "Dodge";
s.description = "Dodge a attack.";
s.requirements = "Dex +30";
skills.put(s);
Or something like...
Dodge dodge = new Dodge();
Skill s = new Skill();
ArrayList<Skill> skills = new ArrayLst<Skill>();
s.name = dodge.getName();
s.description = dodge.getDescription();
s.requirements = dodge.getRequirements();
skills.put(s);
Upvotes: 1
Views: 2452
Reputation: 21
I would use XML reader from Aion-lightning project. It is easy to use and scopes for larger sets of xml files.
Upvotes: 2
Reputation: 3108
Well, i would rather do XML instead of a class.
Mainly because you don't have to recompile your game everytime you tweak skill values.
Depending on how advanced you want it, check out RunUO. Its a open source mmorpg project for simulating a Ultima Online server.
Upvotes: 1
Reputation: 5425
Skills in RPGs are usually used as 'data' to determine the effectiveness of some kind of in-game action. As such, skills are an easy candidate for a data driven design.
Rather than hardcoding it, use some method of having the skills populated from a set of data, and have the game mechanics look for these skill values after having read them in. XML is a good candidate for this. It is a bit verbose, but a lot of editors/IDEs recognize it and java has parser support for it built in.
Upvotes: 3