# How do I ; Chipmunks + rts

0 favourites
• 29 posts
From the Asset Store
10 isometric and animated Strategy Game Buildings in two Colors.
• Prominent I added couple of obstacles and was trying to figure out how to make units follow trough,also using the nodes idea, but I have no clue how we would make units move to those nodes?

• megatronx , I would probably try to cycle through the nodes, finding the node closest to the destination that is in the line of sight with the unit.

So I would check the last node to see if it is in sight, then continue with each consecutive node until it gets to a node it can see. I'd only do this if the object collides with a wall. Apply a force towards the node that is in sight.

If two units are fighting over a node, I would somehow apply force to only one of them (maybe the one closest to the destination)..

I'll try experimenting a little, but it might be something that requires more time to get right, and not sure if I can do too much.

• I experimented a bit, but didn't find any solutions. The issue I was facing is how to manage which unit attempts to go through the pathway first so that units don't compete with each other.

This would require more work to figure out than I'm willing to invest, since it basically means designing a way to store where each unit is, and how to process all of it so that they work with each other to get through.

One thing that comes to mind is using a dijkstra map instead of pathfinding, since that creates data that multiple units can use to move through a level. That way, each unit would have their own way of finding a path to the destination without generating one for each unit.

edit: also with a dijkstra map, the units would be moving towards the next tile rather than being pulled by something that could be currently behind a wall, so the flow of forces would be more accurate. You could also stop other units from trying to get to a tile if that tile is already occupied by another unit.

• I experimented a bit, but didn't find any solutions. The issue I was facing is how to manage which unit attempts to go through the pathway first so that units don't compete with each other.

This would require more work to figure out than I'm willing to invest, since it basically means designing a way to store where each unit is, and how to process all of it so that they work with each other to get through.

One thing that comes to mind is using a dijkstra map instead of pathfinding, since that creates data that multiple units can use to move through a level. That way, each unit would have their own way of finding a path to the destination without generating one for each unit.

edit: also with a dijkstra map, the units would be moving towards the next tile rather than being pulled by something that could be currently behind a wall, so the flow of forces would be more accurate. You could also stop other units from trying to get to a tile if that tile is already occupied by another unit.

You need to create an order. I think something like this might be a good start.

You need boolean that will lock the unit from picking. You also need a variable Order. This is for units that player has selected.

Repeat "selected" count, pick nearest Units to MouseTarget, units boolean Ready = false. Then set that boolean to true and varOrder to loopindex. Now every unit has it's order number, so it might be easier to figure out how to get them pass trough.

Maybe that will help. Also,have a look at Ro0j example.

• You need to create an order. I think something like this might be a good start.

You need boolean that will lock the unit from picking. You also need a variable Order. This is for units that player has selected.

Repeat "selected" count, pick nearest Units to MouseTarget, units boolean Ready = false. Then set that boolean to true and varOrder to loopindex. Now every unit has it's order number, so it might be easier to figure out how to get them pass trough.

Maybe that will help. Also,have a look at Ro0j example.

The issue I see with this is that the nearest unit may not be the one that needs to move first.

Whenever you click to create a path, it removes the previous nodes, so if the units are following the nodes, and you click again in the same location or nearby, the previous nodes disappear and you get one or so nodes at the place where you clicked.

You would have to store/save/update each path nodes in some way so that they all connect and go to the destination from the perspective of each unit.

I don't know how much processing would occur to create a path for each unit- but that is one way to ensure each unit has a node to go to (you could put the path-following sprite in a container with the unit so that each unit has a path-following sprite).

Maybe at that point, you could find which unit has a shorter path, and move them in that order (short to long). If there is any congestion, pause the longer path units that are behind the congested area/unit.

edit: this is also why I suggest a dijkstra, because those take less processing, and you get data that an unlimited number of units can rely on. I made a dijkstra plugin in the past for something I was working on and I never released it because it wasn't meant for public use. I'd have to clean it up and figure out a way to make it more user friendly.. Maybe I'll do that in the future, but I have other things to focus on.

Using paths for each unit might be a workable solution, but you would have to test it out.

• Maybe start picking from closest to first node?

• Maybe start picking from closest to first node?

here's a bit more experimenting I did: http://1drv.ms/1KJjNL5

It probably isn't optimized as well as it could be, but it might give you some ideas. There still needs to be a way to prioritize which unit goes first when two or more are competing with each other, but this example has a movement that works better than the previous example.

• > Maybe start picking from closest to first node?

>

here's a bit more experimenting I did: http://1drv.ms/1KJjNL5

It probably isn't optimized as well as it could be, but it might give you some ideas. There still needs to be a way to prioritize which unit goes first when two or more are competing with each other, but this example has a movement that works better than the previous example.

I looked at it, but I don't know yet. Also I hope there might be an easier way, with less objects. I'll think of it more.

• thanks is best

• >

> > Maybe start picking from closest to first node?

> >

>

> here's a bit more experimenting I did: http://1drv.ms/1KJjNL5

> It probably isn't optimized as well as it could be, but it might give you some ideas. There still needs to be a way to prioritize which unit goes first when two or more are competing with each other, but this example has a movement that works better than the previous example.

>

I looked at it, but I don't know yet. Also I hope there might be an easier way, with less objects. I'll think of it more.

Any chance you could re-upload? megatronx

• here's a bit more experimenting I did: http://1drv.ms/1KJjNL5

Any chance you could re-upload? megatronx

Link is working for me. Could you doublechek?

• Hey megatronx

I still get an error. It says link is no longer available, request a new link?

• Hey megatronx

I still get an error. It says link is no longer available, request a new link?

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Thanks megatronx got it now

• 29 posts