Friday, March 27, 2020

Tutorial 1.1: Preppers - First tools needed


So… what exctly do you need for making a game? No hammer and nails, that’s for sure. I guess many roads lead to Rome, but in my case I bought a gun and panties, and asked a friend if he could drive me to the computer store. Asked him to keep waiting there, WITH A RUNNING ENGINE. When he asked "why?", I just said "you'll see", while grabbing the panties.

So, after almost kicking in the door (it automatically opened), I yelled: "Hand it all over scumbag! I know you have some VERY, expensive, Visual Studio under that D#mn counter!". "Wha-wha-what? Why?", the dude said, and for some reason he had that nervous grin on his face. "I SAID! give-me-all-your-Visual Studio, or Delphi, or whatever pricey programming stuff you got there! I need to make a game.". Dude started nervously stuttering again "W-wha-what?!". "Say "what" one more time! A GAME! For the PHONE!". "Bu-But sir", he began, "You don't need expensive Visual Studio or Delphi for that! I always make my games with Android Studio & LibGDX - and, why are you wearing panties sir?".

Did I know that panties were meant for covering your face, I'm not a damn bank robber! And how should I know about "LibGDX, or whatever it was called? Oh, and how the hell was I supposed to know you're not allowed to park a car in front of that shop. Friend got a fine, was pissed off, drove off, and I had to walk all the way home. In panties.

I should have googled first, because after 3 seconds I found out that, indeed, there is a free (open source) library called LibGX. Written for the Java platform, and focussing mainly on 2D/sprite games on mobile platforms like Android and iOS. Well, ok then. Instead of guns and panties, your groceries list should look like this:


·         Download “Android Studio”. Or Eclipse, if you prefer (or if you have an iPhone)
o   Already had Android Studio here, but had to update a dozen modules.
o   Which took a long time, so that’s why I wrote this bullshit story
o   You may need to download / update Java SDK as well
·         Go to the LibGDX website. It has a handy “Download Setup App” feature
o   This makes a project (folders & files) for you, and downloads the required LibGDX parts
·         Get a nice painting program.
o   I use an ancient (free) version of Paint Shop Pro. Still does a good job
·         Find yourself a phone (using Android here)
o   Note Android Studio has a proper Emulator as well, but at some point you want to see “the real thing”
o   Make sure your phone has “Developer mode” enabled, and USB debugging unlocked
o   Plenty of Youtube clips explaining how to
·         Later on, you probably need a microphone and some sound editor as well
o   Audacity is pretty simply and free
  
 
The setup phase is always a hassle. Android SDK and tools like Eclipse come in 100 different flavours and options. So expect wasting some time there. My beef was that LibGDX would keep saying "Build tools: 29.0.2" not found. And I could only see a (newer?) version 30 in Android Studio. Probably I missed something, but I had to download that specific version manually, rename the folder, put it in the right sub-folder, and so on. From my past experiences with Android and Eclipse, there was always something stinky with the paths.

But, please hammer through it, it will be worth it. Because once you're at that next step, you'll quickly get some satisfying results.


The LibGDX setup app generated a whole project / folder setup - including targets for iOS, Desktop and Android. Final step was the programming tool. What I didn't knew, is that Android Studio is actually a programming IDE as well, so you don't need Eclipse or Netbeans for programming.
Though... it will probably not help you very much building the code for iOS. Well, that's a concern for later, don't have Apples here anyway.

So you can import the code/project that the LibGDX setup tool just created, and then start programming (Java) within Android Studio. Neat.
 


Thursday, March 26, 2020

Tutorial 1.0: Briefing

To clarify the previous post a bit better, I’ve been making a 2D Android game (but it should be portable to iOS just as well). It’s quite different from Tower22 I’ve been trying to making for the past 10 years. For one thing, we’re doing it in Java, instead of old trusty Delphi. And yes, like most of you, I’m not exactly a big fan of Java. But difficult times ask for desperate measures.

Nor will it be high-end 3D graphics (though for today’s standards, T22 graphics is almost retro again). Not even re-inventing the entire wheel by making an engine from scratch. Nope, we’ll be using LibGDX, but more about that later.

The end-goal is just to make a simple but fun game that can run on a phone or tablet. By keeping it simple, I am hoping to involve the kids a little bit. Their attention span is 57 microseconds, so it can’t be too hard. I tried that before, but before showing even 1 pixel, dad was like “wait a minute (hour)… got to fix this first… hmm, that’s strange, why is not working?”.

I’ll try to keep each post small, doing 1 specific thing, though the code-blocks may make it seem long at times. Trying to post 1 or 2 articles each day, so, keep up the pace! Very soon I will explain how the game should look & play. But in more global terms, these would be the milestones:
1.       Basic engine (VERY basic, wrapper around some LibGDX parts)
2.       Making & flying over your first tile-based map
3.       Grabbing and throwing stuff
4.    Collision detection
5.       Adding foes & pathfinding
6.       Adding Sound
7.       Bonus items
8.       Making game-rules
9.       UI & menu’s

Or something like that. Again, at the time of writing, I’m somewhere at point #3. Thus, not that far. But as long as I don’t get sick (or if the virus is suddenly over, and we can all start drinking beer together again), I’m pretty confident we can get very far here.

With the lack of real LibGDX experience, forgive me if some of the tactics or code will change over time. Basically this is just an invitation into my way of “doing this”. Meant for those who are interested in making a 2D or LibGDX based game, but can use a helping hand. I DO assume you have a somewhat proper knowledge of either Java or C++ - I'll be showing a lot of code, but not explain "how to program". Unless it's a very complicated piece of code, but in general I'd like to keep it simple. I'm good at that, playing dumb.

Have fun & stay healthy.

Corona crisis: Learn how to make a 2D phone game

Hey fellow caged animals. Say, who is fucking bored here? Raise your hands. 1,2,3, 7 billion. Well I'm not. No thanks to a bunch of annoying kids that still think they deserve a long vacation instead of home-teaching. But thanks to an old Android phone I have here, and LibGDX.

So stop wasting your time. Stop trying teaching those kids, you’ll be dead in two months anyway, old fart with a programmer diet of hamburgers and cola. Stop sporting, you’ll be back up-to weight within no-time after the crisis. They call that “Jo-Jo” effect. Stop pretending you’re having fun in the garden. You only make things worse at the neighbours, where the wife starts bossing around her poor husband, giving choirs. Stop working @home. Your business will be bankrupt within the next 2 months, and you won’t get paid then.

Instead, follow me. Learn a bit of Java, learn a bit about GDX, and let’s make a silly game for the telephone. So you can give that to your bored kids, and be a real hero for one day. In fact, you may actually put those lazy assholes to work. Drawing sprites, recording sound effects, beta-testing. That kind of work.

The next few-dozen-or-so articles will show you how I’m making a simple phone game. Step by step, including all code. Disclaimer. I never made a phone game before, and zero experience with LibGDX. So who knows where this will end. Maybe I’ll get sick, maybe the code is broken as hell. Second disclaimer: yes Tower22 is alive. But I’ll get back on that in better times.

No, the game certainly isn't finished while I'm writing this, but let's just say I'm a couple of "lessons" forward. Just showing a bit of what you can expect after following the first bunch of tutorials.