Wednesday 30 September 2015

Dumb or clever AI?

Rewriting item use routines. I've always had problems with these, because there are couple of ways to implement it. You can first of all do everything in Creature class and check player specific stuff by checking out if the Creature is the player. Then you can do the opposite and create routines for creatures and the player, or you can do any mix of these.

Checking out the player in Creature class is I guess considered to be bad style, but whatever gets the job done is good enough. If there are lots of special stuff for player then it could be easiest to create some kind of basic routines in Creature class and use them in player's class. Sometimes the "linear" flow of the program logic can make it somewhat pesky.

Another issue to think is how clever the artificial intelligence will be. If for example you make creatures eat food items it will change the gameplay a lot, because finding unused food becomes quite difficult and may even result to situation where all food items in the level are eaten before the player can even reach them. In this case the AI is too clever, but in theory you could fix this by creating another type of food distribution, possibly placing food items in more secure places like containers which can't be opened by simpler creatures like animals.

One good example of impossible "mirroring" of functions for creatures is the food clock. It simply doesn't work for creatures, because the player could in theory just wait for all enemies to die in hunger! Yet even this feature could be fixed by making simple monsters harvest their food from nature and give more clever monsters food items and/or possibility to fetch food from somewhere.

2 comments:

toastedorganism said...

You could make the AI cheat. Make the food clock start only upon contact with the player so that it only _looks_ as if the AI is fetching food all the time. You could go further and add a timer that determines how long the creature will be hunting for food :-)

Krice said...

I guess you could do something like that. But just make sure the player can't let's say circle step around the monster and wait it do die in hunger. Or maybe you could create ultra-realistic ecosystem to provide food for creatures who would also reproduce and.. maybe not.