I'm (very) slowly starting up an AI project that will require controlling the movement of multiple monsters.
I'll need two things:
1. The Map.
I'll need a model of the relevant part of the game map in my Lua code. Initially it will be just the 2-D surface. Later I'll probably want 3-D (underground levels), but I don't need to start there.
Storing the data is a question of scale rather than difficulty, so that's not currently an issue. Getting it efficiently in the first place might be a challenge though.
I can probably get it via manual input, or perhaps pull it from a map editor or a map definition file. In either case it's a fair amount of work, and more importantly, locked to a single map implementation.
I'd much prefer to get it dynamically via Lua API calls - assuming they exist. What I have in mind is to start by defining a large rectangle (effectively the tile coordinates of the four corners), step through them, and load my in-program simplified and limited version of the game map by querying tile properties.
This would only be necessary when the game is started or reloaded, so performance shouldn't matter. And once coded (or appropriated if it's already been done it could be adapted quickly to different maps.
So the map question is: is it possible for me to query a lot of tiles by stepping through their coordinates (or something similar) so I can make a private version? And if so,
The logic for constrained pathing is fairly complicated. I definitely don't want to do it myself - especially because there's probably something in the C++ game engine already.
Assuming there's good pathing logic in place, can I use it to get information about the path it would use to move between two different tiles? Note that I'll be controlling multiple creatures simultaneously, and sometimes they'll be fairly close together. Some of the pathing decisions (like on a large flat space with no obstacles) won't be hard, but where there are obstacles and other creatures it won't be so easy.
I think interacting with an existing pathing component would save me a lot of effort: I'll know where I want my controlled monster's new "waypoint" to be, but I'd rather not work out myself. e.g. I'll need to know:
So the navigation question: is there a "pathing engine" in OT already, and if so:
I'll need two things:
- My logic will need some understanding of a section of the map - possibly a large section. Certainly hundreds of tiles, perhaps a few thousand
- I'll be updating my navigation instructions to controlled creatures moderately frequently (perhaps once every 5 or 10 ticks) even if the creature doesn't interact with anything. I'd prefer to be able to send each creature to an intermediate location (a waypoint), then make a new plan when it gets there - unless one of them meets e.g. a player.
1. The Map.
I'll need a model of the relevant part of the game map in my Lua code. Initially it will be just the 2-D surface. Later I'll probably want 3-D (underground levels), but I don't need to start there.
Storing the data is a question of scale rather than difficulty, so that's not currently an issue. Getting it efficiently in the first place might be a challenge though.
I can probably get it via manual input, or perhaps pull it from a map editor or a map definition file. In either case it's a fair amount of work, and more importantly, locked to a single map implementation.
I'd much prefer to get it dynamically via Lua API calls - assuming they exist. What I have in mind is to start by defining a large rectangle (effectively the tile coordinates of the four corners), step through them, and load my in-program simplified and limited version of the game map by querying tile properties.
This would only be necessary when the game is started or reloaded, so performance shouldn't matter. And once coded (or appropriated if it's already been done it could be adapted quickly to different maps.
So the map question is: is it possible for me to query a lot of tiles by stepping through their coordinates (or something similar) so I can make a private version? And if so,
- What's the Lua call to see a tile's properties (including e.g. if there's something standing on it, like a monster)?
- Where can I see a list of all the possible properties? Preferably one that's easy to understand - the XML files generally seem to be easier that the LUA tables.
The logic for constrained pathing is fairly complicated. I definitely don't want to do it myself - especially because there's probably something in the C++ game engine already.
Assuming there's good pathing logic in place, can I use it to get information about the path it would use to move between two different tiles? Note that I'll be controlling multiple creatures simultaneously, and sometimes they'll be fairly close together. Some of the pathing decisions (like on a large flat space with no obstacles) won't be hard, but where there are obstacles and other creatures it won't be so easy.
I think interacting with an existing pathing component would save me a lot of effort: I'll know where I want my controlled monster's new "waypoint" to be, but I'd rather not work out myself. e.g. I'll need to know:
- Can it get to the target location from where it is now?
- Will it need to take a roundabout route (e.g. due to obstacles)?
- ... and maybe more stuff - but those would be a good start.
So the navigation question: is there a "pathing engine" in OT already, and if so:
- Can I interact with it?
- If I can. how?