An Update On a Game You Didn't Ask About

Edit: I had originally posted this in #development-discussion, but I guess this doesn’t fit in that category. I have moved it here assuming it is the next best thing. I apologize if this is incorrect as well.

It's an RTS game

For the past couple years, I have fascinated and toyed with the idea of making a real-time strategy game on Roblox. After much success in creating some of the core concepts to the game, I was heavily discouraged by one single issue: pathfinding.

The problem, I suppose, in its simplest explanation, is that Roblox Lua does not run as quickly as other programming languages. I am using a custom A* pathfinding system. As of right now, units in the game behave very similarly to units in the video game Starcraft. (The link leads to a site that talks about the game’s pathfinding specifically; not the game as a whole.)

To put it simply, after manipulating the nodes on my map, and further testing units’ movement around the map, I noticed some scenarios in which units would take a significant amount of time to calculate a path to the target location, creating visible delays in response to commands. I began to worry that this issue would rise up more frequently when I made actual multi-player maps, which would be much larger than the test map I was using. Also, I was still only controlling a handful of units during each test run: for those familiar with rts games, they will know that even a small 1v1 match can have a couple hundred units running on the battlefield. Even with a basic AI, I began to fear that a true real-time strategy game in Roblox might not be possible.

I essentially gave myself the ultimate burnout. Afraid to work on something that might end in complete and total failure, I stopped working on my game for quite some time.

I tried working on other games. I went back to old ideas. But this rts game has stayed in my mind the entire time. Apart from the gameplay concept, it also has a story that I am invested in. One of the biggest drives to making this game is to see this universe of mine come to life.

Recently, I decided that I’m going to keep working on this game until I am absolutely certain that it’s doomed. My current plan is to ditch weighted terrain, and upgrade my A* pathfinding to JPS, in the hopes that there won’t be much lag when working with multiple units on a large map.

And that’s the update! I decided to make this post because I felt like I needed some support in all of this. Do you think this is possible? Would you even play a Roblox rts game in the first place? Let me know!

5 Likes

It looks me a cool game but I can’t help you I’m just a beginner in scripting

Congratulations, you have passed the testing stage of the design process and now it’s time to return back to follow the cycle of the design process which is to improve on what you have learned and decide what you need to do next although it’s fine to feel burnt out and take a break.

The Design Process Diagram, although doesn’t necessarily have to be engineering:

The fact is at the end of the day all computers have a limit to the amount of math they can do per second whether in Roblox Lua or in Unity C++ although I do not know the technical details specifically and which is better and most importantly why it’s better.

But the most important fact is that you have options to choose from such as if you have the option to improve as you are now which I see you are doing by trying to use a different pathfinding algorithm (JPS).

In me and @CJ_Oyer case, we are doing some Inverse Kinematics and it turns out the computer is not that good at constantly calculating some pretty complicated math:

And in my case I have the same issue from when the performance can spike from 5% to 12% as well as seen in the video:

(I’m doing IK on the server, but I’m planning on moving it client-side for performance reasons)
https://i.imgur.com/nXfm0rz.mp4

While this is pretty bad, we can resolve the issue using normal animations instead which sucks but hey at least the game will be functional. The point is that you can always improve and redefine your goals towards an enjoyable game experience.

Consequently, I will have one questions for you following a similar manner:

Do you always need to use pathfinding to move the units go where they want?

Last time I checked I believe not even The Conquerors 3 has pathfinding they will try to just move toward the target location even if there is a wall in the way.

Usually, the player will have to do the pathfinding themselves for the units using the shift queue movement so maybe you can use that to reduce the number of calculations needed.

You can even use game designing tricks to hide these flaws like using doors as a loading screen that many games do.

In your case, you could have the units visually do an animation where they have to think and plan where they want to go for long-distance pathfinding.

Otherwise, hopefully, you will achieve your project of making a “true” RTS game on Roblox.

6 Likes

I forgot to mention that one of my other drives to creating this game is because of the vast number of things that “The Conquerors 3” lacks. I have played several rts games, and I can tell you that pathfinding is essential to making an effective real-time strategy game. The sheer amount of micro-management required without it is just absurd.

Nevertheless, you present a good point. If it’s simply not possible for Roblox to handle several units pathfinding around the map, then perhaps pathfinding will have to be abandoned altogether (:sad:); or the amount of units that can exist on the battlefield at one time will have to be reduced greatly.

I greatly appreciate your response, as well as the design process diagram. (I’ve never seen this, before, so I find it very useful.)

If a user is selecting multiple units just use one pathfinding calculation for all of them. Maybe you can add a general offset from the target location as well but that isnt required. Additionally i would incorporate what @dthecoolest said in his comment.

That’s pretty weird because I believe Crazyman32/sleitnick had 1000 NPC’s running with pathfinding at 60FPS. I believe he was using a different search algorithm for pathfinding. Maybe try using the one he uses, in the video?

2 Likes

Thank you for this resource!

It appears he is only rendering units that are visible on the player’s screen. I have implemented something similar, but only for when units are hidden by the fog of war. I’ll have to try this for the viewport as well. Thanks again!

1 Like

Hello! Doing some research, it looks like A* (your choice) is the algorithm that best fits for this use case.

I am in fact working on a strategy game too, and I have encountered the same problem (still not resolved). However, it is possible to develop a performant pathfinding code in Lua since other devs have achieved that (some examples). You might be able to infer their secrets from the images, or just contact them for help :upside_down_face:

In my opinion, pathfinding is not an essential trait of most RTS games. There is no reason to give up the project if you finally can’t come with a solution! Anyway, letting the user draw paths for the units at their own discretion can work perfectly, since it’s quite intuitive for the player and very straightforward to implement.

Hope you succeed in your game!

1 Like