AI in Lua
#1
I'm starting a basic AI plugin. I thought I'd share my approach and see what you think.

First off, I'm using HOOK_WORLD_TICK to trigger activity.

I only fire off my routine if the last time I triggered was more than 250ms ago, and was for another world.

I then iterate through each entity in that world and check that it is a mob. If it is a mob and within 25 blocks of a player character in that world I store it and some parameters in a table.

I then house clean the table for entities that are out of range or no longer in the game.

I then loop through the table and make them do things.

a) get to safety (out of water, lava, sunlight, etc...)
b) move towards target player
c) move towards villager
d) attack target player or villager

This is just my starting list.

Here's the start of the project. It only has the part that stores the mobs right now.

https://github.com/planetx/AI
Reply
Thanks given by:


Messages In This Thread
AI in Lua - by wudles - 01-29-2015, 09:26 AM
RE: AI in Lua - by xoft - 01-29-2015, 04:35 PM
RE: AI in Lua - by wudles - 01-29-2015, 04:45 PM
RE: AI in Lua - by xoft - 01-29-2015, 04:48 PM
RE: AI in Lua - by tigerw - 01-30-2015, 08:27 AM
RE: AI in Lua - by wudles - 01-30-2015, 08:36 AM
RE: AI in Lua - by xoft - 01-30-2015, 08:48 AM
RE: AI in Lua - by wudles - 01-31-2015, 03:36 AM
RE: AI in Lua - by DiamondToaster - 02-02-2015, 05:10 AM
RE: AI in Lua - by wudles - 02-02-2015, 05:41 AM
RE: AI in Lua - by DiamondToaster - 02-02-2015, 06:01 AM
RE: AI in Lua - by jsebean - 06-18-2015, 06:35 AM
RE: AI in Lua - by warmist - 06-19-2015, 01:24 AM
RE: AI in Lua - by worktycho - 06-19-2015, 01:27 AM
RE: AI in Lua - by warmist - 06-19-2015, 01:58 AM
RE: AI in Lua - by worktycho - 06-19-2015, 03:18 AM
RE: AI in Lua - by SamJBarney - 06-19-2015, 03:30 AM
RE: AI in Lua - by warmist - 06-19-2015, 03:50 AM
RE: AI in Lua - by SamJBarney - 06-19-2015, 04:01 AM



Users browsing this thread: 1 Guest(s)