Search Unity

Decision based graphic novel game for Android

Discussion in 'Game Design' started by akarsif, Jan 22, 2020.

  1. akarsif

    akarsif

    Joined:
    Jan 22, 2020
    Posts:
    4
    I want to create a decision based graphic novel game for Android that will consist of UI buttons only. Like it will have hundreds of pages often decision based. So, my question is, do I implement each page in a new scene? Can a mobile device handle hundreds of scenes? Or do I use Screen Boxes / Frames and activate using a UI button in a single scene(or chapterw scenes)? Thanx in advance :)
     
  2. welby

    welby

    Joined:
    Mar 22, 2011
    Posts:
    549
    Sounds like all you'd need is a dynamic button scene that you can swap the Text in each one as you go.

    Should be pretty straightforward. I think there is another program called Twine out there that solely does this kind of choose your own adventure as well.
     
    akarsif likes this.
  3. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    1,331
    The size of an empty scene asset is 4000 bytes. If you examine the data inside the scene asset you can see it contains data for things like OcclusionCullingSettings, RenderSettings, LightmapSettings and NavMeshSettings, which are probably not useful for the game you're making. I'm guessing that hundreds of scenes would end up adding a couple of megabytes to the file size in total.

    This will be next to nothing compared to the hundreds of megabytes that all the art assets are going to take, and is definitely something that a mobile device can handle.

    Using scenes is probably a pretty good route to take in terms of workflow. To jump into a specific point in the novel all your would need to do is load up a specific scene and hit play. If you decide to use prefabs instead, then you'd want to create some custom editor tools to enable fast and easy play-testing.

    An irritating thing when using scenes is that you need to make sure to include all of them in the build settings or your level transitions will break. Writing code to automate this or at least detect broken level transitions would be a good idea when dealing with hundreds of levels.

    Another thing to consider when choosing how to partition your novel is smoothness of scene transitions. E.g. there's no easy way to instantiate large prefabs asynchronously as there is with scenes. If you split your prefabs into small enough chunks you might be able to instantiate them on-the-fly without any visible slowdowns though. Using a combination of scenes and small prefabs is also a valid strategy to consider.
     
    Last edited: Jan 27, 2020
    akarsif likes this.
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Another option is to use a single scene. This lets you do interesting transitions between pages, such as a page flipping animation or sliding the pages right to left. Use Addressables to store and load the images without having to keep them all in memory.
     
    akarsif likes this.
  5. akarsif

    akarsif

    Joined:
    Jan 22, 2020
    Posts:
    4
    Assuming each of my scene will contain some text, a rectangle - both combined as a prefab, a button for transition, sound effects, and finally a background artwork, may be 2 to 3 layers. Will this make the loading slower or will it be smooth?
     
  6. akarsif

    akarsif

    Joined:
    Jan 22, 2020
    Posts:
    4
    I haven't used addressable before. Like as much as I can guess, the assets for every page will be loaded and unloaded with the call of a function and that means the assets have to be stored in a separate folder or online or something like that? This seems an easy way but I actually haven't used them before and m pretty confused :(.
     
  7. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    1,331
    Scenes serialize a reference to prefabs and any field overrides (including the full transform state) so each separate one adds a little bit to file size but not much. All non-prefab GameObjects are fully serialized into the scene, so they take up much more space.

    The scene and prefabs can likely be loaded in a millisecond or two. Loading the texture is likely going to be the bottleneck no matter how you decide to pack your frame sequences, so you should look into optimizing that as much as possible.

    You probably don't need to include separate copies of your texts and buttons in every scene though. You can just instantiate your HUD from a prefab once (or load a scene additively) and make use of DontDestroyOnLoad to have it persist through scene transitions. This would reduce both loading times and file sizes. You'll just need a little code that handles instantiating the HUD if it doesn't exist yet no matter which scene you start the game from to enable faster testing in the editor.

    You should do some testing for yourself before committing to a certain approach. Do a couple of test scenes, see how the workflow feels, how smooth the transitions are and measure how it affects build sizes.

    Here's a video about Addressables. You can just install the Addressables package and play around with it to get a better feel for how it is used. Your files don't need to be online for it to work.

    You could just use the old and admittedly simpler Resources.Load approach, but Addressables have many benefits over it, so it is probably worth it to invest the time to learn the new system now.
     
    akarsif likes this.
  8. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    I just finished (or rather, made working) a dialogue system that loads text and responses from a JSON file. You could do the same with your novel: just have 1 scene, and load new JSON files for each of the "pages" of the novel. At first I loaded them with code from the Resource folder, but you can also hook them up with some Component that acceps a TextAsset:

    Code (CSharp):
    1. public TextAsset myTextAsset
    That means you could drop JSON files in GameObjects or ScriptableObjects. It took me a while to set up a Canvas that could properly position any number of buttons after instantiating them, but now I have a Canvas that can display whole dialogue trees when I feed it some JSON.

    I'm not concerned with application performance here, but with your personal sanity. Having hundreds of scenes sounds like a maintenance nightmare to me.
     
    akarsif likes this.
  9. akarsif

    akarsif

    Joined:
    Jan 22, 2020
    Posts:
    4
    Yes that will be a nightmare. That is why I was trying find out a simpler. I'd definitely look into the json feeding process to scenes. I have made a few games before though but this is a completely different approach. I was learning about the addressable though this seems to be easier than that.
     
  10. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Oh do also look into Scriptables, I completely forgot to mention them. They are templates for data that you define once, and then you can make a bunch of copies with their own individual data. For example I have a bunch of Scriptable "attacks" that each define some stats (damage, number of contact frames etc). My enemies read whatever Scriptables they have and Instantiate the appropriate projectile. If I ever want to tweak a damage number I just change the Scriptable's value. Saves me the trouble of rummaging through Prefabs.

    The only downside to the JSON method is that you can't easily hook up a GameObject. You CAN however make Scriptables that define a TextAsset as one of their properties. On the flipside, anything you pull from JSON will have a natural index, which is a nice property to have when you need to refer to a page number or something.

    Are you making a linear experience, or more of a choose-your-adventure book?