D
DukeMeister
Guest
Hi all. I'm wondering if there's way to have a character automatically navigate a fixed map (e.g. like a normal house, with about 60 interconnected rooms) without using the built-in pathfinding? So, knowing just which rooms adjoin other rooms, is there a simple way of doing this in GML? Thanks.
edit:
Just to clarify, I don't need the characters to visibly move on the map, in real time. Just to be able to work out 'what is the (minimum) list of rooms to get from room 11 to room 27, say?' e.g. "12, 15, 16, 21, 27"
It seems clear I'd need to create a data structure that describes for each room, each exit and to which room it leads. Although a bit of drudge work I can do this, and have started on that. In theory that's all you'd need, but how the algorithm would look in GML, I'm not sure.
update:
So I'm thinking something like this, which I've got partially working:
Basically work backwards from the destination room.
For each exit from that room
edit:
Just to clarify, I don't need the characters to visibly move on the map, in real time. Just to be able to work out 'what is the (minimum) list of rooms to get from room 11 to room 27, say?' e.g. "12, 15, 16, 21, 27"
It seems clear I'd need to create a data structure that describes for each room, each exit and to which room it leads. Although a bit of drudge work I can do this, and have started on that. In theory that's all you'd need, but how the algorithm would look in GML, I'm not sure.
update:
So I'm thinking something like this, which I've got partially working:
Basically work backwards from the destination room.
For each exit from that room
Visit the room it exits to, except:
OR
The only exit is back to the previous room (bad path)
OR
Number of rooms visited is > the shortest path already found
Something like that anyway. This definitely seems to beg for a recursive solution, but initially I might just do it procedurally. The hard part is to just keep track of everything.- Ignore rooms that have already been visited
- Ignore the exit back to the previous room
etc.
Continue until the Origin room is encountered
OR
The only exit is back to the previous room (bad path)
OR
Number of rooms visited is > the shortest path already found
Last edited by a moderator: