Rogue-like ascii based on Arduboy

(Josh Goebel) #241

Is there a reason not to make PR to properly name the file so we don’t have to keep renaming it? I’d think this would be a problem for @BlueMax also.

Can someone also please clarify what these are?

#define WEMAX   8     //9
#define ARMAX   7     //8
#define POMAX   14    //14
#define SCMAX   12    //14
#define RGMAX   11    //14
#define WDMAX   10    //14
#define RMAX    2
#define IMAX    26
#define TMAX    40
#define MMAX    16

Also, is the proper starting hh for the hero 1200 or 400? The source seems to conflict in different places.

1 Like
(Pharap) #242

Presumably because @BlueMax doesn’t yet understand enough about git/GitHub to use it as a versioning mechanism, so he’s been tracking versions manually.
Either that or he understands but isn’t used to it yet.

Or perhaps he’s simply unaware of the Arduino IDE’s weird folder rules.
There are other systems that can be used to compile Arduboy programs, like PlatformIO.

I haven’t pressed for naming change too much because I appreciate how difficult it is to write code in a second language using an alphabet one isn’t familiar with.
(It would be like you or I attempting to name our variables in Japanese.)

The ones I’m aware of are as thus:

constexpr uint8_t maxWeapons = 8; //WEMAX
constexpr uint8_t maxArmour = 7; //ARMAX
constexpr uint8_t maxRooms = 2; //RMAX
constexpr uint8_t maxItems = 26; //IMAX
constexpr uint8_t maxMonsters = 16; //MMAX
constexpr uint8_t maxRings = 11; //RGMAX
constexpr uint8_t maxScrolls = 12; //SCMAX

As for POMAX, WDMAX, and TMAX, your guess is as good as mine.
I’m guessing POMAX is potions, but can’t find anything conclusive on a quick skim.
I have no clue what WDMAX or TMAX are,
but I know TMAX is somehow related to tng,
so figuring out what tng is will solve TMAX by association.

1 Like
(Josh Goebel) #243

Yeah, I was going to trya nd clean up some of the names. All the string and UI are in english… so there is precedent there - it’s not like the whole UI is Japanese and I’m suggesting the source be english. :slight_smile:

Do you think constexpr is much nicer than defines because it can be typed checked?

(Josh Goebel) #244

@BlueMax Any objections to renaming your dir/files so they are easy to compile with the main Arduino software? I can make a PR if you’re cool.

I’d change the folder to “Rogue” and make the main file “Rogue.ino” to match, then the IDE will be happy.

(Scott R) #245

Rogue uses Rods (wands of staffs) WDMAX could be wand max??

2 Likes
(Josh Goebel) #246

Fun fun: Sketch uses 28466 bytes (99%) of program storage space. Maximum is 28672 bytes.

(Josh Goebel) #247

Arduino software is so weird:

/*
const char trap[6][8] PROGMEM = {
  "door",
  "arrow",
#line 229 "/Users/jgoebel/git/Rogue/Rogue1.4/Rogue1.4.ino"
void setup();
#line 290 "/Users/jgoebel/git/Rogue/Rogue1.4/Rogue1.4.ino"
void loop();

Now it won’t compile because it insists on putting the function declarations right in the middle of a comment - WTF.

(Pharap) #248

I wasn’t talking about the UI.
The UI is an entirely different matter to the code itself.
The author doesn’t necessarily have to understand the words on the UI,
those can be translated as required.
But the author absolutely has to understand the code.

My point was that anything involving writing code in a foreign language is going to be difficult for the author to get their head around,
so while changing the names to something full length seems trivial for someone who speaks that foreign language (i.e. English),
it’s a lot less trivial for the person for whom it is a foreign language.

If I was writing a game where the variable names were in Japanese I could understand chosing to write (for example) コンシス instead of コンピューターシステム, because the latter would take me much longer to write and would be harder to remember.

Also I use a Japanese IME (input method editor) installed to be able to write hiragana and katakana,
so I suspect the reverse would be true for someone who writes primarily in Japanese.
I could be wrong, perhaps Japanese keyboards have an easier way to type English than western keyboards do for typing Japanese.

I could be underestimating @BlueMax’s understanding of English,
but I’d rather underestimate than overestimate.
It’s generally less effort for me to simplify my explanations than it is for non-native English speakers to understand colloquialisms, idioms, appreviations and esoteric technical language.

There are several main reasons for using constexpr for constants:

  • Explicit typing
    • Macros do tend to have a type, but it’s less obvious, you have to check with decltype if you want to know what the type is
  • More self-documenting
    • Macros are used for lots of strange things, but a constexpr variable is only ever going to be a constexpr variable, so it’s purpose is immediately obvious
  • Scoping rules
    • Macros don’t obey scoping rules because they only exist at tte preprocesing stage, the compiler itself never even sees the macros. This results in what I like to call ‘macro poisoning’ - you write a macro once and it infects the whole program. For an example, when I was writing FixedPoints, I had to write roundFixed because I couldn’t write a function called round because the Arduino writers made round a macro.
  • Can’t be redefined
    • Macros can be redefined part way through a program, which can cause issues, whilst variables can only be defined once thanks to the one definition rule
  • Better error messages
    • As mentioned earlier, macros are replaced at the preprocessor stage, so by the time you get an error message the macro has already been substituted, which can result in some cryptic errors in some cases. With constexpr variables this isn’t a problem, you get the proper variable name
  • constexpr fixes the shortcomings of plain const variables
    • In particular, you can’t const_cast a constexpr variable and constexpr variables can be used in constant expression contexts, like template arguments and array dimension declarations.

A fine example of why .ino files are a crime against humanity.


Ah, that would make sense. I had a feeling it was another item, but couldn’t see what.

1 Like
#249

I am sorry for the program which is truly incomprehensible.

WEMAX,ARMAX, ... ,WDMAX

It is the maximum type of thing that exists in the world of “Rogue”. Weapon, armor, potion, scroll, ring and wand.

RMAX

It is the number of vertical divisions of a dungeon one floor. In makeDungeon2(), I divide it into three, but because the memory is insufficient, I am changing the algorithm to a large extent.

IMAX

It is the maximum number of belongings of a hero. It is 26 according to the number of alphabets.

TMAX

It is the maximum number that can exist in that floor. Up to 12 things naturally generated, if the hero put all its belongings plus 26, some items the monster drops, decided the maximum number.

MMAX

It is the maximum number of monsters that are present at the same time.
By the way, the number commented out is the number of kinds in “Rogue”. I adopted “Rogue clone” things. In “Rogue” there are five different scrolls of identify.

1 Like
#250

Hello everyone.

I found some problems during the test play. Also, I noticed that I was compiling with an older version of IDE. I will release a new version. The new version is 1.5.2.

Rogue152.hex.pdf (77.6 KB)

CAUTION
This version uses “remove USB stack” technique. When you upload a new game, you need to hold down the DOWN button while ARDUBOY is starting up.

This version is:

  • [FIX] Mis-calculation of damage reduction by armor
  • [FIX] Dragon is not generated
  • [FIX] Dragon breath damage review
  • [FIX] Even though the hero is caught in the flytrap, he(or she) get off the stairs.
#251

To @Vampirics.

When compiling the source in GitHub,(The source of GitHub is already 1.5.2.)

Sketch uses 28252 bytes (98%) of program storage space. Maximum is 28672 bytes.

420 bytes free memory.
When you design monsters with 8 x 8, so they needs 8 x 26 = 208 bytes… What is going to happen?

(Stephane C) #252

Well so far I kept it the same dimension as the font. If you change it to 8x8 it will take more space, not only because of size but also because you will probably need to change your code to have a camera following the player now, but that would be great if somebody plans a 16*16 tileset.

#253

To @Vampirics.

I think…

  if (idx > -1) {
      SpritesB::drawOverwrite(x, y, font_images, idx);
  }

to

const uint8_t PROGMEM big_monster[] = {
8, 8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,0x00,
...
};
...
  if (idx > xx && idx < xx) {
      SpritesB::drawOverwrite(x, y, big_monster, idx);
  }

small_monster(4 x 4), middle_monster(5 x 7)…
Without changing the grid(8 x 21), monsters protruding from the grid…

In my “Rogue”, almost capital letters are not used. (Messages are all lowercase, used by scroll labels) It is also possible to rewrite these.

(Stephane C) #254

Can you update on GitHub as well if possible? Thank you!

#255

To @Vampirics.

big_mon
Big kestrel (8 x 8 square)

I rewrite font5x7.cpp only.


const uint8_t PROGMEM big_monster[] = {
8, 8,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};
...
  if (idx > -1) {
    if(idx == 43){
      SpritesB::drawOverwrite(x, y, big_monster, 0);
    } else {
      SpritesB::drawOverwrite(x, y, font_images, idx);
    }
  }
(Stephane C) #256

Don’t you think it will have an impact on collision if not all monster are the same dimension?

#257

There is no problem because collision judgment is done by array rather than sprite. My program choose what to write from that array, so it’s okay. This is a feature I (or you) want to implement even if I (or you) remove other feature!

(Josh Goebel) #258

Saved another 170 bytes cleaning up initital states that are never used and using memset: https://github.com/BlueMaxDX/Rogue/pull/4

This also renames the main .ino file to properly work with Arduino IDE. Hopefully it can get merged.

#259

Thank you, @Dreamer3!

I merged your pull request now. I do not know how to use GitHub, I’m really sorry. I look forward to working with you.

(Stephane C) #260

I can see how it could be interesting. And it’s basically adding new custom characters. But too much big characters might make the game look weird as the bigger sprites overlap the others around it