The Crawl - A dungeon crawling platformer

(Andy) #1

The Crawl is a dungeon crawling platformer in which you have to find a path that allows you to discover enough keys to make it to the exit.

Screenshot1 Screenshot2 Screenshot3

It’s my first game for the wonderful Arduboy, so I’d love any feedback people have!

(Simon) #2

Looks great. Did you do the graphics yourself?

Will you be linking to the code as well?

(Andy) #3

Thanks! Yes I did the whole lot myself. It’s not the most impressive of games, but I’m hoping that it has a nice feel to it. I have edited the original post to include a link to the source code.

I should add that I’m not a programmer and the code is dreadful!

(Simon) #4

Yes it does have a nice feel to it and you can always extend it / add features.

(Jean Charles Lebeau) #5

Seems very good :wink: Gratz. It’s your first game on Arduboy … So it’s really a good for us :wink:

(Scott) #6

You could reduce code size, and make the game more “Arduboy compliant”, by switching from using Arduino tone() to using the ArduboyTones library or the Beep classes included in the Arduboy2 library.

(Andy) #7

Thanks for the advice. I have no idea what I’m doing with sound, I just added it right at the last minute.

The whole game is way bigger in code than it needs to be, I got very sloppy.

(Pharap) #8

Do you have a GitHub or GitLab account that you could host the code and .hex on?

(Andy) #9

@Pharap I’ll have to look into that. I don’t know much about GitHub.

(Pharap) #10

It’s a source code/git repository hosting website.

It takes a bit of getting used to because it has some very complex features,
but even if you don’t use the more complex features it’s good for hosting source code and uploading precompiled .hex files as releases.

It also has stuff like issue tracking and ‘pull requests’, which allow other people to suggest improvements/changes (though you can disable that if you want).

Here’s an example of one of my games on GitHub:

And the releases page:

There are similar websites like GitLab,
but I think GitHub is the more common website.

Once you get used to using them,
the extra features come in really handy and make code management much easier.

(Andy) #11

Many thanks, I’ll look into GitHub. I have another (non-Arduboy) coding project on the go which I guess would benefit from it.

(Andy) #12

So I’ve now got my head around the basics of GitHub, so have updated my original post to link to a release page for The Crawl :slight_smile:

(Pharap) #13

That was quick. Good work.

Now I see your source I have a few things I’d like to point out.

You’re not supposed to include .cpp files because it can upset the compiler.
See this StackOverflow question for more details:

It probably seems a bit odd if you aren’t used to C++,
but when you realise that #include basically does a copy and paste instead of something more intelligent and that .cpp files are compiled regardless of whether they are included, it makes sense why including .cpp files would cause errors (by breaking the ‘one definition’ rule).

Most people use && instead of and and || instead of or.
and and or only exist for historical reasons (specifically for keyboards that didn’t have a & or | key).

You don’t need your buttonA or buttonA variables, Arduboy2 has a justPressed function (though you must remember to call arduboy.pollButtons(); once each frame for it to work).

One or two of your functions are lacking their void return type.
(I think it’s just Level::Update and Level::Draw.)

And if you’re passing string literals directly to print, wrap them in the F macro.
The F macro puts the string in progmem and uses the overload of print that can print strings that are stored in progmem.

There’s probably various other improvements that can be made, but those are the most glaring ones.

One last thing, I see you’re doing posX >> 8 and posY >> 8 and * 256 (which is actually equivalent to << 8),
does that mean you’re using fixed points for coordinates?

(Scott) #14

For your GitHub repository, I suggest you create a folder named TheCrawl (same as the .ino file but without the .ino extension) and move (only) the files required to compile the game (TheCrawl.ino, *.h, *.cpp) into it. This makes it easy to put the game into an Arduino sketch folder by just copying or moving the TheCrawl folder there.

You can leave everything else the way it is, although I’d consider renaming the Source folder to something like Assets. Source usually implies source code to be compiled by the Arduino system.


This is a nice game :+1:

(Andy) #16

@Pharap Wow that’s some great feedback, thanks very much! I wasn’t going to do any more with this project as I have other stuff I want to work on, but I may use it to familiarise myself with the better practices that you suggest.

@MLXXXp Thanks for the organisational advice! I have now reorganised my repository to match your tips :slight_smile:

@EyeBall Thanks! Glad you like it!

(Scott) #17

You should move the Assets folder out of the TheCrawl folder, back to the root. Arduino doesn’t need those assets to compile the game.

(Scott) #18

The game doesn’t compile under Linux. Linux file names are case dependent.

You have to change line 6 in TheCrawl.ino:

#include "pitches.h"


#include "Pitches.h"

(Scott) #19


Your code generates a large number of warnings when compiled with verbose output turned on. You may wish to examine these warnings to determine if any would actually cause problems.

In the IDE, select:
File > Preferences

then set
Show verbose output during: ☑ compilaton

then click on OK at the bottom right of the window.