Hi,
I suppose adding a Nav mesh and the “AI Move to” node on a AI controller would do the trick? I’ve not tried anything like it tho, but it is the first thing that came to mind.
Hi,
I suppose adding a Nav mesh and the “AI Move to” node on a AI controller would do the trick? I’ve not tried anything like it tho, but it is the first thing that came to mind.
Hey people, I am creating a game with similar mechanics to say monopoly in unreal engine, where you click a button to roll a dice for your character to move around the board… I am just wondering what would be the most efficient method for doing this?
I am thinking about using AI Pawns and having set locations for each square for them to move to depending on the dice roll variable, current position and target position variables etc. But It is not the variables I am worried about it is the method, should I be using AI Pawns with a nav mesh or should I be using a player character somehow? Also what sort of Player Controller do I need to use? The camera is top down… I wont be using any movement on the keyboard to control the character just inputs from widget buttons. But the character will be animated when it moves from square to square.
(To note I am somewhat experienced in the basics of blueprinting, variables, nodes, blend spaces and animation. This to me just seems more complicated than having a third person game or a first person game but I feel it should be easier… just not sure the best approach to this)
Any insight would be greatly appreciated.
Have your gamemode keep track of all of your player controllers.The player controllers themselves dont have to be anything special as long as they are a child of the player controller class. All you have to do is make the controllers “possess” the corresponding pawn that it will be controlling. As for the AI movement, yeah a nav mesh in combination with the board movement locations would work(like every section of the monopoly path is an object and you can get it’s location). You’d store those in an array, then the AI could use the navmesh to go to the spot its suppose to since it has its location. If you want it to follow a specific path there, then you could just have the AI move to each location from where it’s at, to where it’s going, instead of heading straight to the final destination.
Thanks for your response, i made a blank actor for each tile and player containing a struct for information of the location and variables for that specific tile etc. It is working, I have got the character walking from one tile to another depending on the first dice roll 1-6 not sure how to progress for the second dice roll, how would I tell the engine that if on tile 4 and roll another 1-6 movement (eg. rolls a 4) to advance to tile 8? Is there some sort of variable I will have to store this in? I know its just some form on maths I will have to work out but not sure what variable or nosed to use. lol.
You could do it using a vector array and integer. For example, you have 20 tiles, every tile is 100x100, and the position of the start tile is 0x0xZ. You could create an array which has at index zero vector 50x50xZ (middle point of the first tile), then 150x50xZ at index 1, 250x50xZ at index 2 etc. The current tile your pawn is standing on is stored in an integer (called “CurrentPawnTile” in this example). The start tile position is 50x50xZ, and the corresponding CurrentPawnTile is 0. If you roll 5, you could increment your CurrentPawnTile with 5. Your CurrentPawnTile is now 5, so now you get the 5th index from the vector array which you made earlier, which would be 550x50xZ in this case. You can then move the pawn to that location.
Tip, if your board goes around a corner, you could make the pawn move one tile at a time. So if you are at tile 6 and you roll 4, make sure the pawn goes to tile 7, then tile 8, then tile 9 then tile 10, instead of directly going to tile ten. This could make the pawn cut corners.