I'm making a small RPG and I need feeback regarding performance

jslegenddev.substack.com

91 points by ibobev 4 days ago


JSLegendDev - 3 days ago

Hi everyone! I'm the dev behind this work-in-progress game.

This post was intended for my existing audience and I didn't expect for it to be posted on HN.

Anyway, now that it's here, feedback on performance is still very much appreciated!

The reason I'm not making this web playable despite being built using web technologies is that I'm targeting Steam for this game. Therefore, I need to make sure the game works well when installed as an executable on Mac, Windows, Linux.

There was already trust established between me and my audience so that's why it felt appropriate to tell them to download executables.

I understand why HN users not familiar with me, would be wary of downloading random executables from the internet. It's a good instinct to have!

gwbas1c - 3 days ago

Why are you worried about performance for a 2D game that's basically moving a few sprites around the screen? A game like this shouldn't be taxing for modern hardware; and should even run cleanly on pretty much any computer made in the last 15-20 years. (Or even older, if you weren't using Javascript.)

As some of the other comments imply that there are some performance issues; more than using a profiler, I would make sure that your mental model of the event loop from your framework is correct. If all you're doing is moving some sprites around the screen, you need points where your code pauses because it has nothing to do. This could either be awaiting something from the framework, or putting most of your logic in callbacks that are triggered by the framework.

A different way to say it: Between frames, there's not that much calculation that your game needs to do when you're just moving a few sprites around in 2D. The event model that you hook into should be something where your game does its calculations, and then waits between frames.

BugsJustFindMe - 4 days ago

> is it just my machine? I’m using a Macbook Air M3 with 16GB of RAM

Using one of the singularly most powerful personal computers ever made. It's probably not the machine if they don't notice everything else being unexpectedly bad too.

b1tshift - 3 days ago

On an M2 Mac with 24GB the game went smooth for a few fights and then went down to around 10fps and got slower with every attack an enemy did in the fight. The longer I played the slower it got. CPU and memory usage was stable all the time.

magicmicah85 - 3 days ago

Without downloading the exe (work laptop right now, can try later), have you followed the optimization suggestions in KAPLAY's guides?

https://kaplayjs.com/docs/guides/optimization/

Assuming it's capable of running in your browser, I'd suggest using chrome's dev profiling tools to help with finding the optimization areas. Based on feedback from everyone else, sounds like something is not cleaning up as the game keeps running.

andrewf - 3 days ago

Firefox runs the game well on the Mac, while the Neutralino build (presumably using the WebKit shipped with Safari) experiences some performance issues. Can you replicate the performance issues with Safari? If so you might be able to glean some insights from https://webkit.org/web-inspector/timelines-tab/

When profiling, it can often be useful to compare profiles of "working well" versus "not working well". So you could record a 10 second timeline when things are going smoothly, then a 5 second timeline when perf is bad - things that jump out on the second timeline are worth looking at.

xantronix - 3 days ago

Related to the initial poor performance of Electron on macOS Tahoe?

https://github.com/electron/electron/issues/48311

jesse__ - 3 days ago

First off, yay for making games! I love working on games, and have spent many, many hours doing it, so welcome to the club :)

Second, let me introduce you to my good friend, the profiler. A profiler is an absolutely indispensable tool for making games. Find one that you like, and learn to wield it with laser-guided precision.

Generally, there are two things you want a good profiler to tell you about; execution speed, and memory. Finding a profiler that tells you about execution speed is pretty easy (basically all of them at least nominally do that), and finding one that also profiles memory (in a useful way) is somewhat harder. I'm not sure of the state of profilers for Javascript, but maybe the tool you're using (KAPLAY) has one built-in?

From my long-forgotten days of programming javascript, one thing you want to look out for (which is difficult to spot without a profiler), is creating memory leaks. Memory leaks in Javascript can be a double-edged sword; you're both using more memory than you should, and the garbage collector has more pressure on it. Over time, this can bring an application to a crawl as the GC spends more and more time traversing leaked objects.

Good luck friend. It's dangerous to go alone, take this :sword:

sionisrecur - 3 days ago

I'd suggest getting a SteamDeck and use it as the lower limit on performance. If it runs there, it will run everywhere else.

lukan - 3 days ago

A bit offtopic, but if it would have been playable in the browser I would have tested it, but I don't want to download and install a (for me) random exe.

(and I don't see how performance could be an issue unless a major screw up, but like others have said, use a profiler. Sounds like memory leak from what was shared here)

mvkel - 3 days ago

> performance issues

What kind? It would be helpful to know what you're experiencing, attempts you've made to fix, etc.

Or is this a thinly veiled "I've been working on this for a while and it's taking longer than I thought and want some encouragement." Which is fine! It's a great thing to ask for.

hresvelgr - 3 days ago

It's probably worth reminding everyone here that it's possible to write slow code in "fast" languages and fast code in "slow" languages. The state of software as it stands today is horrendous, but seeing as no one here (author included) seems to know why it's slow it's probably worth reserving judgement.

DeathArrow - 3 days ago

If it wasn't for Javascript, that kind of game should have been able to run on a 2Mhz 8086 and 640kb of RAM.

duttish - 3 days ago

Do you have a profiler at hand?

If you have a friend who is encountering the performance problems enable profiling report export and ask them to send that over to you. Hopefully that'll show you what is taking so many cycles.

butz - 3 days ago

You can use developer tools in the browser to simulate slower CPU. Use performance profiling to find which functions are taking up the most time. Try switching to battery saving mode, it might throttle your CPU a bit too. If you really want to dive deep in performance improvements, you should purchase lowest end laptop with integrated GPU, if budget allows. And how about providing an embedded web version of your game, because downloading unsigned executables these days should be considered a no-no.

zyx321 - 3 days ago

Intel i5-9350, UHD Graphics 620, Windows 11 v25H2

Completely unplayable. It runs fine at first, and then suddenly drops to below 1FPS for no discernible reason. This happens regardless whether I am on the world map or combat scene. I am running the exe, couldn't find the browser version.

On an unrelated note, I am surprised to see a JS program working without the usual 200MB NW.js runtime (as seen with RPG-MV)

calebjmatthews - 4 days ago

Just downloaded and tried it on my M1 Mac and the performance was what I'd expect for a game like this, both in and out of battle. Totally smooth and ~15% of CPU usage in both cases. By the way, I love the pixel art, and the gameplay has potential, it's a style I've never personally played before but I could see it being compelling.

OhMeadhbh - 3 days ago

can confirm. very slow. here's the output I got on Debian 13 on an older i5, but it doesn't look like it's telling us very much.

   ./Small-RPG 
   libEGL warning: DRI2: failed to authenticate
   VMware: No 3D enabled (0, Success).
   libEGL warning: egl: failed to create dri2 screen
   VMware: No 3D enabled (0, Success).
   libEGL warning: egl: failed to create dri2 screen
   
   ** (WebKitWebProcess:2822): WARNING **: 14:52:20.184: The GStreamer FDK AAC plugin is missing, AAC playback is unlikely to work.
jseip - 3 days ago

Was really hoping you were making a small rocket propelled grenade

tithos - 3 days ago

You may want to add instructions to the game currently it is unplayable

balamatom - 3 days ago

Not running a random "Linux build" (which is probably not going to find some lib anyway) - in 2025 the baseline should really be an AppImage.

- 3 days ago
[deleted]
computerthings - 3 days ago

[dead]

VegaKH - 3 days ago

[flagged]

yomismoaqui - 3 days ago

Forget about performance, specially in a 2d game like this one. Focus on making it fun (really-really fun is possible).

I have played games that didn't performed so well because they were so fun. Games are about fun, anything else (narrative, performance, sound...) is secondary.

casey2 - 3 days ago

Why not consult with industry professionals rather than random people on the internet? Gaming is a huge industry worth billions and have many people who have dedicated themselves to the craft. They not only can diagnosis common problems and future problems, but can help effectively change your processes, ultimately identify and solve these similar problems yourself. All for not that much money, you are in a good position to capture a bunch of value if you are serious.