Author Topic: Randomized monsters and XML  (Read 20853 times)

Seby

  • Newcomer
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Randomized monsters and XML
« on: January 24, 2008, 09:32:53 AM »
Hi,
I'm looking for a way to implement "semi-random" monsters without hard-coding them.
XML seems to be a good choice, so I come with such a structure:
Code: [Select]
<monsters>
 <monster>
  <guard1>
   <stats str="8"(...)/>
   <inventory>
    <equip>
     <pants id="GUARD_PANTS"/>
     <top id="GUARD_JACKET"/>
     <weapon id="GUN45"/>
    </equip>
    </money min="0" max="100">
    <items>
     <item id="MAG45" prob="0.5"/>
     <choice_items>
      <item id="CANDY_BAR1" prob="0.25"/>
      <item id="BIER" prob="0.25"/>
     </choice_items>
    </items>
   </inventory>
  </guard1>
 </monster>
</monsters>
Meaning all these guards have standard equipment, can have from 0 to 100 dollars, 50% chance having ammunitions for his .45 and 50% chance having a candy bar (25%) or a bier (25%).
This choice should be extended to all the fields that have to be randomized (stats, appearance, equipment...).
Would it be a good idea to proceed so? Could you see any limitation with these structure of data ?

stu

  • Rogueliker
  • ***
  • Posts: 138
  • Karma: +0/-0
  • Moop!
    • View Profile
    • Stu's Rusty Bucket
Re: Randomized monsters and XML
« Reply #1 on: January 24, 2008, 07:18:00 PM »
the only problem I see is that its xml :) I dont like xml at all. its a language fart.
--/\-[ Stu ]-/\--

Seby

  • Newcomer
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Randomized monsters and XML
« Reply #2 on: January 25, 2008, 07:12:08 AM »
;) I think XML is quite easy to read and there are lots of parsers for each programming language so I won't have to write mine (and I really hate writing parsers!).
But the best would be to write items/monsters/skills editors, so the XML-files would be easier to generate/maintain.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Randomized monsters and XML
« Reply #3 on: January 25, 2008, 09:41:45 AM »
I would make separate generic item lists and then point to them based on enemy type. For example skeleton warrior could pick a random weapon from generic swords list etc.

Gamer_2k4

  • Rogueliker
  • ***
  • Posts: 86
  • Karma: +0/-0
    • View Profile
Re: Randomized monsters and XML
« Reply #4 on: January 25, 2008, 06:04:43 PM »
I have StartingInventory objects that hold a list of objects for each location of the body.  When a monster is given that particular starting inventory, they pick one random item from each list.  This way you can have goblins with crude clubs or spears, but they won't ever have heavy lances.
Gamer_2k4