Rogue-like ascii based on Arduboy


#41

To @Vampirics.

Sorry for the incomprehensible display.
“Lv:x” on the first line of the status screen indicates the floor where the hero is located. The level based on the experience value of the hero is the display of “Ex:x”.

“pressing a combination”, I see!
I will be able to release a new version soon.


(Stephane C) #42

@BlueMax thank you, I am sure we could see how to make the stats more obvious. There’s a couple that I don’t understand, like ‘Au’…

Also I am not too sure how to actually use the bow and shoot arrows.


#43

Everyone in this community, hello.

Now. I release new version of “Rogue” game.

Rogue.hex.pdf (78.7 KB)
Now, it runs on Caterina bootloader!
(a scroll of identify, corrected)

This version is:

  • [FIX] Although a hero is asleep, she (or he) can act.
  • [FIX} Although hero is blind, monsters are displayed.
  • [FIX] When a hero teleports, it may overlap with a monster.
  • [FIX] Even if a hero throws things, the monster does not move.
  • [FIX} Just by hero picking up things, he (or she) know that it is cursed.
    Caution! If you throw a cursed weapon, the present equipment will be removed and equip it.
  • [SYS] You can start at “New Game” or “Continue”.
    Sorry. The loading and saving function seems to take a while for a while.
  • [WIZ] Secret command.
    When you press UP or DOWN D-Pad while displaying the title screen, the numbers are displayed at the lower right of the screen.You can put the Amulet on the floor of that figure.

I change the file name from “HelloWorldx.ino” to “Rogue.ino”.
It’s still fresh to build, I do not have enough test play. If there is strange behavior, please let me know more and more.

Sorry.
When reading the scroll of identify, there was a problem that unrelated message was displayed. If that happens, please download it again. I corrected the problem.


#44

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.

HelloWorld9red.zip.pdf (23.2 KB)
about 800 bytes free.

HelloWorld9red2.zip.pdf (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) {
    st++;
    stm++;
} else {
    st++;
}

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”:

break exits a for or while loop.

before:

byte ex = 0;
do
{
	if(a == b)
		ex = 1;
	else
		doSomething();
}
while(ex == 0);

after:

while(true)
{
	if(a == b)
		break; // exit while
	else
		doSomething();
}

@Vampirics, this might help a bit:
https://strategywiki.org/wiki/Rogue


(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)))

#47

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?


#48

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.
RogueTitleScreen

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?
RogueMenuwithLine

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

はい、それはいいです。

恐らく。(Probably.)

これ?

はい。

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

#50

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!


#51

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.”)

このチュートリアルが好きです。
https://www.learncpp.com/

でも、日本語訳がありません。

も、これがあります:https://ja.cppreference.com/w/cpp/language

(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 https://en.cppreference.com/w/cpp/language and https://ja.cppreference.com/w/cpp/language 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).


#56

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.


#58

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.


#60

Sorry, I have one more question.

I wrote

if(arduboy.justPressed(RIGHT_BUTTON)){
exitToBootloader();
}

I receive

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

 exitToBootloader();

Is something necessary for procedures?