Search Unity

[Tutorial] Binary Void PC/Mobile complete game, dev-dreaming and Q&A (beginner-friendly)

Discussion in 'Community Learning & Teaching' started by Siegewolf, May 17, 2019.

  1. Siegewolf

    Siegewolf

    Joined:
    Jun 15, 2018
    Posts:
    45


    So... what's Binary Void?

    Description in Unity Asset Store says it in full...

    https://assetstore.unity.com/packag...nary-void-pc-mobile-full-game-tutorial-137978

    ...but in short:

    Binary Void is complete project made for both desktop and mobile platforms, also meant to present and teach general principle of game development in Unity, accompanied with general and often necessary elements of game structure (such as, tweakable game settings, rebindable controls, saving data in files on disk, etc). It's a complete game that can be built and played as soon as it's imported in Unity, from title screen, main menu and intro, through out the level, all the way to outro and credits. Depending what platform game detects (PC or mobile) it will initiate possible performance optimizations, set particular difficulty and adequate control layout.

    This project can be viewed as gamer's way to present another gamer, how to make games in Unity. It's beginner-friendly straightforward, yet deep project, that could be ideal to those who are not sure where to start :)

    Binary Void documentation, written as one long walkthrough, focus on all aspects of the project, but with emphasis on the code. If design is... soul... of the game, then code is certainly it's brain. Coding is probably the hardest to overcome but essential in game development, thus the emphasis on it. Binary Void comes with quite a few algorithms written, that can serve for variety of game types, and not only to this specific arcade. Here are two examples (see 3rd post in the topic for more details):

    >> VIDEO 1 <<
    >> VIDEO 2 <<

    Binary Void is rounded construction with classic arcade pattern. Such as: title screen, intro, levels (where levels are often divided into the wholes, usually named as worlds), big finale and outro. It's meant to provide study of the whole for its pieces and the way those pieces are merged to work together in correct way, with ability to toy and experiment, while every aspect is covered by documentation rich in detail.

    And who's the guy behind all this?

    My name is Stefan and I am a long time gamer and for a while, game designer too. My history of gaming includes Commodore 64, Amiga and PC.

    As for game design... first rather ambitious fully open-source project, that I am involved with, is called -- Limit Load. Here are three action videos on this game:

    VIDEO 1

    VIDEO 2

    VIDEO 3


    It's an arcade flight game done on open-source 3D engine, and in spirit of games such as Wings and Strike Commander. In comparison to Binary Void project, Limit Load is certainly a bit more... well... ambitious and requires much more advanced designing/coding knowledge to understand. I am the main designer behind it (and a lot of other roles, artist, mixer, director, writer, high-level coder and more). If you compare Binary Void PDF-Walkthrough with the PDF mission design manual for Limit Load... you might find some resemblance in style :)

    Binary Void on the other hand, is Unity project done entirely by myself, including the whole mid-level code.

    At the end...

    That's it for now. Will get back later to write more about Binary Void tutorial, spiced with some dev-dreaming... unless sudden activity in this thread summons me, earlier.

    If you are interested to tag along with Binary Void, feel free to post in this topic any questions that you might have and you can also send me an email or perhaps even catch me at Unity Discord for a live chat. If you have some imaginative idea how to adapt/reshape Binary Void but have difficulties in doing it, feel free to ask me and I might be able to assist you :)
     
    Last edited: May 31, 2019
  2. Siegewolf

    Siegewolf

    Joined:
    Jun 15, 2018
    Posts:
    45
    With enough gaming experience, imagination, and enough tools within the framework, a designer can use and expend on almost any game concept or on a rare occasion come up with something entirely new. Advanced Invader's role-model is rather obvious -- Space Invaders. But while I was making the game, the ideas how to expend on the role-model just kept coming. For example, just adding mere jump ability was already shifting it away, opening new possibilities. Eventually I decided to add many elements from all sort of classic shoot 'em up games and that later turned Binary Void project into a sort of algorithm library for such type of games. To a designer these ideas should come naturally and in process, torture with temptation too! :)

    However, if one is only the game designer, getting the framework can be rather the big problem. In order to weave the game itself with its own ID, one needs to either make game's framework or have someone to make it according to the vision in question. This framework can be all visual, drag & drop (unlikely for a fresh start) or enough for much simpler level of coding, which may prove as the most efficient way in the long run. In Limit Load, part of its framework architecture is my design, but I didn't build any of it myself and that required frequent negotiation, tact and patience. My ideas were mostly approved so far, but on a few occasions I had to outrun the boot :D In Binary Void, since whole framework was done by myself, I had everything under strict control ready to improve/expend/change on heart's desire.

    It should be a good feel to any designer when he can finally attend to such fine details like, how enemies behave; how many hitpoints should some entity has, then factor of bullet penetration or critical spots; what's the good time for player's avatar to receive a permanent upgrade; from which direction at which time in the level should the trouble come; what options should be at player's disposal; measuring are those options gimmicks in particular situation or they really add to the gameplay; and so on and so forth. To me, these moments are like bearing the fruit of hard work. I guess it's no strange that rather long scene-part of Binary Void PDF-walkthrough (basically, part about development and design of the level) was the easiest for me to write and most fun to comment in the code.

    My gaming culture pattern is closely tied with PC gaming culture pattern. Thus I designed Binary Void from this cultural angle. I took care for game to follow good PC gaming traditions, despite I might have had opportunity to get away without some of them and spare myself from trouble. This pattern means for example, rebindable in-game controls and keyboard & mouse layout to be always taken in consideration, despite it might not be the best in some particular case; standard menu design is done with mouse pointer in mind; game files (such as config file) are orderly stored on the disk for player to backup or meddle with; joystick is required for any flight game! :p Couldn't resist on this one... I still wonder if that story about old DOS X-Wing game not letting anyone in unless it detected joystick, was an urban legend; and so on...
     
  3. Siegewolf

    Siegewolf

    Joined:
    Jun 15, 2018
    Posts:
    45
    Lets see why Binary Void can also serve as tutorial project for variety of game types, as well as pack of algorithms for arcade shoot 'em up games.

    With mix and matching the concepts from Binary Void, I can make games like platformer, a shooter, racer, etc and then all the variations... here are few examples:



    >> VIDEO 1 << (Click here to watch the video)


    This is basically Binary Void expended into platform-shooter that I needed several hours to make. I made it with a lot "dirty" code and I used just about any shortcut I had at my disposal, you know... the type of coding that will bite you in the rear sooner or later. Otherwise, I would need several days. But it serves well as demonstration of game's transformation :) Now to think about, I could have gone on and on and on and make one gigantic level, with little bit of Metroidvanie concepts in it, without introducing any new elements. Another good thing is that, for a mobile platform, Binary Void's flexible UI-based virtual joypad is more or less suitable for arcade games that don't require direct interaction in the game's world.

    Lets get now to something a little more advance:



    >>VIDEO 2 << (Click here to watch the video)


    This is project somewhat inspired by Limit Load. There are new elements in this example like radar or destruction. And it is also done in 3D. However, a lot of code and code-concepts for this project are copy-pasted from Binary Void. I needed about ~20 days to make it. I would probably need even less amount of time, if I didn't dive into detailed adaptation of some elements :) For example, that GSH-301 gun of player's jet, it could have been hard-coded to the jet in question -- just like HAM-1000 system is to Defender in Binary Void, but I made it to be object on its own, which opened me possibility to script just about any gun, so I added M61 Vulcan or DEFA-554. And now I can easily switch the guns to jets if I want to (by merely detach one subobject in prefab, and attach another).

    The fact that it is full 3D game and not 2D like Binary Void, is notable element but in case of this example it doesn't add much to the complexity of code. Still, in 3D there are quite a few concepts that one has to get acquainted with. In 3D, effects such as lighting, shaders, post-processing, will aid visual appeal a lot on their own if instructed correctly. Those clouds... nice example of what you can do with a texture made of just one filter in GIMP and then well placed normal map on top of it (basically 10 minutes job when you know the right formula).

    In the end, Binary Void should be able to teach principles for all of this and fire up imagination in process of doing so...
     
  4. Siegewolf

    Siegewolf

    Joined:
    Jun 15, 2018
    Posts:
    45
    If I was given a choice what level of programming to take upon myself, I would go for high-level one, just like in Limit Load. Let the engineers do mid-level and gods to do low-level. I am designer after all, but here I was, dabbling deep into mid-level, building myself framework for high-level code. High-level coding is when mid-level folks provide all the necessary tools and framework, for designer to weave the actual game in code.

    Scripting a level is rather interesting piece of work. I prefer "narrative" way of level design even in case of straightforward games like Binary Void. That often means, a level riddled with events and event triggers, that will all do something different. A sneaky bad surprise for a player, or perhaps the sudden drama, maybe a crossroad or unexpected reward... all will do. Having the tools for this type of level structure already implemented in Binary Void, is one of the reasons why I was able to turn it so fast into that platform-shooter, previously shown :)

    A level coroutine is a place where you can actually read the whole level in code, like a book. And assuming all tools (variables, functions, classes, etc) have the sane names, it's actually a very readable story. Here is an excerpt from Binary Void in-game level:

    * "[...]" this symbol means that I just skipped some code there to shorten this excerpt

    Code (CSharp):
    1. IEnumerator GameLevel()
    2. {
    3.     //Gravity of Binary Void
    4.     Physics2D.gravity = new Vector2(0f,-9.81f);
    5.     Physics.gravity = new Vector3(0f,-9.81f, 0f);
    6.  
    7.     //Standard minimum and maximum altitude that level lift can reach
    8.     float lowerHeight = -45.0f;
    9.     float upperHeight = -35.0f;
    10.  
    11.     [...]
    12.  
    13.     //A stylish pause
    14.     yield return new WaitForSeconds(1.0f);
    15.  
    16.     //Request to audio manager to play level music, no. 2 piece
    17.     am.AudioPlay(am.gameMusic[2], true);
    18.  
    19.     [...]
    20.  
    21.     //Rise the curtain, fade screen in
    22.     StartCoroutine(gm.FadeInRaw());
    23.  
    24.     //Stop progression of the level, until level lift that is carrying the
    25.     //player, reaches its upperHeight altitude
    26.     yield return StartCoroutine(
    27.         gm.LiftMove("up", lowerHeight, upperHeight, 240.0f, true));
    28.  
    29.     [...]
    30.  
    31.     //...and enable in-game HUD panel of UI level (a panel with score,
    32.     //hitpoints, lives, etc.)
    33.     gm.panelHudOne.SetActive(true);
    34.  
    35.     //And another pause.
    36.     yield return new WaitForSeconds(1.0f);
    37.  
    38.     //Tell game manager to give control to the player
    39.     gm.playerControlLevel = 0;
    40.  
    41.     //Stop progression of the level, until first enemy group is spawned
    42.     yield return StartCoroutine(sceneLevelTools.SpawnAlienGroup(
    43.         sceneLevelTools.alienDronePrefab, sceneLevelTools.alienDronePrefab,
    44.         sceneLevelTools.alienDronePrefab, sceneLevelTools.alienDronePrefab,
    45.         12, 8.0f, true, 0.2f, false, false, false));
    46.  
    47.     //Set time limit for this phase of the battle
    48.     float timeLimit = 60.0f;
    49.     //Add time to UI level component regarding timer
    50.     gm.textTime.GetComponent<TextTimer>().timeLeft = timeLimit;
    51.     //Enable UI level timer
    52.     gm.textTime.SetActive(true);
    53.  
    54.     //Until either all 48 enemies in the group are dead or time limit
    55.     //reaches zero, block any progression of the level
    56.     while(gm.enemyKilled < 48 && timeLimit > 0.0f)
    57.     {
    58.         timeLimit -= Time.deltaTime;
    59.         yield return null;
    60.     }
    61.  
    62.     //Disable UI level timer
    63.     gm.textTime.SetActive(false);
    64.     //Prepare crossroad variable
    65.     bool crossroad = false;
    66.  
    67.     //Since it was time limit that expired (considering that less than 48
    68.     //enemies were destroyed)...
    69.     if(gm.enemyKilled < 48)
    70.     {
    71.         //...tell all remaining enemies to retreat
    72.         gm.retreatAllEnemies = true;
    73.         //And another stylish pause!
    74.         yield return new WaitForSeconds(3.0f);
    75.         //Make sure that retreat orders are not active any more
    76.         gm.retreatAllEnemies = false;
    77.  
    78.         [...]
    79.  
    80.         //Begin cutscene by taking control away from player
    81.         gm.playerControlLevel = 1;
    82.  
    83.         //Make a cutscene dummy of enemy boss and have it move in
    84.         GameObject alienDestroyerDummy = Instantiate(
    85.             sceneLevelTools.alienDestroyerPrefab);
    86.        
    87.         [...]
    88.  
    89.         //Move player around a bit at random horizontal position
    90.         StartCoroutine(gm.PlayerAutopilot(
    91.             new Vector2(Random.Range(-35.0f, 35.0f), 0.0f), 2.0f));
    92.  
    93.         //One long stylish pause
    94.         yield return new WaitForSeconds(8.0f);
    95.  
    96.         //Flashbang!
    97.         gm.ScreenFlash(1.0f, 4.0f, 3.0f, 1.0f);
    98.  
    99.         //Stylish pause
    100.         yield return new WaitForSeconds(2.0f);
    101.  
    102.         //Since screen will still be white at this point, it is a good
    103.         //moment to remove boss dummy while player can't see that
    104.         Destroy(alienDestroyerDummy);
    105.  
    106.         //Pause still
    107.         yield return new WaitForSeconds(3.0f);
    108.  
    109.         //At this time, flash should be over and since cutscene is over as
    110.         //well, lets give back controls to the player
    111.         gm.playerControlLevel = 0;
    112.  
    113.     }
    114.     //...or if all enemies were dead...
    115.     else
    116.     {
    117.         //...set crossroad variable to true, we will need it to decide what
    118.         //is next to happen
    119.         crossroad = true;
    120.  
    121.         //Award player with generous amount of TP for destroying group one
    122.         //in time
    123.         gm.textLevelIntro.GetComponent<Text>().text =
    124.             "Destroyer alert avoided\n20000TP bonus";
    125.         gm.textLevelIntro.SetActive(true);
    126.         gm.newPoints += 20000;
    127.  
    128.         [...]
    129.  
    130.         //Direct a simple cutscene, like some time has passed and start by
    131.         //taking controls away from player
    132.         gm.playerControlLevel = 1;
    133.    
    134.         [...]
    135.  
    136.         //At the end of cutscene, make sure to return controls back to the
    137.         //player
    138.         gm.playerControlLevel = 0;
    139.     }
    140.  
    141.     [...]
    142. }
    The code can be even more like a book (or drama more accurately), if you have a sort of dialogue tree within the level. In Binary Void there is no such thing (unless you imaginatively use three level-UI info text components at your disposal), but if you want to check it how would that look like done entirely in the code, see example 2 in PDF Mission Design manual of Limit Load -- Colonel Arend and his F-16 fighter group in a airbase on Canary islands. Be warned that example is rather Spartan :)

    And this is domain of high-level coding. The good thing -- it's (often) easy and usually fun. The bad thing -- you are hard-limited with the tools at your disposal so if you find you need additional tool or two, to make your vision come true, then you either have to dive into mid-level again or... ask nicely (try with puppy eyes) your mid-level pal/colleague for it.