• Advertisement
  • entries
    109
  • comments
    175
  • views
    117142

A bunch of creatures...

Sign in to follow this  

162 views

Yes, I know, I tend to multiupdate my journal these days.

First, thanks everyone for your support about this tiny RPG system project. I really hope you like it (after all, that's why I discuss this in my journal) and I hope you'll like the ending part much more - you know, the parts where I'm going to explain everything in details :)

I added a bunch of creature classes - it took me 30 minutes to do so (you can't believe how easy it is now [smile]).

  • CreatureRaceHuman: trivial - the typical human; good at everything (read: it has a bonus for each skill)
  • CreatureRaceDwarf: the dwarf (resistant).
  • CreatureRaceElven: the elven race (wise).
  • CreatureRaceZombi: people who look like Evolutional
  • CreatureRaceVampire: er.. vampires. You don't want to fight them right now.
  • CreatureRaceSkeletton: a skeletton warrior. It is pretty easy to defeat
  • CreatureRaceGiantRat: a giant rat
  • CreatureRaceGiantSpider: a giant spider (ouch)
  • CreatureRaceBrownBear: a bear that can really hurt you
  • CreatureRaceOrc: our beloved orc

These creature races inherit the existing CreatureRaceBase class, which holds the natural weapon as a InventoryObjectWeapon (all the creatures, even humans, have a natural weapon). This weapon is, in fact a NaturalWeapon<> instance which implements natural weapons using a template - enabling me to create different type of natural weapon without having to create a new class each time (the only thing that is different bewteen two natural weapon is their names and max damages).

As for now, the world namespace look like this:

[clicky for full resolution]



See you later!
Sign in to follow this  


5 Comments


Recommended Comments

I have a quick question about your design. Why did you decide to go with Inheritance to create your races? Wouldn't it be easier to do something like this:

structRace
{
bool isPlayable;
bool isGaseous;
etc...
}

Then it would be really easy to load a race from a text file or something like:

Goblin.ini

isPlayable:false
canWearArmor:true
isMadeOfCheese:false


Edit: I just remembered that you decided to hardcode everything. Nevermind.

Share this comment


Link to comment
Hard coding? I agree with Drakkon. If you ever want to expand, you'll have to open code and add the new MOB, or Item, or Race. Even if it's throwaway, you should start using good programming techinques, especially reusability.

Share this comment


Link to comment
Thanks for your comments - especially you, wackatronic (I mean - I hope I'm producing reusable code) :)

Of course, these isGaseous() or isSolid() methods feels a bit wrong - but I'll stick with them for the moment, because it is not much important. There is a point where one has to ask himself: don't I over-enginer this stuff?

Having a mecanism that will load the race description from a file is fine (and in the end, is probably better than what I'm doing right now) but it will only introduce some more quircks in the design itself - not to metion that if I do this for races, I'll need to do this for weapons, inventory objects and - in the end - creature actions (because a hard coded action won't be able to test a specific value in the creature race (race->isSubType("gaseous") can be test only if I know that "gaseous" may be defined). Which mean that I need a scripting language - because creature actions are (guess what) actions :)

So, while it is a good idea, I let it on the side of the road for the moment - let's concentrate on something which is more important: the design of our solution :)

Moreover, changing the design to use your solution is not a big problem (you see? you only have to change a bunch of function and some function call). The only thign that is annoying is that you'll need to handle typing errors as well (Am I "gaesous"? no). This is already the case for skills - thus I had to define const strings to help the programmer (in fact, there is already a log of string-based stuff in the source code: races have names, as well as inventory objects, creature behaviors, and so on).

I like the idea of a cheese-made goblin [smile]

Anyway, thanks again!

Share this comment


Link to comment
No problem. I'm designing a backend MMO system myself that eventually have a client associated and the thought of having to open the code just to add a race gives me the willies. So I have made everything similiar to races completely scriptable or controlled by database entries!

Good luck in your endevour

Share this comment


Link to comment

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

  • Advertisement