MicroTD - Tower Defense for Arduboy

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

I meant more in principle, in terms of behaviour.

Strictly speaking nothing is actually ‘spawned’ in cellular automata, you only ever have the same grid, it’s just that the cells change state.
Patterns only appear to spawn because placing states one after another in an order creates the illusion of motion, like a flip-book/flick-book.

In which case, each round is a pure function, where the output (the end state) relies solely on the input (the state before commencing the round, including information about the wave and which towers the player has built).

I wasn’t suggesting a way to improve the game, just musing about how it would be possible to reduce the game to something simpler and use a more powerful computer to calculate the different possible outcomes.

It might not be cells, but it’s definitely spatial.

Each tower occupies a coordinate (or group of coordinates) and each ‘creep’ occupies a coordinate (or group of coordinates), and the behaviour changes based on the proximity between the towers and the ‘creeps’ (as well as the types of ‘creep’).

It might be possible to model it with cells. I wouldn’t know without looking into the exact behaviour.
I do know that each pixel on screen is effectively a two-state cell, and as long as all coordinates are integers, the cartesian space can be considered a grid of cells (with complex state).

But I don’t think modelling it with cells would actually prove anything useful (maybe it would, I don’t know, I’m not a mathematician).

It’s fun for the person disecting it, but it can easily spoil the fun of others.
That’s probably why there aren’t many (well known) open-source online multiplayer games (in the style of TF2, Dota, etc, where people are competing against each other).

Personally I don’t like tool-assisted speedruns, seems too much like cheating - a line has to be drawn as to what’s ‘acceptable’ and it’s usually arbitrary or subjective.

I don’t mind writing AI to play the game if the AI only has access to the same things the player does - button input, graphics output and sound output.
Then it’s far more interesting.

It would, because you’d know exactly how the code functioned instead of having to guess the implementation from observable behaviour (like you would if it was closed source).

Seeing the source code is precisely what allows you to turn it into a maths problem and not a guessing game.

Come to think of it, if it’s true that the start state of each round determines its end state, and the only influence the player has is placing towers, then all you’d have to record is the player’s tower placements.
Then you could verify it with a more powerful system.
You could have all the possibilities precomputed and stored in a big lookup table (possibly stored on disk).

The only downside is that you’d have to change than if the behaviour changed (e.g. you changed the contents of a particular wave).

Like I say though, whatever you do, it’s impossible to 100% verify that someone isn’t cheating.
Everything has a loophole.

Yeah, then it’s not a cellular automaton :slight_smile: Almost all games are spatial, but almost none are cellular automata. Sure, there are similarities, but a cellular automaton has a simple and strict definition, which not many games satisfy.

Indeed I’ve heard people say this – the problem here is people who use tools and lie about it, not the TAS category itself. I love TAS more than regular speedruns – it’s definitely a matter of personal taste – but then why should we ban one category in favor of the other, just because someone likes the other one more? They can coexist. We should focus on detecting and punishing cheaters (using tools but submitting to regular category), not banning categories.

No, there aren’t many open-source games in general, even the ones where cheating is not a problem (singleplayer, …). The problem lies somewhere else. Actually multiplayer shooters are one of the most common among open-source games. I’ve been playing some (Open Arena, Xonotic, Red Eclipse, …) and never had any problems with cheaters, always had fun. I don’t know if there are anti-cheating mechanics in place, but ultimately there are no anti-cheating solutions to multiplayer shooters. Third party cheating tools are always an possible. Close-sourcing may help prevent cheating a tiny bit, but in my view this justification is extremely weak. (To me basically nothing justifies close-sourcing anything, but here the justification is even weaker than in many other cases.)

It could, but the games often expose the info (tower damage, creep health, …) or it is very easy to dig it out from the binary. Actually finding the solution to the “perfect game” problem with all info available is the real core of the problem – AI probably won’t be much better at this game than a human (look at AI in RTS games… they’re usually no match to experienced players). It’s like the travelling salesman problem. I strongly believe there isn’t much better solution than brute-forcing all possible games to find the perfect one. (Don’t ask me for a mathematical proof because I might actually end up trying and probably fail :smiley: )

Maybe not, but some of the principles for analysing cellular automata may apply, which is what I’m getting at.

I’m thinking abstractly rather than specifically.

My problem is not in preference, my problem is where to draw a line between ‘the player is doing this’ and ‘the tool is doing this’.
There comes a point where the tool is doing so much of the work that player’s ability doesn’t matter.

It’s not about two categories, it’s about a spectrum of influence from the tool.
Using an RPG as an example, there’s things like fixing the PRNG so it always works in the player’s favour, and then there’s things like editing damage modifiers so the player’s attacks are strong enough to kill anything in a few hits or even being able to skip battles entirely.
The difficulty is in drawing the line where skill ceases to be important.

I never said anything about banning anything.
You can’t ‘ban’ anything unless there’s something to ban from (e.g. a competition, a set of rules).

I had a quick look.
I might have a go at one of them someday.
I particularly like that Xonotic doesn’t need an installer.

I’ve almost never had any problems with cheaters in (for example) TF2, but I know they exist.
(And of course, the best cheaters make their cheating behaviour believable to avoid rousing suspicion.)

True, but there are still ways to defend against certain kinds of exploits.
Ultimately there’s no such thing as perfect security but the world still tries.

The big difference between open source and closed source in terms of cheating is the barrier not having the source code puts up.
If there’s no source code, someone trying to make a cheat tool is forced to use a disassembler that produces hard to read code, or to packet-sniff.
If the code is freely available and well documented then it takes away some of the unpleasantness of that and makes the game more accessible to less experienced would-be cheat-writers.

I’m not saying that makes open source bad, I’m just saying that’s a clear negative.

Conversely, closed source games are more likely to be targeted by cheat-writers because they want to upset as many people as possible and the games with the largest audience are closed source.

It’s not just about tower info. Sometimes quirks in the implementation have an impact, e.g. is the game using manhattan distance or is it using euclidean distance, how long before the next ‘creep’ is released.

There’s AI and then there’s AI.
Some AI uses neural nets and has to be trained, some AI is a group of algorithms based on human strategies, the two approaches can have drastically different results.

There probably isn’t, but it depends on the rules.

1 Like