Arranging Controller, Scenes & Views Structure

Dear all,

I'm new in coding, for maybe the fifth time :), and I hope I find the right words.

Right now I'm prototyping a 3D game with scenekit for IOS devices. At the moment the prototyp of the MainScene.scn (the first game scene) is ready. The 3D objects are located in the assetcatalog, and the game behavior with object movements, gyro data, 3D Text and so on, is codet in the GameViewController.swift.

Now I’m at a point where I think I can do many things wrong, at the cost of days, weeks or months of work, to reconstruct my app, afterwards.

So I want to understand, what's the „sexiest“ way to structure my project Scenes, Views, Controller, etc.

Simplified, my game will have a user interface to store the name, change gameplay setting and so on, and it will have multiple 3D scenes where the game takes place.

At first I thought, it would be a good idea to arrange multiple scenes, all controlled by the GameViewController, due to not having to duplify recurring methods or so. But as I thought of, I saw a GameViewController file bigger and bigger and I had the fear to more and more loosing the focus the more scenes I added.

The thought of multiple Controller for each or a fiew Scenes are not as „****“ too, because by changes on a recurring method, I maybe have to change it for every Controller.

I then thought of instancing the GameViewController but in no case I had the feeling „that’s the way to go“.

So long things short: How would you arrange a game project like this?

Thank you in advance, Ray

At first I thought, it would be a good idea to arrange multiple scenes, all controlled by the GameViewController, due to not having to duplicate recurring methods or so. But as I thought of, I saw a GameViewController file bigger and bigger and I had the fear to more and more loosing the focus the more scenes I added.

It depends how similar are the functions in your scenes.

But you can declare the function at the top level (outside any class) and call them from Views. Doing so, GameController will just segue to the appropriate View.

Or you could put the fund in a 'Utils' class (maybe as static function) and call Utils.theFunc (if static) or create a Utils instance (utils: Utils) in each Scene (which will allow to adapt some properties) and call utils.myFunc.

Hard to say more without knowing more on your code.

Thank You for Your reply. I try to structure my Project as You suggested. One GameViewController to manage the different Scenes.

Arranging Controller, Scenes & Views Structure
 
 
Q