Behind “Evil” Craig
The major component of Caveman Craig 2 is the tribal warfare between your own tribe, and an enemy tribe on the other side of the terrain. And with no tribe complete without a leader, a lot of my time has been spent designing the artificial intelligence for the enemy tribe leader, or his working title, “Evil Craig”.
There’s a sort of trade off in complexity between Craig and other normal cavemen. While Craig is controlled by the player, he needs to be able to perform most of the tasks any other caveman can. On the other hand, hunters, gatherers, and preparers only need to perform a few tasks but need to be able to automate it. When I realised I had to combine both complexities with “Evil Craig” (automating what he needs to do, and doing a large number of tasks), I started to feel a little overwhelmed. But after a significant amount of planning, this is how Evil Craig does his thaing.
As with all cavemen, Evil Craig has a ‘status’ variable which determines what he is doing. These statuses range from ‘throwingrock’ to ‘struggleraptor’ (being ripped apart by our beloved velociraptor), but the most important is ‘normal’. The ‘normal’ status, in the case of AI, tells the cavemen to pick what they want to do based on countless conditions, and then walk towards the required location. Once they reach that location, the ‘normal’ status tells the caveman to change his status to whatever he needs to do, be it pickin’ berries or clubbin’ innocent dinosaurs. It’s a switchboard, or ‘main menu’, for the caveman’s AI, if you will. This is simple for say the Hunter, who’s job is to pick the most dangerous dinosaur and then run towards him, eventually clubbing him or standing afar and throwing rocks based on priority.
Unique to Evil Craig however is his ‘mode’. This tells Evil Craig what he should aim to do. If the mode can’t be performed (for example, if he wants to prepare some meat but there are no carcasses in the cave), the mode cycles until Evil Craig CAN fill the request. The mode is processed within the ‘normal’ status.
Once Evil Craig can fill the mode’s request, an alarm is in most cases set at random as an indicator of when he should move onto the next thing. Preparing a bush may take a very long time and we don’t want Evil Craig spending too much time on it.
What’s left then for Evil Craig is the more strategic, non-’hands on’ decisions. Namely, choosing what bonuses or cavemen to create, when to get them to follow him, and when to attack Craig’s tribe. This is handled by the “Tribe Director” object which is also responsible for spawning dinosaurs, vegetation, and controlling the weather.
Wow. That looks tough…
Good luck on that.
Also why is the dudes arm hanging down? Are you making beds or something for them?
Sounds totally awesome! But the thing is . . . will Evil Craig be able to train his own men?
He sure will!
That training thing gave me an idea! Splitscreen.
That would make the game ever more fun!
Also do we take over the enemy cavemen if we kill the evil Craig?
Looks great, thank you for the update.
“Evil Craig” eh? You should totally name him “Daniel”
Evil Craig looks nice, though I wouldn’t want him to be an expert military strategist like Sun Tzu.
If that happens, Craig’s a dead-caveman lol.