27 votes

Programming Challenge: Make a game in 1 hour!

Background

There's been some talk on ~ before, and it seems like there are quite a few people who are either interested in, learning, or working in game development, so I thought this could be a fun programming challenge.

This one is fairly open-ended: make a game in 1 hour. Any game, any engine, don't worry about art or sound or anything.

Doing is the best way to learn. Most people's first project is something overly ambitious, and when they find that it's more difficult than they thought, they can get discouraged, or even give up entirely. This is why the 1 hour limit is important: it forces you to finish something, even if it's small. When you're done, you can come out of it saying you made a game, and you learned from it.

Chances are the game might not be fun, look bad, be buggy, etc. But don't worry about that, everyone's game will have problems, and if you do create something really fun or innovative, congratulations, you have a prototype that you can expand on later!

"Rules"

Like I said before, these "rules" are pretty simple: make a game in (approximately) 1 hour. You can use any tools you want. If you use external assets (art, sound), it's probably best you use something you have the rights to (see resources). If you're completely new to game development/programming, your goal could even be to finish a tutorial.

If you're the kind of person who tends to get carried away with these things, you might want to post a comment saying you're starting, then another one once you've finished your game.

Please share your finished game, I'm sure everyone would love to try them! If your game is web-based, it can be hosted for free on Github Pages or Itch.io. If downloadable, it can be hosted for free on Google Drive, Mega, Dropbox, Itch.io, etc.

Resources

Engines

If you're a beginner, a good engine to start with is LÖVE. It's very simple, and uses Lua, which is very easy to learn.

If you're familiar with another language, you could use a library to make it in that language. Some examples:

C++: SFML, SDL, Allegro

Javascript: kontra, Phaser, pixi.js

Python: pygame

Rust: Piston, ggez, Amethyst

If you want something more complex, consider Godot, Unity, or Unreal.

You can also try something visual like Construct, Clickteam Fusion, or GDevelop

Art

For such a short time constraint, I'd suggest you use your own "programmer art": just use some basic shapes. Your primary focus should be gameplay.

If you think you have time to find something, try looking on OpenGameArt.

Sound

You can make simple sound effects very quickly with sfxr (or in this case, a web port of sfxr called jsfxr).

33 comments

  1. [2]
    Akir
    Link
    Having to learn the language would be a real barrier to making a game in just one hour....

    If you're a beginner, a good engine to start with is LÖVE. It's very simple, and uses Lua, which is very easy to learn.

    Having to learn the language would be a real barrier to making a game in just one hour....

    14 votes
    1. what
      (edited )
      Link Parent
      Very good point, that was aimed more at programmers who are beginner game developers. For non-programmers, one of the visual engines (Construct, Clickteam Fusion, GDevelop) are what I would recommend.

      Very good point, that was aimed more at programmers who are beginner game developers.

      For non-programmers, one of the visual engines (Construct, Clickteam Fusion, GDevelop) are what I would recommend.

      6 votes
  2. [3]
    Zeph
    Link
    This came at a really bad time but I figured staying up for an extra hour wouldn't do much harm. It's playable in the browser here on itch.io with source available. Depending on your cookie...

    This came at a really bad time but I figured staying up for an extra hour wouldn't do much harm.

    It's playable in the browser here on itch.io with source available. Depending on your cookie settings the game may not load (seems to be an issue with itch.io) so I uploaded a download for the HTML build as well if you want to run it locally.

    You won't be able to play it on a mobile device due to control scheme stuffs.

    I had an issue with this bug using the latest godot build https://github.com/godotengine/godot/issues/21072 which I found out after my hour was up, so I spent some time figuring out what was wrong, reverting to 3.0 stable, and fixing the project.godot config version (just change it from 4 to 3) so that I could export it

    10 votes
    1. [2]
      what
      Link Parent
      I like it, it's feels like the beginning of a bullet hell game. Adding the score, health and difficulty makes it pretty fun to keep playing and trying to get a higher score :) Just wondering, what...

      I like it, it's feels like the beginning of a bullet hell game. Adding the score, health and difficulty makes it pretty fun to keep playing and trying to get a higher score :)

      Just wondering, what exactly does difficulty do? I assume it increases enemy speed?

      3 votes
      1. Zeph
        Link Parent
        It's very rough, first time I ever made anything in an hour. It's quite liberating really, it gives you very little excuse to put it off. Difficulty affects how quickly enemies spawn. At 100% it's...

        It's very rough, first time I ever made anything in an hour. It's quite liberating really, it gives you very little excuse to put it off.

        Difficulty affects how quickly enemies spawn. At 100% it's random between 2 and 3 enemies per second I think, at 200% it would spawn between 4 and 6 enemies per second. Every 60 seconds you survive is 100% more difficulty.

        You get 1 score per second and 10 score per enemy killed. My best was about 2k score at 240% difficulty by abusing the left/right warps to keep bullets circling as a shield above me.

        4 votes
  3. [5]
    Mallard
    (edited )
    Link
    Okay, let's do this. Although I'm not the most experienced with p5.js, it's going to be my choice with such a short time frame. I don't know whether to include initial thinking time within the...

    Okay, let's do this.

    Although I'm not the most experienced with p5.js, it's going to be my choice with such a short time frame.

    I don't know whether to include initial thinking time within the hour, but I guess I'll decide that at the 59 minute mark.

    Here it is: https://thimbleprojects.org/mallard/535395/

    Instructions:

    --Select a mode using the keys at the bottom of the screen (or LEFT and RIGHT arrow keys to cycle through).
    -- Click tiles to create a chain of numbers that match your selected mode.
    -- Press ENTER to score your chain.
    -- Chains are valid if every tile in the chain has a neighbour also in the chain. Each tile has 4 neighbours: up, down, left and right. Chains must have at least 3 tiles.
    --The first 3 tiles in a chain are worth 100 points, then each extra tile is worth 100 than the previous, e.g. A chain of 7 is worth 100 + 100 + 100 + 200 + 300 +400 + 500 = 1700 points.

    So that was a little intense. I'm really proud of it. Game design is flawed because a chain of even numbers is likely to be rather large - I'd have liked to have solved this before submitting, as well as the weird score text bug, but the time was up. I also wanted to add 'gravity' when tiles are deleted, but that quickly got cut due to time.

    Took me a bit longer than expected to get setup (and I've been doing a lot of python recently so that kept creeping in), but once I was off I had good pace. I thought checking for valid chains would be rather 'heavy' to do, but it turned to be pretty simple, and I'm really happy with the implementation. (Just noticed that the logic for the chains is flawed too. Oh dear.)

    Thanks for the challenge.

    9 votes
    1. Mallard
      Link Parent
      Gulp. Got to upload it to...somewhere.

      1 hour, 44 minutes ago

      Gulp. Got to upload it to...somewhere.

      3 votes
    2. [3]
      frickindeal
      Link Parent
      I have to admit a bit of ignorance here. What are squares? Numbers that are the square of another number, I assume? Because I had some in my puzzle, but not enough to make a chain. Seems like it...

      I have to admit a bit of ignorance here. What are squares? Numbers that are the square of another number, I assume? Because I had some in my puzzle, but not enough to make a chain.

      Seems like it could make a neat little mobile time-waster with a few tweaks. Why no "odds"?

      2 votes
      1. [2]
        Mallard
        Link Parent
        Thanks for checking it out. Squares are the square numbers: 1, 4, 9, 16 and 25. No odds because I feel that would be too straight-forward. The primes cover a good portion of the odds and requires...

        Thanks for checking it out.

        Squares are the square numbers: 1, 4, 9, 16 and 25.

        No odds because I feel that would be too straight-forward. The primes cover a good portion of the odds and requires a touch more brain power.

        Tweaks I would have liked to have is gravity, and/or pre-made levels that are completely solvable, instead of random values.

        1 vote
        1. frickindeal
          Link Parent
          Yeah, that's what I thought. Played a few more times after that comment and found some "square" chains. Gravity, as in the tiles slide down as you remove chains? That could lead to interesting...

          Yeah, that's what I thought. Played a few more times after that comment and found some "square" chains.

          Gravity, as in the tiles slide down as you remove chains? That could lead to interesting strategies. You seriously might be on to something here. Solvable levels would become more difficult with gravity, but as long as there's one solution, it's solvable. This would (possibly) do well as a mobile game with those tweaks.

          1 vote
  4. [2]
    Comment deleted by author
    Link
    1. what
      Link Parent
      I've been trying to get more familiar with Rust, this looks like a great example to read!

      I've been trying to get more familiar with Rust, this looks like a great example to read!

      2 votes
  5. [5]
    Comment deleted by author
    Link
    1. [2]
      what
      Link Parent
      That's why this is such a good challenge - you don't have time for extensive planning and organization. Your only goal is to finish something in an hour, with your sole priority being gameplay....

      That's why this is such a good challenge - you don't have time for extensive planning and organization. Your only goal is to finish something in an hour, with your sole priority being gameplay. The code will likely be ugly, buggy, and incomplete. If you want to expand on what you made later, by all means clean up your code, plan it out better, etc. But if you take a long time to plan and organize, it'll be more difficult to get started, and therefor easier to put off. By giving yourself a fairly extreme limit, you're forcing yourself to complete something.

      1 vote
      1. [2]
        Comment deleted by author
        Link Parent
        1. Zeph
          Link Parent
          You can think up any ideas before you start your one hour session. I went in to it at 3 am with no plans, just knew I wanted to shoot something and there should be no end. You just need to...

          You can think up any ideas before you start your one hour session. I went in to it at 3 am with no plans, just knew I wanted to shoot something and there should be no end. You just need to constrain your expectations and realise that in 1 hour you will have finished something that probably isn't even fun to play and that you will never look at again.

          1 hour just isn't a lot of time, but the more familiar are with your tools and the more you get used to this super quick prototype development the more you can get done in that hour and the more creative you can be during that time.

          1 vote
    2. s4b3r6
      Link Parent
      That's where the challenge was for me. I usually program in a notebook. I write out, rewrite and rewrite, and only once happy with structure and API do I begin to implement it with a machine. With...

      That's where the challenge was for me.

      I usually program in a notebook. I write out, rewrite and rewrite, and only once happy with structure and API do I begin to implement it with a machine.

      With only 1 hour... You don't have time to care if it's a reprehensible mess of structure. It's write and run and hope it works.

      If a potential employer saw my code in this thread, I'd be embarrassed. It's not good code. But it does work, and it did take an hour.

      1 vote
    3. teaearlgraycold
      Link Parent
      If you're already familiar with a framework (LOVE, Unity, etc.) then some of the organization is already decided for you so you can save a lot of start up time.

      If you're already familiar with a framework (LOVE, Unity, etc.) then some of the organization is already decided for you so you can save a lot of start up time.

      1 vote
  6. [7]
    s4b3r6
    Link
    I tend to get carried away. But, I'm on a train with only a cheap phone, and only busybox (and vi) available... So this is my intent: a simple text based game written in shell. Start the stopwatch.

    I tend to get carried away. But, I'm on a train with only a cheap phone, and only busybox (and vi) available...

    So this is my intent: a simple text based game written in shell.

    Start the stopwatch.

    3 votes
    1. [6]
      s4b3r6
      Link Parent
      My hands are screwing up. I'll have to continue later. But, for my first 15mins: #!/bin/sh intro() { echo 'The sun sets.' echo 'The hero rises.' echo 'Do you deserve the title?' echo '' echo...

      My hands are screwing up. I'll have to continue later. But, for my first 15mins:

      #!/bin/sh
      
      intro() {
        echo 'The sun sets.'
        echo 'The hero rises.'
        echo 'Do you deserve the title?'
        echo ''
        echo 'Loading...'
        sleep 5s
        clear
      }
      
      # Actions:
      # Attack
      # Defend
      # Run
      
      check_gt() {
        echo "$1 > $2" | bc
      }
      
      inc() {
        echo "$1 + 1" | bc
      }
      
      player_attack='1'
      player_defend='1'
      
      intro
      while true; do
        echo 'You can:'
        echo '1. Attack'
        echo '2. Defend'
        echo '3. Run'
        while [ -z "$action" ]; do
        read -p 'Do) ' action
        case "$action" in
          [1]*) echo 'Attack!'; break;;
          [2]*) echo 'Defend!'; break;;
          [3]*) echo 'Run!'; break;;
          [Qq]*) echo 'Quit.'; exit 0; break;;
          *) action=''; read -p 'Do) ' action; break;;
        esac
        done
        echo "You chose: $action"
        action=''
      done
      
      5 votes
      1. [2]
        Soptik
        Link Parent
        echo 'Loading...' sleep 5s This is great :-)
        echo 'Loading...' 
        sleep 5s
        

        This is great :-)

        9 votes
        1. edenist
          Link Parent
          Haha reading it took me back to my high-school days writing ti-83 programs for people. The more slee.. err.., 'loading' you put in the more super-complex-computations were taking place.

          Haha reading it took me back to my high-school days writing ti-83 programs for people. The more slee.. err.., 'loading' you put in the more super-complex-computations were taking place.

          3 votes
      2. [3]
        s4b3r6
        (edited )
        Link Parent
        Final version! Video Demo. Time taken: 15min on a tiny phone in termux with vi. 30min with voice control on a laptop (And no matter what the creator thinks, FreeSpeech is nowhere near as good as...

        Final version!

        Video Demo.

        Time taken: 15min on a tiny phone in termux with vi. 30min with voice control on a laptop (And no matter what the creator thinks, FreeSpeech is nowhere near as good as Dragon).

        #!/bin/sh
        
        intro() {
          echo 'The sun sets.'
          echo 'The hero rises.'
          echo 'Do you deserve the title?'
          echo ''
          echo 'Loading...'
          sleep 5s
          clear
        }
        
        # Actions:
        # Attack
        # Defend
        # Run
        
        check_gt() {
          echo "$1 > $2" | bc
        }
        
        inc() {
          echo "$1 + 1" | bc
        }
        
        gen_bad_intro() {
          rand_num=$(shuf -i 1-5 -n 1)
          case "$rand_num" in
            [1]*) echo -n 'A large troll ';;
            [2]*) echo -n 'A small goblin ';;
            [3]*) echo -n 'An armoured ork ';;
            [4]*) echo -n 'A vicious elf ';;
            [5]*) echo -n 'A dangerous human ';;
          esac
          rand_num=$(shuf -i 1-5 -n 1)
          case "$rand_num" in
            [1]*) echo 'saunters in front of you.';;
            [2]*) echo 'comes screaming towards you!';;
            [3]*) echo 'drops out of the trees.';;
            [4]*) echo 'rises up out of some nearby mud.';;
            [5]*) echo 'roars loud enough to shake the ground.';;
          esac
        }
        
        gen_bad_value() {
          shuf -i 1-$(echo "$1 * 2" | bc) -n 1
        }
        
        player_attack='1'
        player_defend='1'
        player_gold='0'
        
        clear
        intro
        while true; do
          clear
          gen_bad_intro
          echo 'You can:'
          echo '1. Attack'
          echo '2. Defend'
          echo '3. Run'
          echo "Player: A$player_attack D$player_defend G$player_gold"
          while [ -z "$action" ]; do
          read -p 'Do) ' action
          case "$action" in
            [1]*) echo 'Attack!'; break;;
            [Aa]*) echo 'Attack!'; break;;
            [2]*) echo 'Defend!'; break;;
            [Dd]*) echo 'Defend!'; break;;
            [3]*) echo 'Run!'; break;;
            [Rr]*) echo 'Run!'; break;;
            [Qq]*) echo 'Quit.'; exit 0; break;;
            *) action='';
          esac
          done
          echo "You chose: $action"
          bad_attack=$(gen_bad_value "$player_attack")
          bad_defend=$(gen_bad_value "$player_defend")
          case "$action" in
            [1]*) if [ $(check_gt "$player_attack" "$bad_defend") = '0' ]; then echo 'You slew it!'; player_attack=$(inc "$player_attack"); player_gold=$(inc "$player_gold"); else echo 'The creature beat you to a pulp.'; fi;;
            [Aa]*) if [ $(check_gt "$player_attack" "$bad_defend") = '0' ]; then echo 'You slew it!'; player_attack=$(inc "$player_attack"); player_gold=$(inc "$player_gold"); else echo 'The creature beat you to a pulp.'; fi;;
            [2]*) if [ $(check_gt "$player_defend" "$bad_attack") = '0' ]; then echo 'You survived it!'; player_defend=$(inc "$player_defend"); player_gold=$(inc "$player_gold"); else echo 'The creature beat you to a pulp.'; fi;;
            [Dd]*) if [ $(check_gt "$player_defend" "$bad_attack") = '0' ]; then echo 'You survived it!'; player_defend=$(inc "$player_defend"); player_gold=$(inc "$player_gold"); else echo 'The creature beat you to a pulp.'; fi;;
            [3]*) if [ $(shuf -i 1-2 -n 1) = '1' ]; then echo 'You escaped!'; player_gold=$(inc "$player_gold"); else echo 'The creature beat you to a pulp.'; fi;;
            [Rr]*) if [ $(shuf -i 1-2 -n 1) = '1' ]; then echo 'You escaped!'; player_gold=$(inc "$player_gold"); else echo 'The creature beat you to a pulp.'; fi;;
          esac
          sleep 3s
          action=''
        done
        

        Edit: bugfix. New video demo with asciinema.

        It's a tiny silly game, but fun for about 30s.

        5 votes
        1. [2]
          what
          Link Parent
          Nice, this is actually a pretty cool concept! I imagine it would work well as one of those little infinite mobile games where you see how far you can get.

          Nice, this is actually a pretty cool concept! I imagine it would work well as one of those little infinite mobile games where you see how far you can get.

          1 vote
          1. s4b3r6
            Link Parent
            Add graphics, upgrades, and more responses, and you might be able to get some people to sink some time into it.

            Add graphics, upgrades, and more responses, and you might be able to get some people to sink some time into it.

            2 votes
  7. [6]
    mrbig
    Link
    Cool. Do you have any suggestions for text-based games?

    Cool. Do you have any suggestions for text-based games?

    2 votes
    1. teaearlgraycold
      (edited )
      Link Parent
      Most of what these libraries handle is the asynchronous behavior of a GUI program, abstracting over controls and graphics APIs, and maybe providing you with some pre-written physics code. None of...

      Most of what these libraries handle is the asynchronous behavior of a GUI program, abstracting over controls and graphics APIs, and maybe providing you with some pre-written physics code. None of that is necessary in a text-base game. You should be able to write a text-based CLI game using nothing but a programming language's standard library.

      8 votes
    2. what
      (edited )
      Link Parent
      Assuming you mean suggestions for engines, Twine is very popular and easy-to-use. Ren'py is another popular one, it uses Python, although it’s more visual novel-oriented.

      Assuming you mean suggestions for engines, Twine is very popular and easy-to-use.

      Ren'py is another popular one, it uses Python, although it’s more visual novel-oriented.

      4 votes
    3. Hypersapien
      Link Parent
      It's been a while since I've seriously been into IF, but I think TADS has a pretty good engine. I don't know if there's anything newer.

      It's been a while since I've seriously been into IF, but I think TADS has a pretty good engine. I don't know if there's anything newer.

      1 vote
    4. s4b3r6
      Link Parent
      If you're not looking for things to be happening when the player is idle, then any language will do. On Windows, you have ol' batch, and Powershell available without installing anything. On MacOS,...

      If you're not looking for things to be happening when the player is idle, then any language will do.

      On Windows, you have ol' batch, and Powershell available without installing anything.

      On MacOS, you probably have outdated Python 2, AppleScript, ol' shell (what I used), and a slight improvement on shell called Bash available without installing anything.

      On Linux you have shell, probably Bash, probably a Python (2 or 3, depending on the distribution), and maybe some harder languages too. (Like Awk. You could use it, but that would require an understanding most people don't have.)

      A bunch of languages can be installed on any of those, so that your game will run on all of them. Powershell and Python are examples of that, and simple languages.

      The basic idea is, give some output, and then ask the player to respond, and then act on it.

      Examples

      Windows Batch:

      Copy the below into a text file, and rename the extension to .bat

      @echo off
      REM The above line hides the commands being run.
      REM And lines starting like this one are comments.
      set /p name="What is your name? "
      REM The above line stores a variable into name
      echo Hello %name%
      REM And now we're outputting both the word Hello and the name variable
      

      Now, I haven't covered flow control, how you jump to different places in the program, because it is... Painful. But easy to discover.

      Powershell

      Copy the below into a text file, and rename the extension to .ps

      # This is a comment
      Write-Host "This is how you output text!"
      $name = Read-Host "This is how you get input: "
      if($name -eq "s4b3r6") {
        Write-Host "Really? That's my name!"
      } else {
        Write-Host "Hello, " $name "!"
      }
      

      There are plenty of resources to help learning Powershell, but the above is a nice little taste.

      Python:

      # This makes it compatible to take input in both 2 & 3
      # i.e. renames v2's raw_input, which works the same was as v3's input
      try:
          input = raw_input
      except NameError:
          pass
      
      # This is a comment
      print("Hello, World!")
      print("Who are you?")
      x = input("> ")
      # Comparison is simple.
      if x == "s4b3r6":
          print("Hey! That's my name!")
      else:
          # The braces will get replaced thanks to adding the .format command.
          print("Hello {}".format(x))
      

      Though there are major differences between Python 2 & 3, this should run in both. (Well, only Python 2.7 and above, but that seems good enough for this example.)


      For shell, look to my 1hr game.

      1 vote
    5. mrbig
      Link Parent
      I knew about Twine, but AFAIK I have to use Javascript to extend it, and I have no interest in this language. I didn't know about Ren'Py, but it looks like a great platform, and I really like...

      I knew about Twine, but AFAIK I have to use Javascript to extend it, and I have no interest in this language. I didn't know about Ren'Py, but it looks like a great platform, and I really like Python. Thanks!

  8. [5]
    temporalarcheologist
    Link
    how do i get LÖVE? I added the repo and did sudo apt-get update but I'm not seeing it in my list

    how do i get LÖVE? I added the repo and did sudo apt-get update but I'm not seeing it in my list

    1. [4]
      s4b3r6
      Link Parent
      It should just be: sudo apt install love

      It should just be:

      sudo apt install love
      
      3 votes
      1. [3]
        temporalarcheologist
        Link Parent
        thank you!

        thank you!

        4 votes
        1. [2]
          s4b3r6
          Link Parent
          Running should then be love FOLDER So if you're in the folder: love . Or if you're not, it might look like: love /home/me/games/livegame You could also zip the folder, rename to .love instead of...

          Running should then be love FOLDER

          So if you're in the folder: love .

          Or if you're not, it might look like: love /home/me/games/livegame

          You could also zip the folder, rename to .love instead of .zip, and then double-clicking will run the game.

          2 votes