ios - Architecture of a SceneKit game, multiple view controllers for menu screens? -


i'm working on scenekit game using swift, , i'm thinking best way organize various screens/ states surrounding actual main game scene. have simple prototype consists of 3 states:

  • splash screen (choose game type) ->
  • game ->
  • game on screen (choose play again or return splash)

in prototype opted go uikit ui elements, rather spritekit overlay. although it's buttons @ moment, easy enough in spritekit, might in future want add sliders (eg options screen set control sensitivity etc), text entry etc, , end recreating great chunks of uikit.

so @ present, each of 3 scenes described above has own uiviewcontroller. splash , game viewcontrollers have own scnviews , scnscenes, , gameover modal displays on main game scene.

this structure isn't ideal, means main game scnscene gets reloaded whenever viewdidload of gameviewcontroller fires. main scnscene quite detailed takes few seconds load, , repeated cycles seems create memory issues. after 2 cycles of splash -> game -> gameover memory warning, , after third cycle xcode loses connection iphone (which seems, in experience, caused memory issues).

i have main gameviewcontroller loads reused assets once, still able segue between various menu screens.

so options here?

i thought perhaps have main gameviewcontroller controls loading , unloading of scenekit assets , has sole scnview. viewdidload method fired once, when app first starts. then, each of other views have minimal uiviewcontroller, presented modals on main gameviewcontroller, "overcurrentcontext" selected.

i wanted ask whether pattern sounds feasible, , how others organise scenekit games. i'm still quite new native ios development, i'm missing basic game design pattern.

my experience use of 1 gameviewcontroller (my current work mac os x: started a 'small' 3d game mainmenu/start screen, hud , 2 or 3 complete different 3d scenes - shall ported ios, too):

in last week tried asked for, use 1 gameviewcontroller "all" stuff - me seemed easy , "good" way - after lot of hours tricks i've learned last years not able reload load (or change) 3d scene (or not sprite kit scene hud) after scenekit scene loaded in single viewcontroller. maybe there difference between mac os x , ios tried in ios version , has same behavior.

what able do: can modify loaded 3d scene or change data in sprite kit hud etc., able use 1 3d scene add or show things when needed far tests here showed, need 1 viewcontroller show complete new different 3d scene or 2d/3d menus etc. post further experiences i'm step further. hope helps little.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -