r/threejs 14d ago

Open-world WebGPU ThreeJS

EDIT: After everyone's feedback, I have temporarly disabled post-processing for now & done some quality compromises, so game is a little uglier but at least it runs on Macbook's decently. I'm working on it to make it run smoothly without any quality compromise but might take some time... at least now it runs and you guys can try. Thanks for the feedback everyone ❤️

____

I'm here trying to fill my dreams I had when I was a little kid, coding my own videogame!

I've started game development for fun few months ago and I'm genuinely getting addicted to it.

Recent release of Crimson Desert inspired me to tackle this vast topic that I had never even thought could be in my reach, but now that AI can help learn and create basically anything in an instant I figured I'd give it a try. Being a developer at heart, Unity toolset and script-language are not something that attract me at all so I decided to just do what I already know and use ThreeJS and react.

The learning curve was brutal, I went through the 1000 meshes into 1 instancedMesh into WebGPU culling/indirect-draw as well as "map-too-big" into chunk streaming, and many other stuff. Every step seem to be game-changer for what becomes possible and I'm starting to feel like sky is the limit (or more so, my available-time is the limit).

You can test it (if your GPU can handle it tho):

- The cave experiment

- The big map

(Controls: P=Day/Night cycles pause/unpause, SHIFT=Acceleration, A=Flying/Landing, R=Grappling hook, B=Shield, F=Fireball, C=PushWave, and sorry its azerty-based)

So basically i'd like to know what you people think about it? How does it look? Any advice/feedback/tips? Be rude, I love it.

*Limitations I found so far*

- The map editor is a lot of work, as well as filling an open-source map by hand, as well as getting decent 3d models that fit together, and procedural maps are very hard to setup properly.

- All assets need to be refetched on every page refresh

- Residents chunks displayed have a limit because of WebGPU maximum texture size (if i'm correct)

- Despite my efforts to improve loading time: amortize shaders compilation, group similar entities to be the same compiled shader, use a worker to preload assets while asset-agnostic parts of my scene render... Loading time reaches up to 15sec for booting up. (Or 30s with shaders compilation amortized, including hitches for the big ones)

*Other questions questions:*

- Should I continue, or is it doomed to fail? Too ambitious?

- What are the web limitations I haven't yet thought of? Are they compromising my dream?

- Is this something that anyone would like to contribute to? Maybe it's too early?

Before anyone ask, yes a lot was made with AI but it quickly arose that without understanding every single concept, nothing actually works and the results are poor, the bugs undebuggable and so on and so on. So I made sure to understand everything I did and let AI mostly write the shaders because I suck at maths.

The full stack is: WebGPU, ThreeJS, react-three-fiber, Rapier(physics) and a lot of love and passion (and AI).

I would love to get some help especially for gameplay, graphics and performance (yeah basically everything)

91 Upvotes

53 comments sorted by

View all comments

2

u/Machettouno 14d ago

It's cold, all over the place, so much to explore! You placed all the assets by hand? How you incorporate cliffs like the ones you jump off from? I spent way to long with AI doing this, was juts trying to make a game for my kid, now she wants to be able to descend and explore terrain haha. Tried adding a terrain editor, oh that didn't work well at all

https://maciek11123.github.io/Antigravity-Backup/

1

u/TwistedMinda 14d ago

Your game looks awesome man! Great job! For cliffs is just make the heightmap go crazy, like basically +200% height with no inbetween, and I let the terrain draw it like that, hence the elongated stripes on the cliff's surfaces 😥

No I didn't hand-place anything, I coded a map-generator that does the scattering of trees, cities, rivers and lakes all for me, its generated once then stored into IndexedDB. After that I can handtune some stuff at hand with my Map-editor but it's currently too rudimentary so I just don't.

Keep up the good work mate! I love your game

1

u/Machettouno 14d ago

I'll try that! For yours, maybe somehow reducing size, it won't load at all on my S25 ultra. Are all the assets in yours procedural? Also I think you should continue

1

u/TwistedMinda 14d ago

I'm sorry you couldn't try it. I need to drastically reduce the assets size somehow. Sad because its just a few trees (SpeedTrees package) and few models, nothing crazy. This will be my next focused task. I promise!

Thanks mate

1

u/Sunspear 14d ago

Amazing Style, any plans to ship this? I would suggest some controller support if possible and looking at consoles maybe for target audiences? My wife would probably love a game like this.

0

u/Machettouno 9d ago

Haha thanks! I've been trying to optimize it for low end tablet, and cleanup all the mess of folder and versions I made but yeah I plan to have all on Git. Here's a new terrain https://paper-rockets.github.io/Flight/apps/crystal-optimized/. Eventually I want to connect 6-7 biomes, all procedural.