Lance Treiber
Educated
- Joined
- Feb 23, 2019
- Messages
- 65
Lance, you seem to know your programming, I have a simple but important question I'd like to ask you.
How did you generate all of these hexes (or square tiles) on the screen? I mean, what are they? Just some graphical overlay? Still impressive.
When I think of making an RPG with tiles, I think of having like 1000 game objects each representing individual tiles, and that seems bad. But you just have pathfinding, and the tiles on the ground and it seems great. What method is that? And how powerful are these tiles to contain game data?
Visually, the hexes are just one instanced static mesh placed any number of times. It's just one actor in the level.
Data-wise, they're structs in a container. As structs, they can hold additional runtime info, like who's standing in the hex. Or editor-time info, like the traverse cost: for example to dissuade NPCs from running over fire.
Generating them involves a lot of linetraces.
There's a class responsible for converting UE coordinates to Hex coordinates and back.
With that system in place, the cursor is hidden, but it gets the hex coordinates underneath it on Tick and moves a red hexagonal actor with a custom stencil depth. A post-processing material is used to ignore depth checks to draw the red hex on top of world geometry, but behind characters.
I'm planning to do more with hexes than Fallout originally did, taking inspirations from FOnline:
If you ever work on Hexes, here's a must read article: https://www.redblobgames.com/grids/hexagons/
Last edited: