Cuberite Forum
New AI for Mobs - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: New AI for Mobs (/thread-820.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


RE: New AI for Mobs - Taugeshtu - 12-22-2013

I vote up components system notion! Because reasons.

Reasons: I'd like to have more control over server configuration than with vanilla. For example, I'd love to have an option to make zombies use spiders (or rather cave spiders) movement strategy, so they could "storm" castles with high walls. Or, should I so desire, make skeletons which aren't shooting, just running at player and hitting him.

The way I can see it done is following:
Instead of making a bunch of classes for each mob (which I consider rather stupid on its own), we make generalized "mob" class. Then we make a bunch of "behaviour" classes, derived from some basic behaviour, which should have plenty of virtual methods such as "upon tick", "upon spawn", "upon death". Then we add a configuration file, one for server/world (latter would be awesome), which would be something like:

Code:
[Spider] ; meaning we're setting up parameters for a mob, which would be spawned using spider spawn egg, spider spawner or whenever server feels like spawning a spider, and will have a spider model
Movement=Zombie
Attack=Creeper
Ageable=0
EggSpawnable=1
SpawnerSpawnable=1
Burns=0
Hostility=Spider
Tamable=0

[ZombieHorse]
Movement=Horse
Attack=Horse
EggSpawnable=0
SpawnerSpawnable=0
Burns=0
Hostility=Horse
Tamable=apple

Now, Movement is pretty obvoiusly a movement strategy and so on, Burns declare whether or not mob will burn in daylight, and Tamable is either zero or item type used to tame it. This moment needs a bit of thinking through because of horse taming process. Also, I forgot food for health restore.

Anyway, point being: I wish to have a tool to change mobs behaviours and I want goddamn skeleton horse!


RE: New AI for Mobs - tonibm19 - 12-22-2013

This would be awesome. Imagine a tamable creeper... Smile


RE: New AI for Mobs - NiLSPACE - 12-22-2013

Maybe not making it configureable in a config file but editable using a plugin?


RE: New AI for Mobs - xoft - 12-22-2013

I'm beginning to like this component idea more and more. I only fear that rewriting into such system would take a lot of time and the AI would never get finished that way. We're already moving forward quite fast and merging the AI changes to master will be a challenge.


RE: New AI for Mobs - SamJBarney - 12-23-2013

Well, I'm willing to make the changes, but only if someone is willing to help out with it. How about we open a new branch on the main repo after FINALIZING how we want AI to work? Once we finalize it, then lets get it done before we make any more changes.


RE: New AI for Mobs - xoft - 12-23-2013

Is your A* pathfinder in any state good for merging? It'd be a shame to throw it out completely.


RE: New AI for Mobs - SamJBarney - 12-23-2013

While I do think that configurability is a good idea, having too much of it can increase complexity and hurt performance.


RE: New AI for Mobs - xoft - 12-23-2013

Exactly. Although the idea of spider-zombies intrigues meBig Grin
In this case the configurability actually comes with almost zero costs in both complexity and performance.


RE: New AI for Mobs - SamJBarney - 12-23-2013

If we're going to redo the AI again to please the masses, then I will have to rewrite it anyways. So I don't think we should bother merging it in. I'll keep it around, though. That way if we can reuse some of it we can just drag and drop it over.

Besides, I want to try reimplementing it the way you mentioned earlier, xoft.

Also, if we're going to go the route that everyone is asking, I might as well move it into its own class.

I actually like the idea of making it into a component system for one main reason:

It would make it rather simple to allow plugins to add their own AI behavior.

This would also allow us to develop both the simple Minecraft AI and the Advanced AI that I have been thinking about. This way servers can pick and choose which parts they like best.

Or, if they really want it, the way mobs act can be selected at random.


RE: New AI for Mobs - xoft - 12-23-2013

I see you got into the spirit.
I've always thought that you're encapsulating the pathfinding into a separate class, somewhat like the cLineBlockTracer (only way more complicated Smile )