RTS problems

This forum is currently in read-only mode.
From the Asset Store
10 isometric and animated Strategy Game Buildings in two Colors.
  • I've just returned to making my game after a long period away from construct, so I've forgotten a few things.

    The problems I have at the moment are with the RTS object. I want pathfinding for the enemies in my game, but they keep getting stuck on walls and such. It also lags like crazy when I have any number of them more than 5.

    Here's my cap file: http://www.filepak.com/upload/1_zombiecity.cap

  • I'm sorry but the RTS pathfinding isn't pixel perfect. If you want more precision, make the path finding grid smaller (best results are with 10x10, but it's more cpu intensive).

  • Ah I see. Yes it was on 10x10, that must be why it was lagging so much. I probably don't need the grid to be that small, the smallest passages are 64 wide.

    edit: Ok I changed the grid to 40x40 and it seems to have fixed the getting stuck problem. It's fixed the lag problem too, however when I go around the corner I sometimes get alot of lag. Is there no way at all to solve this?

  • Only use pathfinding actions once, or whenever it's necessary. Using them every tick will cause lag.

  • The 'move to...' actions run a very computationally intensive search algorithm over the entire layout. It is completely unecessary to run this search every tick. It'll probably work fine if you pick a random object every 1 second and tell that to move, and it won't tie up the CPU.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It depends on the useage. If you want enemies to pathfind toward you as you move, you should experiment and see how often you need to recompute the path for it to be effective. Unless you are literally moving through numerous hurdles and solids then I can't see why a 'move to' every couple of seconds wouldn't work. It all depends on the useage.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)