Rogue-like ascii based on Arduboy


My teacher, @Pharap. Sorry for the late reply.
Last Friday, I reviewed the code in order to secure the memory vacancy. And I succeeded in securing about 800 bytes of free space. I thought about using the technique taught by the teacher to modify the program.
However, I thought on the way. I thought that it would be better for me to rewrite my program from the beginning. Once I gave up the function of saving and started fixing the problem. (23.2 KB)
about 800 bytes free. (22.2 KB)
recent release version

I do not fully understand the technique taught by the teacher. But someday I understand everything and I will rewrite this program.

Also, I do not have enough time so I can not reach the usage of GitHub.I have the source code put here.

To @Vampirics.
Thank you for your reply.
Rogue is an old UNIX program. I wanted to reproduce the program as faithfully as possible. 26 kinds of monsters and their special attacks, 14 kinds of potions, 12 kinds of scrolls, etc, etc…I think that information on UNIX’s original Rogue also applies to this game. Arrows, darts, shrikens and daggers are throwing weapons. If you throw the arrow after equipping the bow, bonus will be attached to the accuracy and damage.

(Pharap) #45



(I discovered that “分かった” is informal.)



Similar to おいら oira, but more rural.



(Which technique?)

struct? __FlashStringHelper? enum class?

I can try to explain better, but explaining in Japanese is very difficult.

I will read it when I have time to spare.

I had a quick look. I think I may have found a bug…

In action.ino, in void drink(byte r):

if (st = stm) {
} else {

st = stm should be st == stm?


compound assignment operators”:

  • a = a + b; -> a += b;
  • a = a - b; -> a -= b;
  • a = a * b; -> a *= b;
  • a = a / b; -> a /= b;
  • a = a % b; -> a %= b;
  • a = a & b; -> a &= b;
  • a = a | b; -> a |= b;
  • a = a ^ b; -> a ^= b;


break exits a for or while loop.


byte ex = 0;
	if(a == b)
		ex = 1;
while(ex == 0);


	if(a == b)
		break; // exit while

@Vampirics, this might help a bit:

(Pharap) #46


thing[x + dx][y + dy] * !tm == 0 && monst[x + dx][y + dy] * tm == 0

Should it be this?

(((tm != 0) && (thing[x + dx][y + dy] != 0)) || ((tm == 0) && (monst[x + dx][y + dy] != 0)))


My teacher, @Pharap.

Variables in my code are wasteful. Even though I use only 1 bit for the variable representing the state of the hero, 8 bits are allocated.

For safety reasons, no trap is set up in my “Rogue” dungeon. I think that this is also possible if I reconsider how to use variables. (room number uses 3 bits, Structure’s ID uses 5 bits)

My “Rogue” has only 21 x 8 = 168 partitions. Currently, the positions of hero and monsters are represented by 2 bytes, but 1 byte is sufficient.

I am planning to review all the variables with reference to the “struct” of “item” taught by the teacher.

Wow! I was mistake!

Ah… I did not fix this either.

I wrote findPlace function and findPlaceM function.
findPlace function called, when hero throw item, but not hit monsters.
findPlaceM function called, when hero read a scroll of create.
These two were very similar. So I take arguments to decide whether it is a monster or a droped object.

Probably, I think that it is together.

If I use “Arduboy2Base” instead of “Arduboy2” and use Mr. @filmote 's “font 4 × 6”, will free memory increase?

Due to the pleasure of having a GitHub account, I submitted this game to “Erwin’s Arduboy Collection”. At that time, I referred to your “Big asterids!” Article. If I upgrade the game, can I upload it to the current version instead?


To @Vampirics.

Here’s an idea for your title screen. I think it’s better than my first attempt. And should take less space because the logo is smaller and the lines can just be drawn by the drawline function.

Very cool!!!
I’m sorry, but there is only 44 bytes of free memory…

Also, it’s nitpicking but what do you think of adding a line next to menus like this?

It’s easy to see and easy to implement. However, compared with the original “Rogue”… Which is better?

(Pharap) #49

もったいない、ね? 問題ない。

RAM is in blocks of 8 bits.
There’s no way to use only 1 bit, you have to use 8.

Yes, using 1 byte would save space.


(“I was mistake.” -> “I made a mistake.”)

I meant “why are you using *?”.

Mixing integers (int/uint8_t/byte) and booleans (bool) is confusing.

tm = int
!tm = int -> bool
* !tm = int -> bool -> int





You would have to:

  1. Delete your fork (Settings > Delete this repo)
  2. Fork eried/ArduboyCollection again
  3. Upload your new .hex file
  4. Create a new PR (pull request)
  5. Wait for eried to merge


To @Vampirics.
Thank you very much for much advice and suggestions.
I built a version for you only. Of course, other people can also download it.

However, this version only works on “Cathy3k bootloader”… Do you have a Arduboy with “Cathy3K bootloader”? I confirmed that I will at least work on “ArduBoy Emulator”.

Rogue4Vampirics.hex.pdf (79.8 KB)

This version is:

  • [SYS] runs only “Cathy3K bootloader” (Sorry…)
  • [SYS] update VERY gorgeous title screen.(thank you, @Vampirics!)
  • [SYS] Status window with vertical line.
  • [SYS] A BUTTON is search and rest only, A+DOWN BUTTON opens status window.

I look forward to working with you!


Wow… I made a mistake… (Is my way of doing it this time?)

I see. I understand.

Thank you very much. I will try it.

I began studying “C ++”. Programming is very fun. Also, although a large memory area is good, it is fun to pack it in 32 K bytes. There are many things to do, but someday I will submit my report to my teacher.I am a bad student, but do not abandon me.:tired_face:

(Stephane C) #52

Thank you for that but I don’t have an Arduboy with Cathy3k. Ever thought about removing USB stack to gain some memory and use a button on title screen to go into bootloader mode?

@Pharap do you think it’s worth a shot and if so could you help him out? We did that on minirogue if I remember right.

@BlueMax I know you don’t have the space, yet, but a winning screen showing that you won’t and displaying some kind of score based on the loot you have might make the game more fun to play. If only to beat other people or our own scores.

But I gotta say, after reading on the original Rogue, you are really doing a great job recreating it.

Edit: there’s a small graphical glitch on the title screen. Probably because you didn’t need the dimension of the sprite in the image code.

Question for @Pharap, is it possible to make it so that the status screen pops up if we press down while we hold A? Right now you have to press them both at the same time and it’s not working everytime .

(Pharap) #53

I think you mean “is my way of doing it right this time?” or “is that right?”.
(‘right’ can mean ‘correct’/‘proper’.)

In which case, yes.

You can say “I was mistaken”, but the meaning is different to “I made a mistake”, and it’s more old fashioned.

“I made a mistake”/“That was a mistake” is for when you accidentally do something wrong.
(e.g. when your code has a bug).

“I was mistaken” (less common) / “I was wrong” (more common) is for when something you think/believe is incorrect.
(e.g. Person A: "int is 4 bytes" Pharap: “no, int is 2 bytes on Arduboy and usually either 4 bytes or 8 bytes on desktop” Person A: “Oops, sorry, I was wrong. Pharap is correct.”)




(Some sections are missing. I can attempt to explain those.)





(I don’t know if I am using ‘が’ correctly. Understanding ‘は’ and ‘が’ is difficult - English does not have this concept.)


I’ve been comparing and so I can learn the Japanese words for important C++/computer terminology.

For example, “undefined behaviour” is 未定義の動作.

Sometimes we call this “nasal demons” (鼻の悪魔) because there’s a joke that “undefined behaviour” (未定義の動作) means the computer is allowed to make demons (悪魔) fly out of your nose (鼻).

Personally I don’t like removing the USB stack, but it’s probably doable.
One problem is that then you have to have an extra way of putting the program into USB/reprogramming mode.

If I get chance I’ll sort it.

(Scott) #54

If you remove the USB stack using the feature provided by the Arduboy2 library, you don’t necessarily have to add anything to your code to allow putting the unit into the bootloader. Using the ARDUBOY_NO_USB macro will include code which checks for the DOWN button being pressed during power up and, if so, enter the bootloader.

However, if you have the space you can add a menu item, or some other method, to prompt the user to initiate bootloader state, then the code can invoke it using the provided exitToBootloader() function.

For more information, see the Arduboy2 Library documentation for ARDUBOY_NO_USB and exitToBootloader()

(Pharap) #55

True, I’d forgotten this was part of the library,
I thought it was something specific to Evade/Evade 2 (whichever one removed the USB stack).


To @Vampirics, thank you for your reply!

I am sorry…

Wow, so sorry. I will fix it.

Since I was interested, I examined “removing USB stack”. I wrote “ARDUBOY_NO_USB” between “global variables” and “setup” functions.

As a result:
29028 bytes (without ARDUBOY_NO_USB)
28982 bytes (with ARDUBOY_NO_USB)

It is 48 bytes smaller. Is the amount of memory to be reduced so high?

(Simon) #57

Are you using Serial.print anywhere? If you leave this in, it makes the compile size much larger.


To @filmote .

Thank you. I use “Serial.begin(9600)” for debug. Disable this, As a result:

26442 bytes (92%) !!

Incredible! Amazing!

(Simon) #59

Excellent … nice savings.


Sorry, I have one more question.

I wrote


I receive

game:36: error: ‘exitToBootloader’ was not declared in this scope


Is something necessary for procedures?

(Simon) #61

I think you need to use …



Thank you! @filmote.
I’m very embarrassed because I have made a very rudimentary question.
I will post it after checking firmly. really sorry…:disappointed_relieved:


“Au” is the chemical name for gold. (it’s all Latin and stuff)
I think it meant the amount of $ you got.

Uh … … … Mmm.

If he used my version (in which he didn’t, not his fault) , we will see this instead:

if (st == stm)

K&R indenting.

Saved 4 bytes. (or 2 byte? I forgot.)

I feel like my work often goes unnoticed…just saying.

Use ‘drawFastVLine’ instead. It’s simpler, and therefore faster.

drawFastVLine(starting_x, starting_y, length/*only goes DOWN*/, color);

drawFastHline(starting_x, starting_y, length/*only goes RIGHT*/, color);


That’s actually mine…

You’re fine.

Although it might be done better in Private Messages.