While trying to create an FPS I have many problems on how my code is going to be structured.
I try to split most things in ES6 classes and it seems that I can’t figure out many things.
Like I don’t know how am I supposed to connect classes and mostly important how to update things through classes the various classes to show the appropriate results in the scene.
Any suggestions for codebases to look at ? Mostly JS(and even BabylonJS) preferred so it will be easily transferable.
[EDIT] The code of my current project looks like this :
So please if anyone who is experienced can give some pointers, cause I think I’m getting into a rabbit hole cause already I want to implement simple animations for the gun and don’t know how to do it properly if the gun belongs to the player class but the shooting is happening using the engine class and all that is getting too confusing for me. The result is this game which works perfectly as of now but I’m getting demotivated cause I want to add more things and it seems kinda scary.
[EDIT] It took me a long time to think of the answers everyone provided in the comments and I have to say that indeed there is no size fits all in this case. But every comment had something to provide in the grand scheme of things.
I guess I go by feel right now and implement first in a way that comes to me naturally even though it’s gonna look a bit stupid but will work. I’m a beginner so probably I will have time for all of this when I’m more experienced.
Thanks everyone but I hope there will come some tutorials about making a game with babylonjs with nice code design that will serve as a reference for other devs.