Boredom and gamedev
I spent the previous ten days on vacation. Usually, I try to go off once or twice a year to somewhere where I can just passively relax - usually, it is some sea resort. This year I decided to go to the Republic of Türkiye and spend my time at the beach without any major attractions. The problem is - I get bored pretty quickly and my brain wants to do something.
I took with me my trusty Nintendo 2DS in case I have an urge to spend some time looking at the screen and to get myself occupied on the plane, and a phone with some books to read while I’m lying on the beach. However, my phone is also my computer, and I do a lot of coding on it in my spare time, usually when I don’t have access to a proper PC.
The last time I went on such a vacation I got so bored, that I decided that I wanted to do some game dev, and started a personal game dev marathon. Originally, I planned to start once I got back from vacation, but I was so eager that I started early, while I was still at the beach. The marathon was a crunch, and I had mixed feelings about it in the end, which ultimately led to burnout, and I put the idea of making games on the shelf for a while. And while the last time I started doing this I only drew some sprites, the only reason for that was that I couldn’t get any game engine on my phone. This time around, I got so bored that I started programming a game while gradually getting sunburns and taking breaks to go and actually swim in the sea.
Making games on Android
Basically, if the only thing you have is a phone you have two main options - TIC-80 and löve2d. tic has everything you need - an integrated code editor, a sprite editor, a map editor, and even a sound editor if you’re that versatile. however, the experience of using TIC for doing everything is not great, especially on the phone. I mean, that’s what you have to deal with:
Not a lot of screen space to view the code, the keyboard is abysmal, and the editor experience itself has a lot to be desired. Yes, it is authentic, I get it, it’s just not what I’m personally after.
On PC you can actually get a PRO version of TIC-80, which allows you to write a game in an external editor, and load it into the engine.
Technically, you could do the same on Android, but there’s a problem - I use Android 14, which has storage restrictions for apps.
And TIC-80 can’t access anything except files in its directory stored at /sdcard/Android/data/com.nesbox.tic80/
.
Which can’t be accessed directly on the phone either - you need a PC to access it.
So even if you have a separate text editor, you can’t do your game development with TIC on Android.
Moreover, you can’t even get your game out of the engine unless you have a PC at hand.
The other option, as I said, is LÖVE2D.
It has the same problem as TIC, as you can’t launch the game from anywhere but /sdcard/Android/data/org.love2d.android/
, however, newer versions have a separate dedicated launcher, that can load .love
files from anywhere on the filesystem, which is good enough.
Alternatively, an older version, like 11.3 can be installed that bypasses the sandboxing restrictions.
So that was the route I took.
Making games on Android with LÖVE
I have little experience with LÖVE2D. Previously, I did a bunch of tests with it and made a few demos like the one described in my raymarching post, or the F.A.B.R.I.K. algorithm I implemented back in the day. So nothing major. The raymarching demo barely runs on a PC, and there’s no way to control it on the phone without connecting a gamepad. Unfortunately, I had no gamepad with me this time, so if I wanted to make a game on the phone I had to implement one myself. Fortunately, I have a lot of experience playing games with the on-screen gamepad, so I’m at least well accustomed to the idea.
I had no idea how to interact with the touch screen though, so I found a drop-in gamepad implementation for LÖVE2D in the game-tools repository:
Still, I wanted this gamepad to be a bit more advanced, with analog stick imitation, and more buttons, so I ported it to Fennel first and then extended it with more features:
It has all of the buttons of a modern controller, so I could share the control scheme between the on-screen gamepad and a real gamepad.
I do understand that the on-screen gamepad should, ideally, be tailored around a game, but this will suffice for now.
It was fun to implement this too, and I found a small bug in the lovepad.lua
file, while I was porting it.
Next, I added the bump.lua library for basic physics (because I don’t want to deal with box2d yet), and made a simple player controller:
As you can see, I’m using Emacs on the phone, with the Google Keyboard set to PC QWERTY layout - a neat feature. This is my phone setup for programming, and I’m actually using the same configuration as on my regular PC.
After adding a camera library from the author of bump.lua
, here’s what the player controller looks like at the moment:
I want to tweak this player-controller a bit further, making it more fleshed out, but as you can see it already handles a few things:
- Direction facing is tracked based on horizontal velocity
- Jumping
- Holding the jump button longer increases the jump height
- Bumping against a ceiling resets the vertical velocity
- Crouching and crawling
- When crouched, the player’s height is reduced, and when crawling the width is increased
- When crawling into a narrow space, the player changes to the crouched state if no direction input is given.
- The camera follows the player
- Camera pans in the direction of movement, showing more of the upcoming level
- Vertical position only changes when the player is grounded, or when the vertical position is lower than the original camera position
I still need to tweak various speed values and add more movement options like dashing, sliding, etc., but it already feels gameish.
Writing a player controller was the most challenging thing before when I made the first demo game in the marathon. I made this one similar to the previous one, as can be seen in further GAME1 demos, but it’s a complete rewrite, as I wanted to make it differently this time. We’ll see how it evolves over time.
Drawing
While I didn’t draw anything for this game, I have a few updates on how I approach drawing on the phone. In short, I ditched the PixelStudio I’ve talked about in the first post about GAME1 mainly because its UX doesn’t work for me personally. It’s still a good app for pixel art, I just don’t like how it works, and it lacks some features I’d like to have.
Fortunately, there exists a better option - Krita which has a port for Android that doesn’t compromise any features, so you get a full Krita experience. It’s probably better suited for Android tablets, but works well enough for me on the phone. I’m slowly learning pixel art, and here’s a timelapse of me drawing a tree on my phone:
I made a few mistakes when using various tools, as I was not well accustomed to Krita’s toolset back then.
Here’s the final result after a bit of refinement:
This isn’t a drawing for the game I’m making, just a sketch, following the principles outlined in this amazing video by Brandon James Greer. But one thing that makes a difference when making games for LÖVE2D and not for TIC-80 is the unrestricted palette. It’s still better to restrict the palette when making pixel art, but using only 16 colors for the entirety of game graphics is too restrictive for me. Especially right now.
One thing I haven’t tried yet is animating. PixelStudio had a decent animation pipeline, and it was possible to export the animation as a sprite-sheet. Still need to experience this in Krita - I know it has animation capabilities, but I’m not sure if they’ll be comfortable to use on the phone or not.
I’ll be making more pixel art for this game I’m making in the future, so I’ll post actual images once I have anything more to share!