Too bad that you’re having trouble adding new meshes. I’ll try to finish my videos for on this tonight, which will hopefully clear up any confusion.
: Well it’s supposed to to that in the sense that I have not scripted anything to avoid it from doing that. At the moment I’m afraid you can only move and resize the grid, but not rotate it. I have tried to add support for rotation, but it was difficult to achieve than I predicted. I want to add support for rotation, but I have several other features I want to add before that. Until then I hope you’re ok with modifying the rest of the world around the grid if you really need it to stand at a specific angle.
Just to update you, I was able to get the project running on my iphone. Of course, the interface is not functional. Digging in to that now. I assume you have the game mode and controllers in BP_Grid_Manager?
@J.J. Franzen: It’s great to hear that you got it running on iphone! I had hoped I had made it efficient enough that it would work, and it’s great to hear that it does. I’m still working on some major optimizations for weaker hardware before I officially declare mobile support, though.
There aren’t really a game mode or controllers per say, but almost everything is handled through the event graph of the BP_Grid_Manager, except for camera control in BP_Grid_Camera and some minor construction script functions in the unit and tile parent classes.
I’ve managed to replicate the error you made a screenshot of. It annoys me that I didn’t discover it myself. This happens for every odd tile on the western side of hex maps, and is a result of the pathfinding stopping when it has reached the edge of the grid, while the even rows should really continue the search one step more to the north west and south west. I have just implemented a new way of checking if the pathfinding has reached an edge, by marking all the edges as unwalkable in the edge array. This will get rid of this bug, and also make pathfinding slightly faster still. I’ll get the update sent to epic as soon as I’m able. Thank you for making me aware of this issue.
As for the people who have been asking me for help in importing their own meshes, I’m afraid I won’t be able to make a video about it tonight, but I’ll give a quick rundown below:
Adding your own tiles:
Import your own mesh as normal
Make sure it has collision if it is not a default grid mesh that shall only be used on the level of the collision plane
Create a child of the Tile_Parent blueprint or duplicate the tile closest to what you’re trying to make for less work.
Add your new mesh in the components of the tile. If it is a walkable tile, make sure “path trace” is set to “block” under collision. If the mesh should block visibility set “range trace” to “block”.
Parent the imported mesh to “CustomGridAnchor” to enable the possibility of custom grid snapping.
If you want to predictably block visibility in a similar way to the default walls you can add the static mesh SM_Wall as a component, set its collision to block “range trace” and make it invisible. Increase its size to 1.0001 to block sight past corners or 0.9999 to allow it. If you instead use the collision of your own mesh it will block visibility as determined by that specific collision
In the “Edge cost” local variable set the movement costs of entering various edges (north west means entering from the north west. Hex tiles do not make use of the east and west edges). 0 means the edge is impassable. 2 means movement to that tile costs 2 points of movement. - Edit: If the mesh will be instanced (if it is the default grid mesh, one of the “move to” or “in sight” meshes or has “instantiate” set to true) make sure the material it is using has “Used with Instanced Static Meshes” set to true in its material properties.
Adding your own pawns with the default UE4 skeleton:
Import your skeletal mesh. In import settings select HeroTPP_Skeleton as the skeleton.
If you want to use the default toolkit animation skip to the next part. If not, read on.
— Create a child of the Pawn_Anim_BP_Parent animation blueprint in animations.
— Import any custom animations you want to use
— for custom attack animations make sure to copy the PunchEnd animnotify from either the Attack_Ranged or Attack_Melee animations and place it at the point of your animation where the attack connects.
— for custom idle/walk/running create a copy of blend_space_melee in animations and replace with your own animations in your animation blueprint.
— for custom death animations you don’t have to do anything special
— in the graph tab of your new child animation blueprint select “Asset Override Editor” (under the preview) and replace the idle_walk_run, punch and death animations with yor own
Make a copy of any of the units under blueprints -> pawns. In the components replace the skeletal mesh with your own. Select your own custom animation blueprint as the anim_BP if you made one. If not use either Pawn_Anim_BP_Melee or Pawn_Anim_BP_Ranged.
Set up health, movement, range etc. in the local variables of the graph
You should be good to go!
I hope that’s enough to help anyone who might be having trouble using their own meshes. I’ll be making a video about this as soon as I have the time. By the way, for adding structures larger than a tile you do not have to split them up. Just drag the mesh into the world and place invisible walls where appropriate (located in blueprints->tiles->hex or square).
Thanks for the update , I’ve always been good at finding bugs. Quick question. I’m in the process just swapping in some of my own meshes and I’ve discovered something else. Are you forcing a material for the in move range mesh? Example:
The movement range should be a solid blue outline, similar to the solid green outline under the pawn. But for some reason, no matter what I set the In Move Range mesh’s material to, it always ends up being that transparent blue, M_Blue_Transparent. I’ve verified this by changing the color of that material, which is NOT assigned to my mesh, and the change I made showed up. If you are overriding the material for that mesh, could you perhaps make it an option to not do so? Unless it’s a bug, of course.
@J.J. Thanks for continuing reporting bugs It used to be that I used the same mesh for tiles in move range and sight range and switched its material at runtime depending on what was needed. I switched to using separate meshes later, but this bug is caused by a single node I forgot to delete. I’ll send a new update to Epic to fix this.
In the meantime, fixing it yourself is really easy. The offending node resides in the “Prepare for pathfinding” function. It’s the last node before the return node. Delete it and you should be able to use your own materials. However, make sure that whatever new material you’re using has “Used with Instanced Static Meshes” set to true in its material properties or i won’t render.
I will wait till you get the videos uploaded on adding custom pawns. I looked at the instructions but they are for the default UE4 skeleton. None of my custom assets utilize the UE4 skeleton.
So I’ve sent a new version with quite a few bug fixes and some new features to Epic. It will hopefully be on the marketplace soon. I’ve made the following changes:
Added an option for changing between player pawns when clicking on them. Only works for pawns that have not acted yet this turn.
Added some more variables that are useful for adding gameplay features. These include an “has acted this turn” variable for pawns and a turn counter in the grid manager.
Fixed a bug where tiles in move range would always be transparent blue, regardless of the mesh used.
Simplified the pathfinding by removing checking for edges and instead populating the edge nodes with unwalkable nodes at grid generation. This is easier to read, speeds up the pathfinding slightly and fixes a bug that created suboptimal paths to tiles on edges for hex grids.
Fixed a bug that caused auto generation of walkability based on height to fail if the grid manager was not placed at0 on the Z-axis.
Various minor fixes.
Great! I wish you luck
I’ve just uploaded a video showing how to add your own custom meshes. However I do not show how to add skeletal meshes that do not use the default UE4 skeleton. I apologize for this, but I’m actually unsure if I have found the best way to do this yet, and am reluctant to make a video about it before I have made sure there is not an easier way. Currently you have to make a new animation script and copy over all blueprint nodes and anim-graphs from Anim_BP_parent. Then you have to change all references to the animation blueprint in the grid manager event graph. I’ll explore optional ways of doing this in the coming days, and will make a video as soon as I’ve landed on a solution.
In any case I’ve posted the new tutorial video below. I hope you will still find it useful:
I’ve finally bought your solution and I have to say that “the source” is very well commented, even if it is not pretty simple to understand everything in a short time (but this depends on the complexity of the system and of course it’s not your fault)
Anyway, I’m currently finding a way to implement a very simple system of hit/miss situation.
Let’s say that when ranged unit attacks it can miss the target with 50% probability.
How should I modify the blueprint in order to achieve this? I’ve seen something about the projectile Logic: should I insert the hit/miss logic before projectile starts in order to “simulate” a miss also?
Also, I have one important question that maybe can help other developers: it is possibile to have separate blueprints that communicates with your massive one? Can they implement a custom logic that affects the main blueprint logic without modifying it?
This because if you continuously update the main blueprint (of course I appreciate that you introduce new features :P) I will lose every customization after every update.
thank you for the kind words. I’ve tried to make it as intuitive as possible, but some of this stuff is by nature pretty complicated. For understaning the pathfinding better I would recommend reading Amit’s great explanation. I’m using something similar to Dijkstra’s Algorithm for the toolkit.
It is certainly possible to create separate blueprints that communicate with the Grid Manager, and doing this is a good way to prevent my updates from overriding your own solutions. The easiest way to do this is through the level blueprint. Here is a very simple example level blueprint that finds and display all visible tiles in a range of 5 from the node under the cursor when the player presser “G”:
As for creating an accuracy system, the way I would do it is create an accuracy public float variable for the Unit_Parent class (0 being 0% change to hit, 1 being 100%). Then, when I want to check if an attack is a hit, I would get a random float and compare it to the current pawn’s accuracy. You could also substract a fraction the distance between the attacker and the target from this (either by measuring the distancedirectly or getting the value from the Range Array). If the random float is lower than the current pawn’s accuracy minus the range modifier it would be a hit and you’d go on to dealing damage. For a miss you could instead fire off an appropriate miss animation or launch a projectile in a trajectory that misses the target.
Hiya ! Found another weird lil bug for ya. If I have a scenario where a melee unit has a target that is right at the edge of his movement range, like this:
If I click the enemy unit with the intent of move then attack, instead of clicking to move first then attacking, not only does nothing happen, but I am no longer able to do anything. He can’t move anywhere else, gameplay just gets stuck. Looks like it might be another “edge clipping” example. If you get a chance, could you test this scenario with your updated code? I’m curious to see if it is related. Also, right now if I do the same thing with a ranged character, click an enemy to move into range then attack, it moves in to point blank range then attacks, rather then just moving in to attacking range before attacking. In fact, even if the unit was already in range before moving, he will move into point blank range before attacking. Weird no?
In fact, if I try to attack an enemy unit with a ranged unit, where the ranged unit is in firing range but not able to close to point blank range, then the same “gameplay lockup” occurs where I can’t move or do anything else. Just another heads up. Cheers,
I have bought your package to help me learn Blueprints, and I want to toy around with a game I have in mind. I basically have a picture that I want to set your grids on top of, with the picture fully visible & the grids hidden. Is this possible? I’ve watched your video’s but couldn’t see what I’m after.
I can’t import a single mesh per square, I need the entire picture displayed & the characters will traverse the picture.
Also, is it possible to resize the grid individual squares? I need a rectangular grid 100x50 and my picture to be placed on it with perfect fit.
Sorry these are newb questions, even if you have pointers of what i should be researching to figure these things out for myself, very much appreciated.
Thanks for letting me know of any bugs you find, J.J. This problem is not related to the previous one, but is the result of some late changes I did to the blueprint that I obviously didn’t playtest well enough. The game stopping when you click outside your movement range is very easy to fix. I’ve fixed it in the update I’ve sent Epic, but until they get it uploaded you can fix it by inserting the two nodes I’ve pictured below. The first one is in the “Attack Target” section in the bottom right part of the main blueprint. The second is in “Select action depending on tile clicked” in the top, green part.
As for ranged units moving to point blank to attack and not being able to attack targets outside your movement range but inside your sight range while in the movement phase, that’s actually working as intended, though I am working on ways to change this still. The reason is that currently units generate either a walkability grid or a visibility grid, but not both at the same time. Therefore when a ranged unit is in movement mode it acts just like a melee unit. To attack a target within move and sight range without moving, the player can click his active pawn to change to attack mode and then attack any enemies in sight. The reason for this is that calculation visibility and movement are the most costly parts of the blueprint, and back when the system was less efficient I didn’t want to generate both at the same time, especially not on the same tick. Now that I’ve made the system a lot more efficient it isn’t as important, but generating both at the same time for units with high move and range on slow computers will probably still cause some slight lag (we’re still talking a few milliseconds here, but ideally I don’t want to have any percievable lag).
The Next big update I’m working on will enable walkability and visibility to be calculated over several ticks, preventing lag, which will allow me to generate both visibility and walkability at the same time as the default option. Until then a small change you can do if you want some of the functionality right now is calling the “find tiles in range” function when a player clicks on an enemy in the movement phase. Then you check whether the enemy’s index in the range array is a number different than zero (meaning it is within range). If it is, call attack target, if not proceed as usual as with the old system.
I’m not sure there really are any noob questions when it comes to my toolkit. After all I’m the only one who has any experience with it, so that would make anyone else a noob at the moment What you’re describing is certainly possible, and actually really easy. What you need to do is set up the blueprint just like I show in the first video. Then click on the Grid Manager blueprint and set Grid size X to 100 and Grid size Y to 50.
If you need the grid cells to be a different size (and you can’t for some reason resize the picture to fit) you’ll need to resize the meshes you use for the grid. Edit the SM_Default_grid_mesh (or something similar. I’m at work and can’t check. The mesh in “meshes” that looks like the default mesh in any case) and set its build scale to whatever size you need. Its default size is 20020037. Now place the picture on top of the grid so that it covers it perfectly and is at the exact same height as the Grid Manager. Then click on the grid manager and set the public variable “default tile visible” to false.
That should do the trick Just ask me again if you have any other questions.
But i found a small bug.
when you click on an enemy which is outside of your movement and attack range, something breaks.
After that you can’t move or do anything at all.
Hi Gaara, I’m glad to hear that you’re enjoying the toolkit
What you are describing is a known bug. I’ve sent new files correcting this problem to Epic a few days ago, but updates usually take some time. In the meantime take a look at my comment three comments up for how to fix this problem yourself. You only need to add two New blueprint nodes.
Hey, no need to apologize That bug is a pretty serious oversight on my part which appeared due to some last minute changes I apparently didn’t playtest enough. Hopefully Epic will get the new update uploaded soon.
Is it possible to not be in combat mode all the time. Like fallout 2. Enemy sees you, then the combat mode starts?
Just bought it. Tried it a little, I managed to produce a bug where the player pawn can enter a tile that is occupied by an enemy pawn.