I am not sure whether it’s the same thing or not. BJS occludes the meshes by default as far as I’m aware. No need to set the strategy. However others may be better suited to tell. I am glad it worked for you. When developing 3D experiences for the web you have to optimize over and over again. I am afraid there’s no way around it.
However, good news is, if you implemented the solution correctly, it should not matter how many rooms you have. Either 8 or 30 should make no difference as stuff is computed when you see it. I would still not run animations when out of view. Again, with a large number of animated meshes, avoiding skeletal animations was crucial for me to get decent fps. Also, you can still implement LOD on top of this solution. Did you know BJS supports automatic LODs? This is super cool and very easy to implement. Check it out! Simplify a Mesh with Auto-LOD - Babylon.js Documentation
Thanks for the info Null, appreciate it a lot, but it turns out that no matter what I do I can’t get a stable FPS output and I think I am actually ok with it.
When I started working on this, the idea was always battle royale, not necessarily because I enjoyed it (I really don’t), but because it seemed the easiest to implement network wise (no rooms, no reconnects, no need to keep player’s state etc), but also quite a challenge (loot system, etc).
The more I’ve been thinking about this, the more I realise I despise battle royale and think that old-school run / shoot / die / respawn / repeat games are way more fun.
So I’ve decided to abandon the battle royale idea, and go with a CTF / TDM / DM game with small maps(8-10 rooms). I can keep the BR loot system, with some random weapon box spawns & looting corpses.
I believe it’s a win-win.
Don’t mention it. It’s a pleasure to help. It’s bad to hear that you couldn’t stabilize your FPS. Working on webgl games is not easy indeed, even if using awesome engines like BJS surely makes it easier. There is never enough optimizations you can make.
That sounds good. I hope in the end it works all out well for you. Just wondering though, have you read this? https://doc.babylonjs.com/how_to/optimizing_your_scene . Everything there helps performance-wise. Like turning off antialiasis and activating eiter FXAA or MSAA.
Your game looks awesome though. Please share it in the forums once done. I will be the first to play it
Your game looks great and it is incredibly fast!
Keep going and share your optimization solutions and other game insights!
Portal rendering - Wikipedia is another approach.
Thanks mate, will do! <3
Thank you, that is somewhat similar to what I am doing - only the room you are in right now + those rooms that connect to that room and have their doors opened are rendered.
Yes, but you may (probably with some hacks) further crop the neighbor room by generating an artificial frustum that is the intersection of the camera frustum and the (skewed) frustum that you get by considering the door opening as a projection plane (using the same camera position). Maybe rendering the neighbor room first with the cropped frustum, and then render (without clearing) the current room with the full frustum. (Cropping the frustum will obviously only be a point if not all objects in the neighboring room are merged. If they are all merged, cropping only by room depending on door opening visibility will have the same effect, I think. (That is rendering all parts of the neighboring room.))
Anyway, I don’t know Babylon.js yet. I am a three.js user, but interested in taking a look at Babylon too.
he does merge everything inside a room. Also, I think he already does the room cropping.
Welcome! I am sure you will love BJS. Also, we have an excellent community so feel free to roam / ask the forums for anything if the already-almost-perfect documentation is not enough . Have fun!
The neighboor room does not render anything other than the floor and walls (which is one merged mesh), unless you step in it. Once you step in the room, the previous rooms objects are removed from the scene and the current room objects are added.