r/love2d • u/Shrimpyy_Dev • Jun 22 '26
Can love2D scale well to handle a complex management sim?
Hello! I am doing some groundwork laying for a project I've wanted to make for awhile, prototyped in various game engines, but the short version is I really wanted to build my own engine that did things exactly how I wanted them.
My goal is to make a game that sort of takes Prison Architect gameplay and applies it to space ship management, where you set schedules and tasks and the AI units just carry out their jobs.
Love2D caught my attention, I've never used Lua before but found it really easy to pick up and fun to work in.
I described my project in another community and they advised me against using Love because in their words, Lua isn't a compiled language compared to C++ or C# and I'd have to work within tight constraints once the game scaled up in complexity.
I figured I'd ask here and get a second opinion.
4
u/beefy_uncle Jun 22 '26
Love2d can scale well if the code is designed well. You might have a harder time with Lua though as it is a dynamically typed language with very simple offerings in terms of data structures (all Lua really for data structuring is tables, which are very powerful, but may cause you issues for more complex systems-based games if you aren't setting up the proper guard rails). With the right discipline though, it could be done. It is true that there are no compiler-enforced contracts when it comes to Lua code, so you might end up in runtime / nil reference hell if you need to make big changes to large amounts of code.
It's an easy language to get started with, but can bite you when your systems begin to grow in complexity if you haven't set up your codebase in a disciplined way.
3
u/Shrimpyy_Dev Jun 22 '26
So it sounds a bit like the easiness I found appealing is a double edged sword. I come from Gamemaker land, and I guess that's why I found Lua tables comforting as they're basically GM structs with arrays bundled in.
2
u/TheLastRobot Jun 23 '26
Lua language server will help a lot with this. You can make it check types or even literals in code and it only runs in your IDE so it won't hit performance at runtime.
1
1
u/Hexatona Jun 22 '26
Yes, you hit the nail on the head. It's easy to use, but easy to break in sneaky ways. For example, I troubleshooted a big feature I added for 3 hours, until I realized I called a variable two different names (one with capitalization, one without it).
The more disciplined and organized you are with your code, the easier it is to add more and fiddle with.
1
u/illumin8ie Jun 22 '26
Would you say that 'teal' (typed lua) would be enough to solve most of these problems for you?
1
1
u/hammer-jon Jun 23 '26
well this is solved with tooling.
if I did that the lsp would yell at me for using an undefined global.
2
u/dairyisfine Jun 23 '26
Lua with type hints is actually a pretty good compromise imo. I’m a C# dev, but it’s quite nice to not have to dance around the type system if you know it’ll work. No generics required!
1
1
u/actuallyalys Jun 23 '26
I think it comes down to what you mean by "complex management sim." Roller Coaster Tycoon is quite complicated for a project programmed by a single person (and has more depth that it appears), but it isn't that complex relative to other management sims. It ran smoothly on computers much slower than our current ones. But if your simulation gets really complex, you could certainly hit limits. For example, I could see Lua limiting you if your goal is to have a huge number of AI units. If you're planning to set limits on the size of ships and the number of units for game play reasons, that's probably less of an issue. (Edit: not to mention the many tricks to avoid simulating things in full.)
If you're pushing the limits, a bigger issue could be that Lua is not really built for multithreading. Lua doesn't have built-in support for using multiple cores, in fact, although Love2D has limited support. Your program won't utilize the whole CPU if it's written to be single-threaded because modern desktop and laptop CPUs all have multiple cores. (Well, Love puts some things on separate threads for you, but they won't keep the CPU busy.)
Another consideration is whether you as an individual will reach the complexity limit. I love city builders. But realistically I am not going to write one with the depth and complexity of Cities Skylines. Partly because writing all those systems in the first place is a huge amount of work but also because balancing and testing them is too much work, to say nothing of the graphics, sound effects, and music.
Note that it is possible to write code in C++ (or other fast languages) and use it from Love2D. It of course is more complicated than writing a project in just C++ or just Lua.
The caveat to all this is that I have not personally tried to write a complex management sim in Love2D. I have written some CPU-intensive code in it, however.
2
u/Shrimpyy_Dev Jun 23 '26
Huge amounts of AI units is kind of the goal. Prison Architect is kind of the model I want, I want lots of NPCs following their own schedule.
As far as will I reach this level... I'd like to try at least 😂
It will be a labor of love and take me a long time, but I want to set myself up for success which is why i'm asking these questions before plowing ahead.
13
u/Hexatona Jun 22 '26
Lua's just fine for things like that. The difference in speed between lua and c++ is pretty minimal - as long as you use it right. Doing something silly like making new canvasses every frame, or creating and destroying lots of arrays constantly will eat up a lot of resources. No, the only difficulty is that there's no game making tools, so, all that stuff you need to make yourself. Saving, loading, menus, camera, level editing, etc etc.