Thanks for the code review Simulan! And also for downloading and running the sample, I think you may have been the only person to do this thus far, so I’m very appreciative 
The plan for the final version of this code is for it to be refactored how the community sees fit! Hence why I’m doing this on a forum, if I didn’t want this to conform to what the community likes I wouldn’t be posting. (In the end, as well, if we communally agree it’s better to package the samples alternatively I’m also up for the idea). I think once we see the final products however we’ll be in a better place to decide. Right now too early to scratch major plans just yet.
My own personal refactoring process is a bit unique, but I promise we can take all agreed-on opinions for the final code structure. It’s a bit of process though… I’ve got a lot to add before we can do the ‘final refactor’.
A few modules I have yet to add, that use a lot of the current code:
-
Multiplayer - the state of the scene is synced over the socket with a server. Players can join a server and chat with each other (with movement)
-
Other perspectives: I have 1st person, and top-down perspectives game samples as well in progress
-
Procedural world: All of the above I also intend to have a sample that shows how the world can be generated procedurally (with interior and exterior/terrain features)
*Alternate media: Some of the above samples should show better use of media (and just nicer media overall) but not such that it grows the media repo too much that it bloats the distro.
Not discouraged at all!!! A few messages up the thread we talked about how this is all code in ‘interim’ state. Things are broken up temporarily in an exaggerated state while we remove all the issues from the original Ralph sample.
Lots of references to lighting in you critique, so I just want to make sure I understand your feedback, so that it’s actionable enough for me to think in terms of code changes.
Here’s /all/ the lighting code I have right now. It was lifted directly from Ralph sample, and put into a method
def setupSimpleLighting(self, ambientLightLevel=.3, directionalLightLevel=1):
ambientLight = AmbientLight("ambientLight")
ambientLight.setColor((ambientLightLevel, ambientLightLevel, ambientLightLevel, 1))
directionalLight = DirectionalLight("directionalLight")
directionalLight.setDirection((-5, -5, -5))
directionalLight.setColor((directionalLightLevel, directionalLightLevel, directionalLightLevel, 1))
directionalLight.setSpecularColor((directionalLightLevel, directionalLightLevel, directionalLightLevel, 1))
render.setLight(render.attachNewNode(ambientLight))
render.setLight(render.attachNewNode(directionalLight))
return [ambientLight, directionalLight]
Are you recommending to remove this from the method and put it back into the main class? If so that’s possible! I do have 3 other samples using the method (hence why I broke it out) - and it’s easier to maintain code when there is a single copy of it.
I could copy/paste the code into each sample I’m working on but that forces me to copy/paste all refactoring and code changes to each codebase - as you can imagine that gets tedious!
Hence why I need to keep code segregated while building these samples. But happy to consider other approaches.
I think the best ‘happy medium’ as that once these samples are working we then re-combine these pieces in a way that fits best for the most ‘canonical’ type of sample. If that makes sense.
Please keep up all the great feedback 