MicroTD - Tower Defense for Arduboy

Ooooh, okay, will change it then :slight_smile:

I know, it has to be clear just from the fact you can use C++ keywords as identifiers in C :slight_smile:

+1, will do.

Every time I used plain arduboy.print("abc") the RAM usage report increased by a significant amount. Will have to investigate this.


Not the same, it simply stupidly overflows. It’s good to fit into 80 columns when you have multiple windows side-by-side. Even if there’s only one file, I typically have it open at multiple places.

Fair enough - m is shorter and helps fit into 80 columns :slight_smile:

I think tabs are evil (better not ask why here) :smiley: Again, it’s a religion war. As long as you’re the only one working on the code it doesn’t matter because others can simply search-replace with spaces, but when it comes to collaboration, there can be real wars about tabs vs spaces.

Fun fact (don’t take too seriously please): Stack Overflow found out that on average you earn more when using spaces. Then again, you almost certainly earn more money by programming than me. With certainty I can say you don’t earn less than me. (Okay, let me say it: I make $0 from programming.)

Will take your advice into account and probably push 1.1 before midnight.

1 Like

That was meant to be C isn’t a subset of C++.

There’s a lot more impactful things than just that though.
Cases where programs are valid in both but behave differently.
(For example, in C++ 'a' is a char, but in C 'a' is an int.)

Hrm, good point. (It’s been a while since I’ve used bare strings on the Arduboy.)
Most likely the RAM is statically allocated then.
So I suppose technically they’re more like function-local static variables, in which case they’d be instantiated on the first time the function is called.

I often have things side by side, but my screen is wide enough to manage more than 80 columns per half.
The ‘80 columns’ rule is archaic, and by archaic I mean punch-card level archaic.

I’ve heard every argument anyway, none of them have convinced me.

Most people here use spaces because they dont know how to make the ArduinoIDE use tabs. :P

@filmote and I have managed not to have a war over it… somehow.

I’ve heard that one before.
Incidentally the highest paid programming jobs are usually maintaining decade old systems (or they’re at Google).
COBOL programmers are surprisingly well paid.

I don’t make $, I earn £. :P

That said, I don’t get paid to program.
I’m still technically an amateur.

1 Like

Units only matter with non-zero numbers, we don’t have $ here either - I don’t know how to type euro of pound :smiley: Might as well have used Japanese Yen.

TBH that’s why I like it probably, I have a thing for these good old times :smiley:

I don’t use computers at all. It’s hard to find a job that aligns with my views :frowning:

Usually lower salary == more passion :slight_smile:

Type into a search engine “euro sign”, find wikipedia article, copy, paste. :P

The British keyboard layout is handy, the euro sign is altgr+4, like so: €.

I like the yen sign.

Have you considered using punch cards instead of the terminal? :P

Can’t say I have that problem.

My problem is a mixture of poor location for programming jobs and oversaturation of people wanting ‘apps’ for phones and tablets or webdev stuff - trendy stuff, the things I’m not skilled at and don’t enjoy.

Not if I want to afford a tiny, overpriced house some day.
Property developers have ruined Britain’s property market.
(Amusing reddit link full of moaning Brits: here.)

Type into a search engine “euro sign”, find wikipedia article, copy, paste. :stuck_out_tongue:

That’s what I do, but mostly too lazy. There’s also a super useful site where you draw a symbol and it recognizes which UTF character that is (the inventor of that should get a medal).

Have you considered using punch cards instead of the terminal? :stuck_out_tongue:

Might get there :smiley: Sometimes I’m getting so filled up with tech I’m thinking to going pen and paper only, no kidding.

My problem is a mixture of poor location for programming jobs and oversaturation of people wanting ‘apps’ for phones and tablets or webdev stuff - trendy stuff, the things I’m not skilled at and don’t enjoy.

Actually my main problem is I have kind of mental issues, huge anxiety (Ergophobia - yes, I’m lazy too, but this is an extra stuff), which cuts off 99% jobs for me.

I totally understand why you don’t want to do “apps and webdev”. No one could make me do that.

Property developers have ruined Britain’s property market.

I’ve seen a documentary on London luxury basements. Basically square met(er|re)s are so ridiculously expensive people start building downwards into the Earth.

What a great game! I’ve added this to my list of favorite Arduboy games!


Thank you @crait, it means a lot :slight_smile:


This game looks like fun, but for some reason i can’t compile it :confused:
the error i receive is

WARNING: Category 'Sensor' in library DallasTemperature is not valid. Setting to 'Uncategorized'
microtd:185: error: 'BeepPin1' does not name a type

 BeepPin1 beep1;


C:\Users\Sander\Desktop\Arduboy_TD-master\microtd\microtd.ino: In function 'void playSound(IndexPointer)':

microtd:192: error: 'beep1' was not declared in this scope



C:\Users\Sander\Desktop\Arduboy_TD-master\microtd\microtd.ino: In function 'void setup()':

microtd:2661: error: 'beep1' was not declared in this scope



C:\Users\Sander\Desktop\Arduboy_TD-master\microtd\microtd.ino: In function 'void loop()':

microtd:2691: error: 'beep1' was not declared in this scope



exit status 1
'BeepPin1' does not name a type
1 Like

Weird, what OS is that? Do you have the latest versions of the Arduboy libraries?

There is a precompiled hex file that could be uploaded without compiling I guess (I’ve never done it, but here’s how it’s done).

I am currently not on a PC so my abilities are limited.

(@Pharap could I summon you for a second? Have you encountered this?) solved

EDIT: Also could you try to compile some other game that has a sound? To see if it’s just my game, or your environment.

I am using windows 8.1
I am using the Arduboy2 library I installed on 26-11-2017 (so it’s probably out of date, i’ll have to update that)

Sadly I can’t flash precompiled hex or arduboy files since i am playing it on a DIY Arduboy using an Arduino Micro (Stuck on the Micro bootloader since no programmer recognizes the chip for some reason)

Edit: yeah other games do have sound like mystic balloons
Edit 2: Okay the game works fine now after updating the Arduboy2 library, i was running 4.1.0 while version 5.1.0 exists :sweat_smile:


Nice! The other games like Mystic Balloon use a different way of making sound so they worked. The beep classes are probably newly added.

1 Like

the game is a lot of fun by the way! I’m definitely gonna kill some hours on this game

1 Like

so for fun i made a modification to the game. if you press up on the main menu, it will activate an infinite money cheat.
This is the game with the modification added


1 Like

Cool :slight_smile: I should have added some cheat codes actually, didn’t think of it (but if you use cheats, high-scores shouldn’t probably be recorded!)

Talking about HighScores, that’s something the always has been important to me. It’s like the only reasons i play games (mostly arcade games), just to beat my last score of the score of someone else. That’s an almost infinite replayability thing for me.

The downside is that in most cases, high score boards can have scores achieve with cheats.

Would be so much fun if we could somehow have online high scores, like the game gives you a unique code to enter on a website and it savez your high score and your name… Almost like an Offline/Online functionality for the Arduboy.

But even there, people would probably try to crack the algorythm and generate their own code to put whatever score online…

1 Like

The score would have to be verifiable, so you’d have to e.g. post a video. Or, for a game like this, simply posting what towers you build at which places in which round could suffice. (Actually ATM the game probably isn’t deterministic, which would be a problem, but I could easily fix that.)

To me high-scores are a perfect way to avoid AI and multiplayer, so ideal for the small games on Arduboy.


Actually the idea with game codes is interesting. I could make the game record the game and at game over write out a code with the encoded “replay” (again, just records of towers built/upgraded in each round).

that wouldn’t be that hard, all you would have to do is check if INFINITE_MONEY is set to 1.
If it is, skip the save routine, if it is 0, then save the score.
Or you could still save the score, but add a cheater tag to it

But if we would make that an actual feature, we would probably first have to clean up my part of the code since i simply just hacked it in :stuck_out_tongue_winking_eye:

A fun idea might be that if you pass a certain amount of rounds on a map, that you then earn a cheat code that you can enable in a menu of some sort :wink:

Doesn’t that mean this is technically a celluar automaton?
(Or a tower automaton. You get the idea - the end result is determined by the initial configuration.)

Of course, the problem with open source is that then I could peek at the code, reverse engineer it and generate the best possible codes :P

Strictly speaking not really – it would be if existing towers spawned new ones or something like that. Then it would be enough to record the initial state. But the towers are built by the player, so we’d need to record each round, which would probably make the “record string” kind of long, which is bad since I already eat a lot of RAM :confused:

(EDIT: Actually I can see where you’re coming from with the " the end result is determined by the initial configuration." – this is usually true about cellular automata, but it’s a property of all deterministic systems. Cellular automata are a typical example of deterministic systems, even though they don’t have to be. But they require some kind of interacting spatial cells, which I can’t see here.)

Matter of perspective :smiley: If you look at it as a fun activity rather than problem, then it’s actually good :slight_smile: You know, like tool-assisted-speedrunning.

Actually generating a perfect gameplay for a tower defense game won’t be helped by the access to the source code. It’s a math problem – might be NP-complete.

I am liking these ideas BTW, thanks for your inputs! I’ll be thinking about implementing them.

This might be a solution. How about if you want a recording of your gameplay, you need to be connected to your pc. Then the arduboy can just print the changes to the serial monitor. Then at the end of the game you have the code on your pc inside the serial monitor.

Maybe you can then make an application that runs on the pc that streams all the required data for each round back to the arduboy to replay the gameplay. Or just make the pc show the replay instead of the arduboy (probably the easiest solution)

Now this might be pushing it, but if you would make an application that is used for recording and playing back replays, then local or online multiplayer could also become an option. Just let the arduboy run the game while the pc does all the multiplayer stuff and syncs it all together. That would be really awesome! :wink:

1 Like