Monday, 25 April 2011

Lesson learnt: Fate of world sealed. plus some AI concept.

Things progressing further: HistoricalEvents stored after won or lost or left battles; more refined decisions can be programmed for Humanoids (of type HumanoidEntityDescription) when they think about choice for encounter (choice: Hide, Attack, Indifference, Encounter (exchange info, commerce)) based on their Behavior patterns, and when they think about how to interpret a relationship level with another group of beings (e.g. based on their Behavior they can be forgetful, raising the relationship level a bit higher) -- these will have a huge impact on the AI vs/pro AI/Player happenings later. Now for test purposes the humanoid races are all quite nasty, attacking each other almost always, downgrading relationships and thus giving more aggressive battles turn after turn, railing down the entity groups around their hometown... Of coures this will receive more care and folks that are peaceful are always going to try to negotiate neutralization, commerce and info exchange with friends etc.

Now to the lesson learned: I had to root out all the HashMap.keySet() or values() method calls for iterating lists of those maps and replace HashMaps with TreeMaps in the encounter/ecology part. Otherwise a random order crawled into the happenings of the historical test application run. EncounterInfo was the culprit, full of HashMaps featuring EncounterUnit as the key, now I use TreeMap instead, and EncounterUnit implementer classes implement the Comparable class as well.

...And randomness was replaced with the Hash based quasi-randomness, and thus the fate of jClassicRPG test worlds had been sealed and unchangeably progressing the same route test run after test run with the same TreeMaps to Eternity. ;P

No comments: