The Legos on my Footpath

January 26th, 2016

Often I post when I’ve got something to show that I’m proud of, but that doesn’t make a very honest development blog. Sometimes things go right, but just as often things go wrong, and most of the time they go wrong its because I’ve done something stupid that’s easy to fix but still takes me more time to figure out than I would like to admit. So this week I’d like to show some of the simple things that have driven me crazy and how you can avoid these same pitfalls.

  1. Decals: Decals drove me crazy because no matter what I did I couldn’t get them to show up, and I swear that it’s a problem that I didn’t used to have. I had a simple decal i wanted to apply to a floor and no matter what I did it didn’t seem to show up. I could kinda see a white outline where the decal was supposed to go but nothing like the way it should look. I spoent hours in the material editor and online forums looking for the cause. Then on a whim I tried changing the decal mode. I had been using Translucent, but I switched it to DBuffer Translucent, and sure enough every2016-01-25_1620I decided to check and sure enough Dbuffer for decals was selected, I’m not sure if this was something I selected when I was trouble shooting something else or if this is checked by default in newer versions of Unreal, but that took me a while to figure out.
    2016-01-25_1621
  2. Character Movement to Character:  Coming from a Heavily Unity 4 background I got used to needing to either write my own code or use a third party plugin for a lot of basic game functionality. It’s taking me a while to realize just how much stuff is included right out the door from Unreal. The number of times I’ve tried to write my own code only to realize the functionality was just hidden in a check-box somewhere that I just needed to check. The solution is often more simple than I realize. Character movement is one of those cases. I had a behavior tree set up on a character that I wanted to be able to move around the map. I was using the out of the box “walk to” task to get him to a specific location, but I wanted him to follow another character instead of going to a static location. So I set up a complex system including a service that constantly updated the location of a unit on a BlackBoard key and constantly redirected the character to the new location. The solution was way heavier than I wanted, produced a jittery animation, and often still failed to work. And then I realized the walk to node could take an actor as an input…
    All of the functionality I needed was in the out of the box task to begin with…Move_To
  3. Character Turning: This was a similar problem. In Safe or Sorry I needed my fish to pick random locations and then swim to that location. All of that worked fine, but when it picked a new location it instantly turned to look in that location and then proceeded to swim to it’s destination. This was game breaking because the whole idea is that you can avoid being seen by staying out of the fishes light. If it turned instantly the player can then be caught without doing anything wrong.  Once again I tried to build out an overly complex way of slowly turning the character and then giving the order to move to destination. This solution worked, but was messier than I would have liked, and then I saw this on the character’s movement component.Rotation_RateTurns out this is built in to the movement component of every class that inherits Character. Just set Yaw speed and call MoveTo in your behavior tree and you are there.
  4. Character Avoidance of other Characters: I was having issues getting characters not to run into each other. I had generated a nav mesh and they avoided walls and obstacles but not each other. I tried adding collides to the characters and turning on dynamic updates to the nav mesh. This effectively told the path finding algorithm to find the smallest path between two objects, one of which will always be unreachable. Needless to say the AI flipped out. I got stuck on this one for a while until I found RVO avoidance. RVO
    Setting RVO avoidance on the character’s Movement Component, and changing the radius to a high enough value allowed me to avoid unwanted character collisions.
  5. BSP to Mesh: I know that the performance on BSP items in your level is worse than their mesh counterparts, and I understood that it was possible to convert from BSP brushes to static meshes, but I wasn’t really sure how. I build Safe or Sorry mostly in BSP brushes, so as i turn it into a real game I wanted to pull those out to improve performance down the road. After searching for what felt like forever I finally found the convert to static mesh button.  Hint: it’s hidden under the more info separator on the Brush Settings menu in BSP mode.2016-01-25_1629The first thing I noticed after creating my mesh is that floors no longer stopped me from falling out into space. Turns out that the colliders for BSP meshes don’t get added to the mesh. You have to go to the mesh’s settings and set “Use Complex Collision As Simple”. 2016-01-25_1634
    The next thing I noticed is that when I built lighting my new Mesh turned black. Turns out that the conversion method does not translate UV’s well. After taking the mesh And redoing the UV’s I got it to show back up in game.

back to blog