Ok, time for a new update. I’ve made three major additions to the system: vision, camera control and AI, and I’m really closing in on it being complete enough for a marketplace release. I’ve included a video that showcases all three new features. They are described in more detail below.
https://.com/watch?v=HG3M7kligJQ
Vision: Pawns now have a range stat that determines what tiles they can see or attack (can be used for both). This takes into account any obstacles in the way. In the video, tiles that can be seen by the pawn at its current position are highlighted in red. Building on this I’ve added a new type of tile that blocks movement, but not vision, which is shown in the video.
Camera control: All basic camera control options are included: Pan, zoom and rotate. All movement is made smooth using interpolation. In addition the camera can be set to automatically follow the currently active pawn; which can be overridden by panning.
AI: I’ve made a rudimentary AI which will serve as the basis for future AI-development. This AI chooses the enemy with the lowest health within range and moves into melee range with that enemy. I have not implemented attacking yet, so the pawn just kind of stands there, staring. For the next update I plan on making the AI a bit less friendly. Included in the AI system are the beginnings of an initiative/turn order system.
As an added note I recently ran a new stress test, and again I’m surprised at how well UE4 and my system handles more extreme situations. I created a 400*400 grid (160000 tiles) and placed a pawn with a movement of 100 on it. Calculating the optimal path to in excess of 10000 tiles took less than half a second, and except for that half second judder everything ran at above 60fps (ignore the apparent lag in the video. I still hadn’t fully understood the recording software). This is even though nearly every tile is visible in the viewport. This makes me pretty certain that for small grids, the system is probably efficient enough for mobiles and tablets.
https://.com/watch?v=HGq84uumApE
[=;191642]
When Ian Shadden was helping me out back in spring he mentioned that he had implemented a navmesh solution for his own purposes but had found it somewhat imprecise for grid based movement so he made an A* system. He did mention that it could have gotten better since he tried it so that may have been last year.
I wonder if navmesh uses some kind of A* or similar or if it is just tracing everything out. I know grids are involved, and you currently need a separate navmesh for different enemy sizes. If it does use something similar to A* and we could just get some key pieces exposed then it could be an ideal solution for people using blueprints to get the speed of C++ on the core pathfinding algorithms.
[/]
It’s interesting that he didn’t manage to get it precise if they use A* pathfinding. I wonder why that would be. I sure hope we can get more of navmesh exposed in time. That might be the easiest way to make grid based pathfinding work well with huge games such as Civ.