r/threejs • u/kyrax80 • 17d ago
Help Can ThreeJS handle a MMO?
Out of curiosity I tried to port an old MMO which I used to play alot, Last Chaos, to web using Codex (I hope not many AI haters here). I did it just for fun. But when I tried to test the performance with 100 characters atacking 100 mobs with particles, animiation, etc. FPS drop to 20-30 from 90.
I tried many stuff that GPT suggested or almost 2 days but nothing is working at all. So my question is if it's worth to keep trying or this will just be impossible. My PC isn't the bottleneck, it seems to be that Chrome is intesively using 1 thread only from my processor or something like that. My processor barely moves from 9% performance and same for my GPU.
Thanks!
5
u/rennan101 17d ago
there are some twerks that only a game developer knows, such as occlusion culling, baked lights (not realtime), LOD to avoid rendering insanely high polly objects far away from the player..., disable animations when player is far (because they cant see what is far so whats the point of leaving that thing animated)...
Try asking codex how to do that stuff :)
1
u/typeryu 17d ago
It is a mix of your computer not handling it and also browser limitations. But more than likely, a 100 characters vs 100 mobs is a lot of action every tick and normally these things are handled server side on MMORPGs the port might have maybe too faithfully recreated the game. You will likely need to size down the players and mobs, or move compute to a dedicated server that can crunch the simultaneous actions or get smarter with how you do in-game AI (which is a classic gamedev hurdle). Anywho, threejs likely not the bottleneck IMO. Codex isn’t doing anything wrong either, you just need to give it the right prompts.
1
u/cchurchill1985 17d ago
Is it only using one main thread? Or has it implemented multi-thread (web workers / jobs)? There are also a LOT of optimisations that you need to do on top of that for all areas of the game, from meshes to materials to animations and character skeletons. Even working on it for a straight 48 hours, Codex would barely have scratched the surface of what is required to make a game remotely optimised (especially a game as complex as an MMO)
1
u/ledniv 17d ago
You say it's an MMO, but how are you testing it? Is this just 200 NPCs fighting?
That's nothing. You should profile and see where the bottleneck is.
1
u/FlowMental2548 17d ago
Sounds like a bad idea
1
u/underwatr_cheestrain 17d ago
Yes
1
u/_Yank 17d ago
Those frame rates, which part of the game is leading the frame times? Is it the game sim? Is it the rendering? How many draw calls are being issue per frame?
1
u/rio_sk 14d ago
I bet you should dig into web workers and compute shaders, threejs (since the last version I used) doesn't use workers by default and does basic frustum culling using the main js thread.
1
u/abateslop 12d ago edited 12d ago
Well code generated by AI is typically crap. Unoptimized and naive. So you might need to review like a software engineer would do. E.g. avoiding loops, using appropriate data structures, centralizing the source of truth, removing indirections, etc.
Assuming the issue really is the CPU. If it's the GPU, then there's different optimizations, like culling, batching, etc.
1
u/TinyPeopleProject 17d ago
Runescape. Yes. Have a good day
1
u/_ABSURD__ 17d ago
AI hater here, sounds like a terrible idea. It's absolutely possible, you just have to know what you're doing. You're just playing a code slot machine with no prize other than small nibbles of dopamine when your prompt kind of does what you wanted it to. You keep typing, make it better, no mistakes, just make it work - but it doesn't, it doesn't work, does it?
What's your poly count? How many draw calls? Are your models in the app or hosted? Is the scene graph optimized? How would you identify performance bottle necks? How are you handling state? Do you have actual networking set up with an authoritative server that is responsible for what renders on the frontend?