Switching to Digital Ocean

I’ve been hosting this web site prairiewest.net on a “reseller” package from a large hosting provider for many years. The hosting was easy to use not because of the provider but because of cPanel. It was a nice step up in 2008 to switch from a bare metal LAMP server to a VM with cPanel, mostly because it automated some of the things that I found tedious at the time.

With ease of use, however, comes additional cost, and my hosting costs have been rising steadily for a number of years. I started with this provider in November 2008, and now 14 years later in November 2022 I’ve switched again. I kind of felt like switching banks: you know it’s going to be painful, but sometimes the pain is worth it.

I’ve been very nicely surprised that Digital Ocean droplets are easy to spin up, easy to monitor, easy to backup, and easy to manage. Overall, for someone with even moderate technical knowledge, droplets are just as powerful as a VM from anywhere else without some of the management headaches. They have been a joy to use so far, and have instantly cut my hosting costs in half.

I’m very happy that I switched to Digital Ocean. I’m only sightly disappointed in myself for not switching sooner, but inertia and the perceived work of switching held me back. Yes I did switch from a “fully managed” hosting provider to what I would call “mostly self-managed” hosting with Digital Ocean, but for the small amount of time I needed to set things up it was definitely worth it.

If you’re thinking of switching to Digital Ocean, use my referral code and we’ll both earn free credits: https://m.do.co/c/5fb5a316732c

Corona SDK Emitter Fireworks

After the launch of Hexium in December 2018 I have been adding more levels in patch releases, but finally after 80 levels I decided the next release would be the last to add new levels. My final level, level 85, would be the end game screen, congratulating the player on finishing the game.

I wanted a “fireworks” effect on the end game screen. Although I’ve been using Corona SDK for a few years I had never touched emitters, and this seemed like a perfect fit for them. After reading the docs on creating emitters I saw that they could be completely defined by a block of JSON, which would make it easy to reuse the fireworks display code to spawn multiple types of effects.

I created a simple mask for the first emitter using an image editing program (Adobe Fireworks – how appropriate!) and then created the JSON to define the emitter. The code to spawn a new emitter is easy, so my new effect was on screen almost immediately. The next hour was spent changing the parameters and reloading the scene until I was happy with the effect.

Next I created two more emitter masks, two more emitter JSON definitions, and then created a table to hold all of the emitters. Here is the final result:

You can download all of the code from Github here: https://github.com/prairiewest/corona-fireworks All of the content in this project were either created by me or has an open license (which I have included in the licenses folder), so you’re allowed to reuse as much of it as you want.

If you’re working on a game using Corona SDK please send me a message on Twitter, I’d like to see it: @toddtrann

Remember to Cancel Timers When App Is In The Background

I had been working on my latest mobile game Hexium for quite a few months, and it was time to put it into the hands of some testers.  Everything seemed to be going well, but then one of the testers said that their Android phone was giving them a warning about it consuming too much battery power when it was in the background.  I had never seen this warning myself, despite already testing the app on a few Android devices of my own.  He showed me the screen, and sure enough the warning was on screen and looking fairly scary.  As an end user, my first instinct on seeing a warning like that for a casual game would be to simply uninstall the app.  This was bad.

I looked over my code and didn’t see anything that could be causing the problem.  I went to the Corona Labs web site and found this excellent article on performance and optimization.  However after implementing all of the tips, the tester was still receiving the warning.

Then I found it: a timer.  I had a timer that was firing every second while the game was running, to check to see if the user had earned a free life.  Of course this timer didn’t need to run while the app was in the background.  So I added some code to catch the applicationSuspended event and cancel the timer, and gave the updated build to the tester.

Success!! Android no longer complained about the app using battery while in the background!

Here is a block of code that contains just enough to show you what events were caught, and how I stopped and restarted the timer:

local free_life_timer

local onSystem = function(event)
    if event.type == "applicationExit" then
        -- Cancel the free life timer
        if free_life_timer ~= nil then
            timer.cancel(free_life_timer)
        end

    elseif event.type == "applicationSuspend" then
        -- Cancel the free life timer
        if free_life_timer ~= nil then
            timer.cancel(free_life_timer)
        end

    elseif event.type == "applicationResume" then
        - Start a new free life timer
        free_life_timer = timer.performWithDelay(1000, function()
            update_free_lives()
        end, 0)
    end
end

function scene:show( event )
    local phase = event.phase

    if ( phase == "will" ) then
        -- setup a system event listener
        Runtime:addEventListener( "system", onSystem )
        
    elseif ( phase == "did" ) then
        -- Start the free life timer
        free_life_timer = timer.performWithDelay(1000, function()
            update_free_lives()
        end, 0)
	end

end


function scene:hide( event )
    local phase = event.phase

    if ( phase == "will" ) then
        -- Cancel the free life timer
        timer.cancel(free_life_timer)
        Runtime:removeEventListener( "system", onSystem )
    end
end

Latest Game Jam

Another game jam!  After participating in the MeatlyJam in 2015, I recently created an itch.io account so I could enter the CoronaDefold Jam.  I detailed the development process of Asteroid Blaster in the game devlog, which you can read here:

https://prairiewest.itch.io/asteroid-blaster/devlog/10821/day-1-exploring

Voting is on now, but after looking at the other entries I don’t think my game is going to win any prizes. No matter, it was fun to enter and interesting to blog about the whole thing.  I’m still making small changes to the game, and trying to decide if I should continue working on it, or wrap it up and move on.

2017: Year of Technical Debt Remediation

Over the holidays at the end of 2016 I looked back over the catalog of mobile apps that I developed and made the decision to spend some time bringing old apps up to date.  For some of them, the platform I used for development had changed a lot since the app was last recompiled, including the discontinuation of some plugins that were being used.  For others, they were missing screenshots for the new iPads, and it was only a matter of time before Apple’s quality assurance program caught up with them.

The first apps to benefit from updating are Spiky Swim and MMXLVIII.  These apps both used the old Corona SDK AdMob ad plugin and needed to be updated in order to keep serving ads.  So with Spiky Swim I pushed out a new feature, and with MMXLVII I gave players 3 extra bombs – both incentive for people to update their apps.

The rest of the apps will be updated as time allows.  It feels good to update the apps and make sure that they’re all still working for users on their current devices.

Importing Photos Into Windows 8

Microsoft changed the default photo importer in Windows 8, and I don’t like the new one.  It’s tied into the new Photos app, and it tries to make things easy – unfortunately, it also removes some important options.

To restore the previous behaviour and get the Windows 7 import options back, do the following steps:

  • Go to the Windows 8 start menu and type: cmd
  • When the app with the black box icon comes up, right-click it and select “Run as Administrator”

windows8_command

  • In the command prompt window, type:
    cd “C:\Program Files\Windows Photo Viewer”
  • Press enter
  • Type: regsvr32 PhotoAcq.dll
  • Press enter
  • Type: regsvr32 PhotoViewer.dll
  • Press enter

Close the command prompt window.  Now when you connect your camera, you should have a new option “Import pictures and videos (Windows)” Select that one.  Then when you see this dialog box, select “more options”:

windows8import_1

That will bring up the settings window as desired:

windows8import_2 If nothing happened, or if the wrong program started when the camera was connected to the computer, then you will need to go into the Control Panel and change the autoplay settings for that device.

First Game Jam in 20 Years

The last time I participated in a game jam was a couple of decades ago. Yes, literally 20 years ago in 1995. When I saw the announcement of the MeatlyJam I was interested and I decided almost immediately that I was going to be part of it.  It then took me 2 more days to commit to that decision and send in my registration. 🙂

The file of art assets was released before the game jam started, but I didn’t have any time to play around with it.  I looked at it and tried to get an idea for a game, but nothing was coming to me.  When the jam started on Friday morning I was at work, so I couldn’t start on it until later that night.  Then when I did start, I knew I wasn’t going to have the full weekend to work on it, so I truly needed to keep it simple. I didn’t want this to happen:

simple

Continue reading

Relearning Game Development

I first started programming in 1983 (read about my programming history here).  I don’t remember what I programmed on the Ti-99/4a, but I do remember one of my first programs on the VIC-20 was flying birds program, straight from the book that came with it:vic_20_flying_birdsIt wasn’t long after that when I started making games.  Sadly, none of them have survived my various moves across the country, however my friends still remember playing the games that I made – they were pretty fun for the time.

Continue reading

Influencing Viral

I’m a software developer.  I make mobile games, among other things.  I’m also a Dad to two teenage children.  The combination of the two leads me to watching what they’re doing with their mobile phones.

Back when the indie game “Threes” came out I bought a copy and played it.  I didn’t mention the game to my kids, but not too long after I saw my older daughter playing “2048”, so I said:

“Oh, I see you playing 2048.  That’s really just a copy of another game called Threes.  Do you want to play that?”

“Uh… OK.  I’ll try it.”

Continue reading