I was thinking of that same sub grid idea, I was actually spending some time with it yesterday. I basically started writing a new class that holds the same kind of information and has a parent connection to the main grid that does the xy correspondence. Hah I’m not sure why at first I thought it would be as simple has having two grid managers that the pawn can switch between but the idea I was working on last night seems to be working a bit better. I’m still tying to wrap my head moving between them, right now I have a manager and subgrid that exist without clashing, but working on moving between them is messing with me a bit.
Thanks for the quick reply! Hah sorry if I made it sound simple, Its one of the problems I suffer at work.
Ok, so we’re thinking along similar lines. There are of course other ways to do this as well. The most obvious one is to make the grid three dimensional, but that will increase the size of the arrays much more than is probably necessary, and if you check each 26 possible directions each search step of the pathfinding it will slow down to a third. When you say you have a subgrid that exists without clashing do you mean that it works perfectly and independend of the main Grid Manager? You’ve got pawns moving on it and all that jazz?
Thanks for the in-depth step-by-step instructions, that really helped me out. I got it working by following the above steps; it seems like step 5 is what did it for me.
Looking forward to the upcoming updates! Thanks for the help!
Great to hear it worked! The update is pretty much done now. Just need a couple of more days for playtesting and polish. Feel free to post again if you’re stuck or need help with something.
btw, i think its awesome that you still work on improvements and updates.
although i kind of shiver thinking about moving all my changes and add-ons to the updated version …
Very helpful toolkit, , and you are doing a stellar job responding to user questions here. Thank you!
I poked around your Youtube profile in the course of watching the tutorial videos, and it appears you’re excited by the recent developments in consumer virtual reality? It might interest you to know that I and some co-developers are hoping to use your toolkit in a long-form VR game jam! We’ll definitely share some progress when/if we manage to make it through the milestones, and hopefully we’ll do your toolkit justice.
I do have a few questions. Please note that I am still a bit of a UE4 noob, but other members of my team should be able to understand highly technical answers if I can’t. I apologize for any misconceptions I may bring into these questions, but please don’t bother spending too much time trying to tutor me on UE4 basics. The scope of a couple of these might also be daunting, so feel free to be very brief in your replies.
Scaling. I can drag the GridManager into a separate project like the Realistic Rendering demo, but the collision plane and several other elements refuse to scale along with the grid. (Images: 12) Faking this by scaling up the room isn’t an option for us, either. Is there something I’m missing, or perhaps some simple way to get the entire functionality of the toolkit arbitrarily scaling in a new project?
Distance Moved. As in Battletech, our plan is to include to-hit modifiers based partially around movement, i.e., if your target ran around a bunch last turn, and you’re running around a bunch this turn, it’s going to be VERY hard for you to shoot him. In the course of implementing a rudimentary stat system and randomized hit/miss system (which was remarkably simple) I tried to use CurrentSplineDistance for this, but it was returning unhelpful (i.e., occasionally negative) results. Is there some pre-existing way to get the distance (in tiles or meters) a pawn moved recently? If not, do you have any suggestions for where to start when implementing this?
Multiple Floors. What would be the best way to implement multi-floor maps (with the caveat that we can’t really use separate levels for this due to the requirements of our game)? A separate GridManager for each floor, and figuring out some way to pass pawn data between them, or is there an easier way?
Per-Team Turns. I’ve never loved the individual initiative feature common to tactics games, and I would like to explore something more like a Space Hulk approach where you issue commands to your entire team as your “turn”. I can start to envision the kind of buffer this would seem to require - some kind of array of decisions that fills up and can be modified until you push a big “GO” button, at which point each pawn’s action is sequentially fed into the existing systems - but I don’t see a great way to construct this without doing an unpleasant amount of work. Is that what this feature would require?
Synchronous Resolution. I’ve also never loved the “stand there while I shoot at you because it’s my turn and not yours” approach inherent to turn-based games, and I would greatly prefer something like Frozen Synapse where everyone gets orders for a turn and then everyone attempts to follow those orders simultaneously. My co-developer Mitch said this would be a “ridiculous” amount of work, but he was mostly worried about the AI necessary to make it happen. I’m no expert, but in my mind, the AI tree of “try to shoot that guy, but if he ducks behind a wall or something, you effectively lose the rest of your turn” seems fairly straightforward. What’s your assessment?
Multiplayer. Are you able to give a ballpark guess as to when you might have multiplayer working? We’ve struggled mightily with network replication over the past few months, so I understand your hesitation to dive into that quagmire. I highly doubt we will have the time before the jam deadline in May to do this ourselves (if we even could), but we’d love to have a head-to-head mode for our submission. If that’s not realistic, knowing it’s coming some time this year would open up a nice DLC option for us. Any idea when multiplayer might happen?
That looks incredibly good, Gaara! It’s fantastic to see the toolkit used with proper visuals, and I love the modifications you’ve done. Some of these I was planning to add at a later point, such as displaying enemy visibility on hover, attacking from flanking etc., and it’s comforting to see that you’ve got it working so well. Did you find the toolkit easy to work with? Are there any recommendations you have for improving usability and commenting?
As for my next update, it will be a pretty big overhaul, but the core system is mostly the same. Converting your additions should hopefully not be too hard, and if you’re running into any particular issues you can always ask me in this thread, and I’ll try to respond quickly.
Thanks! I’m just happy to see people using something I’ve made, and solving people’s problems is both enjoyable and will help me improve the toolkit in the future.
Indeed I am. What tipped you off? I own both Oculus developer kits and I’m using virtual reality in my day-job as a cognitive neuroscientist. My own game development plan is also to develop a turn based strategy game for virtual reality, so I’m excited to see what you accomplish. One word of warning, though: The pathfinding and visibility generation in my system is fast, and are done in less than a frame for paths of moderate length. For very long paths or when running on weaker hardware the pathfinding might however take more than one frame. This almost isn’t noticeable for most games, but for VR keeping a constant framerate is essential and it might potentially pose a problem. I haven’t tested it out myself, but it’s a suspicion. To combat this I will in two updates be including an optional macro for calculating paths over multiple ticks. It might not be an issue at all depending on the move values of your troops, but I thought you should have a heads up.
To be fair I consider myself a noob in many areas of UE4 as well. It’s less than a year since I was only able to print “hello world”, but I am of course pretty knowledgeable about the specifics of my toolkit.
How are you scaling the grid? You should not scale it by using the regular scale widget. Instead scale it by using larger meshes as the default tile mesh and increasing Grid Size X and Grid Size Y. Is this what you’re doing?
Current SplineDistance tells where the current pawn is located on its movement spine during movement. I have not intended for it to be called outside of movement, so I’m not surprised it yields confusing results. I would instead use the length of the Path Index Array. The Path Index Array (I might have changed the name since, but it’s something like that) stores all the indexes on the grid that a pawn will move during its movement. I think the best way to do what you’re describing is to create a new integer variable on Unit_Parent called LastMove or something and at the beginning of a unit’s movement set LastMove of Current Pawn to PathIndexArray.length (set it to 0 if the unit does not move this turn). Then when attacking calculate to hit chance modified by the LastMove values of the attacker and the defender.
This one is tricky. If you read some of the previous posts on this page you can see some of the problems associated with implementing multiple floors. This is actually pretty tricky to do, and I have not found the ideal solution yet, though I do plan to add this in a later update. Expect that to take a while, though. You can of course use height maps, rooftops etc., but there can be no overlapping, walkable tiles directly above/below each other at the moment.
This requires a bit of tinkering, but there are certainly ways you can do this. You would use the toolkit as usual, but would have to create individual path splines for each unit. When you click to move somewhere you would not animate the unit or move it along the spline, but would update arrays in the same ways as in the begin- and end movement parts of the blueprint. Then when you press go you would move all pawns at once, modifying the move pawn section of the Grid Manager to accommodate multiple units. This will probably be easier come my next update, where movement is handled within each unit’s individual blueprint.
This is a bit tricky, but not impossible. The difficulty would depend on how you do it. If the AI should be able to decide what to do every step of its movement it’s harder than if it moves to a point and then decides what it can shoot, similar to how it is now. The most important thing to be aware of is to design things so that all visibility traces are done before it is needed, and not simultaneously, as multiple units checking visibility at once would surely drop the framerate.
This one is a bit hard for me to estimate. Like I’ve mentioned I’m still a complete beginner when it comes to many aspects of UE4. Multiplayer is one of these aspects, so any guess to how much time it will take will be rather poorly founded. I can say that I intend to look at multiplayer after I’ve implemented touch controls, multi-level grids and a couple of game examples. What this means is that I almost certainly won’t be done with multiplayer before your deadline. Hot-seat is a lot easier, but I guess you don’t want people switching their headgear every minute
Networking would imho be very difficult to do in a “one size fits most” approach.
The slower your game the more lenient it is on latency and the more options open up to you. ex: for a truly turn based game simple http/json communication can be a very robust way to manage multiplayer.
But for a battle system thats quicker or maybe incorporates some ATB style elements you need some kind of UDP object system.
Si, though its a bit wonky I can switch a pawn from one grid to the other, still only having 1 grid manager and my sub grid. The path finding works in the sense that whatever grid its on currently it can path to, so you cant switch between them by moving, I had to add a button which basically teleported the pawn between the 3 i had set up. But this of-course doesn’t really work when you take other things into consideration, like AI pathing and attacking, so my current implementation literally only has pawn movement on the sub grid. I imagine getting the rest working maaay be a bit rough. Anyway I’ll link you to the sub grid blueprint and the functionality I made to allow the user to switch between using the main grid and sub grid when I get home from work! Hopefully it will help the brainstorm a bit more.
Hi Monokell really great toolkit! Thanks a lot for all of your work!
Unfortunately I’m running into a problem with box triggers on pawn overlap. The blueprint doesn’t seem to recognize the pawn (Unit_player_melee) overlapping the trigger box. Overlapping doesn’t even display a string! Maybe you could help with this?
Edit: I’m having another problem with the same setup. There is a door which rotates as soon as a pawn overlaps the triggerbox (–> enable input) and a button is pressed. For now I forced Input by setting ‘AutoReceiveInput’ to player0 (to skip the problem explained on top). As soon as I press the button the door rotates, but disabeling collision (what worked in projects without the toolkit) didn’t let the pawn pass through the door. I tried changing the edge costs (set edge costs to all 0 for closed and all 1 for opened) via blueprint but this doesn’t work (doesn’t seem to update the edge costs at all). Changing the edge costs of the door manually to all 1 enables my pawn to pass. Any help would be appreciated!
Edit2: All of these are in the blueprint of the door. The blueprint is a duplicate of a square thin wall blueprint (from the toolkit) where the wall asset is changed for a door (from startercontent) and a collision box (as box trigger) was added. Also the map is on a hex grid but I don’t think that should matter since the pawn can walk through the door as soon as edge costs are manually set to 1.
Ok, that’s useful to know. For the toolkit I will be building it to work as a true turn based game out of the box, so if this is relatively simple to achieve, this is what I’ll aim for.
Great to hear you’ve got that much working already. I’d appreciate if you share the blueprint with me and we can hopefully figure something out together. With your help I might be able to get this feature done a lot quicker than I anticipated
Hi Hinato, if you’re using the default pawns that’s really not that surprising as they have no collision and generate no overlap events. To change this modify the blueprints of the pawns you are using and enable collision as appropriate on their skeletal meshes. Hopefully this will solve your problem.
There might be many reasons for this happening, but here is one suspicion: When the pathfinding has been run modifying walkability does nothing until you run pathfinding again. In other words modifications to edge costs has to be done before you run the pathfinding function.
Edit: I looked again at your screenshot and found the reason. Modifying edge costs on a tile does nothing after the game has started. The edge cost variables on tiles are put into arrays at event begin play and afterwards they are never called. To change the edge costs of the door at runtime you have to get the EdgeCosts array from the Grid Manager, get the struct at the array index that equals the index variable and set that struct to whatever new values you want. Check out the Add Viewport Terrain To Arrays function for examples of how to do this.
That isn’t too surprising as the version currently on the marketplace uses the default player controller which does not show the mouse cursor. Making a new player controller with show cursor set to true should hopefully fix your problem.
Thanks a ton!
Easily solved the first problem, for the third one: I already had a player controller with show mouse cursor enabled. I just forgot to enable mouse over events XD
The problem with the edge costs might take some time since I’m relatively new to UE4 but I think I get what you mean
Edit: Unfortunately no more time today… Still trying to change the edge cost but that’ll have to wait 'til tomorrow
This looked most promising thus far but something still doesn’t work how I think it would…
You’re on the right track, Hinato The only problem I can see here is that you’ve incorrectly referenced the Grid Manager. Instead of casting to BP_Grid_Manager cast to ATBTT_PlayerController and from the output node of the cast get a reference to the GridManagerRef variable. From this variable get the edge array and proceed like you’ve done. Remenber to be finished with all alterations to the edge array before you run the pathfinding.
Hi Monnokel, fantastic job with this blueprint. Just had a question - probably more in the future, but with the way this is set up I haven’t had too much trouble implementing what I need to. I am trying to change the Inititative/current pawn features up some, so I can have a time where the player isn’t actually controlling any pawns. At the start of their turn, they would not have any pawns selected (I assume this would require Current Pawn variable to be null) and they could either select one of their pawns, or perhaps click on a space with an object or an enemy pawn to view more details, but not actually take control of a pawn unless they click on one of their own. Any tips on how I might start this out?
Along with that, I plan on my final product being a “simultaneous” turn based game (similar to Civ V) where any AI would perform their actions right away, but the player and any other people they are playing with (multiplayer) would take their turn, press end turn, and the game would wait for all player’s end turn vars to be set to true. Obviously any multiplayer feature is very far off for both of us at the moment, but do you see this being a possibility with a modified version of this toolkit?
Much thanks!
Hello Sreno1 and thank you! What you have been requesting has been requested a few times before, and I’m planning to include it when I start making my example maps. I actually probably won’t bother making CurrentPawn blank. I would keep a current pawn just like now, but just refrain from running pathfinding, placing the current pawn marker or auto-panning to the current pawn until a pawn is clicked. As far as the player is concerned that will be identical to not having a pawn selected.
As for different players deciding actions i parallel and activating them simultaneously, I believe it is certainly possible, but will take quite a bit of work. You will at the very least have to modify the system so that you can have multiple pathfinding arrays at once so players don’t keep overwriting one another. I would only try tackling this problem when you really feel you have mastered and understand everything in the toolkit.
Awesome, sounds like you have some sweet features in the works. When you update any features, how will those updates behave with projects already using the toolkit? For example, you mentioned splitting up the toolkit into multiple blueprints (if I understood correctly) - in order to take advantage of these updates would we have to re-create and re-modify what has already been edited? Not only as far as the modular blueprints go, but any update for that matter - how will they affect projects in general? Just out of pure curiosity, because I’ve never worked with an in-progress external source like this before.
Actually I’ve just finished completing the new update a few minutes ago, so in the unlikely event that Epic is quick with adding the update you’ll know firsthand very soon. In principle, migrating a new version of the toolkit to a project running an older version will override everything, so you would have to keep a copy of the old project and copy over any new code you’ve made as necessary. Even though this is also true for a modular setup, having it modular means I can specify what parts of the toolkit have been changed in an update, and you can safely replace any other blueprints with your own modified versions. This will not be true for this update of corse, as it is the most radical change to the toolkit I’m likely to make.
I can’t cast to ATBTT_PlayerController. Only to ‘PlayerController’ (with an Object Input) and when I drag from that output note I can get a referance to the GridManagerRef but these won’t be connected. Same goes for the edge array from the GridManagerRef.
Are we talking about the same version of ATBTT?
Also congrats on finishing the update! Looking foreward to that!
Would it be better to pause with that until the update is released because I’d have to redo it anyways?
Ah, you’re right of course. My suggestion is only possible in the new version. Instead you should do something that works in both versions. Make a variable of the type Grid_Manager_Class and set its default value to Grid_Manager. Put it in your event graph, drag out its pin and get all actors of class. From the array you then get, get element 0 and cast it to Grid_Manager. For an example see the constriction script of Tile_parent.
If I knew Unreal was to upload the new version in a couple of days I guess it would make sense to wait, but since they still haven’t uploaded the version I sent them two weeks ago I wouldn’t hold my breath. Converting your additions shouldn’t take too long in any case. I recommend putting a new, unused variable get at all places you make changes so you can easily find them again by searching for the variable.
Thanks! The door is now working as planned
Sucks that Unreal’s taking so long for uploading finished updates… Hopefully they get stuff done soon
I just noticed that enemy pawns won’t attack anymore. Maybe that is because I changed collision of the player pawns but not
the enemy pawns… Gonna look into that right now