{"id":1370,"date":"2020-05-14T15:30:33","date_gmt":"2020-05-14T06:30:33","guid":{"rendered":"https:\/\/www.munchou.com\/biwa-chan\/?p=1370"},"modified":"2020-05-14T15:32:47","modified_gmt":"2020-05-14T06:32:47","slug":"my-first-game-in-unity-part1-total-beginner-hello","status":"publish","type":"post","link":"https:\/\/www.munchou.com\/biwa-chan\/?p=1370","title":{"rendered":"My first game in Unity part1 &#8211; Total beginner, hello!"},"content":{"rendered":"<p><strong>Good day!<\/strong><\/p>\n<p>That&#8217;s something I&#8217;ve been wanting to do for years, but never really took the time for it. I did something yeaaaaars ago (with the old 2D program RPG Maker and also another that was called &#8211; I believe &#8211; &#8220;Game Maker&#8221;, also all in 2D and where coding was not mandatory &#8211; and I had actually created a cool small game that got lost a long time ago).<\/p>\n<p>In the recent years, Unreal Engine and Unity both became free, whereas the business model was way different not that long ago. And without a sack full of gold or mortgaging your 3 hearts and 5 livers, only big companies could afford them. But now that it has changed, anyone can get to it!<\/p>\n<p>So I decided to learn how to use Unity and make my first little game out of it.<\/p>\n<p><strong>Why Unity?<\/strong><br \/>Well, there is no GOOD reason about it, as I&#8217;m not the pro-[insert-a-brand-here] type, but I&#8217;d say that I got marked by the general opinion that is &#8220;Unreal Engine for AAA, Unit for small\/indie games&#8221;. Which is not false, as the most famous games were made within the UE (I got the first <em>Crysis<\/em> in mind, but there is the <em>Unreal Tournament<\/em> series, <em>Deus Ex<\/em>, <em>Bioshock<\/em>, <em>Injustice: Gods among us<\/em>, the <em>Gears of War<\/em> series, etc.OK, not <em>Grand Theft Auto<\/em>, but hey, that&#8217;s Rockstar!<br \/>Also, I sometimes play (and quickly get bored) on my tablet, and so many games are made with Unity! So obviously, it sends the message &#8220;look, Unity is super simple if you want to make your own mobile game and get dirty rich fast!&#8221;. Riiiight&#8230;<br \/>One more point: I saw on the web some stuff like &#8220;you can make a game with Unity without coding even ONE line&#8221;.<\/p>\n<p><strong>How I started<\/strong><br \/>I downloaded Unity a few years ago on my desktop PC, but because I got extremely-super-duper-over-9000 busy in rebuilding our house, I didn&#8217;t have space for myself to set it properly, nor enough free time. So just recently, because I bought a second-hand laptop, I thought &#8220;hey, why not download Unity again and see if it runs on that machine?&#8221;.<br \/>No, it&#8217;s not a monster, quite the opposite! It&#8217;s an i3-6100 with 8GB and Intel HD Graphics 520 (17 inches), running on Windows 10 Pro (and its unbearable auto-updates come ooooon!!!). So far, the worst has been the HDD that is way too slow (or old, or both). Probably a lack of RAM too, especially with Firefox using so much, what a pain, really&#8230; I think I&#8217;ll look into it seriously.<br \/>Anyway, I&#8217;m not going to complain about an 80-buck PC. :)<\/p>\n<p>Surprisingly, Unity works like a charm! Although whenever I open it\/load a project, it takes&#8230; time. So that&#8217;s great, because I still haven&#8217;t finished the room where I plan to put my desktop.<br \/>One thing that I must precise, so that you can understand why I can handle it &#8220;smoothly&#8221; from the beginning, is that I have used Cinema 4D for years (it&#8217;s a 3D modeling program like Maya, Blender, 3DSMax). As a hobby, but it doesn&#8217;t change the fact that I am familiar with that type of interface. So when I launched Unity, I wasn&#8217;t lost at all. I directly held the Alt key and the mouse buttons to see if I could navigate in the display windows &#8211; and it worked! I then reinstalled Cinema 4D to see if it would run too, because I didn&#8217;t want to waste my time if in the end I couldn&#8217;t make 3D objects to import in Unity on that laptop. Fortunately, it works fine.<\/p>\n<p><strong>What I want to make<\/strong><br \/>Last month, I played and &#8220;beat&#8221; <em>Prime Peak<\/em>, a simple yet fun game. I&#8217;m not sure what type it is, a sort of hill-climb racing game? It&#8217;s in 3D but using the 2D physics, which means that the environment and vehicles are in 3D, but the car moves on the xy axis only (left-right-up-down), like a lot of Nintendo games since the Wii (Mario, Donkey Kong, Kirby&#8230;). We can gather coins (money to upgrade the car or buy a new vehicle) and must get to gas tank refills before running out of gas, in order to reach the finish line. It&#8217;s a simple concept, and that&#8217;s not the only game of that kind, but it&#8217;s the only one that has &#8211; and that&#8217;s only MY opinion &#8211; good physics and pleasant graphics.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1373 aligncenter\" src=\"https:\/\/www.munchou.com\/biwa-chan\/wp-content\/uploads\/2020\/05\/PrimePeaksGooglePlay.png\" alt=\"\" width=\"398\" height=\"224\" srcset=\"https:\/\/www.munchou.com\/biwa-chan\/wp-content\/uploads\/2020\/05\/PrimePeaksGooglePlay.png 398w, https:\/\/www.munchou.com\/biwa-chan\/wp-content\/uploads\/2020\/05\/PrimePeaksGooglePlay-300x169.png 300w\" sizes=\"(max-width: 398px) 100vw, 398px\" \/><\/p>\n<p>In order to learn, what&#8217;s better than making something inspired from a creation that one enjoyed? Of course, I&#8217;ve got plenty of ideas, but one&#8217;s got to start somewhere, right? And because that sort of game has a very limited gameplay (not in a negative way), I thought it&#8217;d be less complicated than directly starting with a 3D platformer.<\/p>\n<p><strong>First steps in Unity<\/strong><br \/>Soon after having opened Unity and clicked on buttons here and there, I started looking for cars tutorial. I started with one based on 3D physics (such as <em>Gran Turismo<\/em>, <em>Forza<\/em>, etc.: an environment like ours), using a box as the main part of the car, and 4 cylinders for the wheels. Nothing fancy, but at least it was moving accordingly, although it was not very satisfying. I&#8217;ll talk about it another time, but setting the wheels colliders is absolutely not user-friendly. Many people on the web are complaining about that, stating that there doesn&#8217;t seem to be any logic behind all the parameters, and indeed it is hard to find how they are all affected by each other.<br \/>One important thing I want to point out: I wrote, as a possible reason to use Unity rather than another engine, that &#8220;you can make a game with Unity without coding even ONE line&#8221;. I didn&#8217;t look into that, as for me I don&#8217;t think it is possible to create a proper game without coding, and I didn&#8217;t jump into that new world thinking that I&#8217;d want to avoid writing code. Anyhow, even by using a specific UI that allows one to create things without coding (I don&#8217;t know how that&#8217;s called yet, but I&#8217;ve seen screenshots), there is code behind that.<br \/>So I directly started typing in C# (pronounce &#8220;C sharp&#8221;, yeah&#8230; figures&#8230;), of which I knew NOTHING. Like, what the fuck is that stuff? I&#8217;m still thinking that, by the way. I had seen other languages, and always wondered the logic behind them, as they don&#8217;t seem logical to me. After having started &#8220;learning&#8221; C#, I&#8217;m still thinking that it lacks of logic, but it&#8217;s way too early for me to talk about that, I&#8217;ll probably talk about it once I have understood it well.<\/p>\n<p>My ugly car somehow moving, I then replaced it with a model I created in 2007 for the game <em>Trackmania United<\/em>, a Peugeot 504 Rally. I&#8217;m glad I kept the model, and the import as a FBX file worked pretty neatly.<br \/>I wanted it to move only on the xy axis. I edited the code to deactivate the front wheels rotation, and found the way to have the car not to move on the z axis, which in other terms means that the car cannot rotate on the y nor the x axis, and cannot move along the z axis. Which gives the feeling that it is a 2D gameplay, with 3D physics.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1378\" src=\"https:\/\/www.munchou.com\/biwa-chan\/wp-content\/uploads\/2020\/05\/20200514a.png\" alt=\"\" width=\"390\" height=\"480\" srcset=\"https:\/\/www.munchou.com\/biwa-chan\/wp-content\/uploads\/2020\/05\/20200514a.png 390w, https:\/\/www.munchou.com\/biwa-chan\/wp-content\/uploads\/2020\/05\/20200514a-244x300.png 244w\" sizes=\"(max-width: 390px) 100vw, 390px\" \/><br \/>You&#8217;ll have perhaps noticed that what I checked doesn&#8217;t match what I wrote above. That&#8217;s because the axis on my car are oriented the &#8220;Unity way&#8221;, as there is no way to edit them. And when creating the wheel colliders, the orientation has to suit the engine, or else the wheels will rotate along the wrong axis. A bit crazy for a 2020 software. So in my case, the x and z axis were switched, which doesn&#8217;t change anything about the principle, it&#8217;s simply relative.<\/p>\n<p>It wasn&#8217;t too bad, but far from satisfactory, the car&#8217;s behavior not being what one would expect. I didn&#8217;t bother too much, as I learned a few things, and decided to move on the 2D physics, to see how different it&#8217;d be.<\/p>\n<p>One last thing before going: I was super disappointed to see that the collision boxes, called &#8220;Box\/Mesh\/etc. Collider&#8221; depending on your use, are still made that way and extremely limited in polygons count. That&#8217;s the green lines you can see all around the car, and they are used to &#8220;calculate&#8221; the physical limits of the objects. Why am I disappointed, you ask? Because that was the exact same thing more than 10 years ago! (for example I witnessed it in <em>Trackmania United<\/em>)<br \/>In 2020, I was really expecting huge improvements about collision detection on a polygonal level, and reading excuses such as &#8220;a more detailed collision mesh will decrease performance&#8221; is a total no-no to me.<\/p>\n<p style=\"text-align: right;\">To be continued in the next post<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good day! That&#8217;s something I&#8217;ve been wanting to do for years, but never really took the time for it. I did something yeaaaaars ago (with the old 2D program RPG Maker and also another that was called &#8211; I believe &#8211; &#8220;Game Maker&#8221;, also all in 2D and where coding was not mandatory &#8211; and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1387,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[],"_links":{"self":[{"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/posts\/1370"}],"collection":[{"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1370"}],"version-history":[{"count":12,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions"}],"predecessor-version":[{"id":1384,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions\/1384"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=\/wp\/v2\/media\/1387"}],"wp:attachment":[{"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.munchou.com\/biwa-chan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}