Rogue-like ascii based on Arduboy


#121

Good idea.
How about keeping all the “font” for the map “as is”, and then use tiny font for displaying stuff(stats, messages), etc?


(Pharap) #122

It would be possible to remove the default font and replace it with a smaller font, but smaller fonts tend to be harder to read.

Alternatively you can remove the default font and use a custom font (or just a reduced version of the default font) that removes the graphics for the characters that aren’t used.

The default font covers most of code page 437:

So it’s possible that using a reduced font would be worthwhile.

That still involves loading two fonts.
Using two fonts uses more memory, it doesn’t save any memory.


(Stephane C) #123

That and for what I have in mind. A smaller font would not help at all…


#124

It’s going to be able to fit more stuff in a smaller space.
It’s also going to save us a couple KB of PROGMEM.

But I know Bluemax have his own idea, so I’ll wait and just leave the suggestion “as is”.


#125

Thank you, @CDR_Xavier, @Vampirics and @Pharap.

I also think about fonts.
When compiling the sample “HelloWorld.ino”

Sketch uses 6688 bytes (23%) of program storage space. Maximum is 28672 bytes.
Global variables use 1224 bytes (47%) of dynamic memory, leaving 1336 bytes for local variables. Maximum is 2560 bytes.

Font4x6mod2 .zip.pdf (2.5 KB)

Compiling this

Sketch uses 5272 bytes (18%) of program storage space. Maximum is 28672 bytes.
Global variables use 1219 bytes (47%) of dynamic memory, leaving 1341 bytes for local variables. Maximum is 2560 bytes.

If I incorporate this into my “Rogue”…

HelloWorld9_4x6.zip.pdf (25.8 KB)

Great failure… I do not know why this is the case.:cold_face:


(Pharap) #126

Probably because Font4x6 uses the Sprites functions and you weren’t using those before.

It would be possible to adapt the font drawing to not use Sprites,
but it would take a bit of time.

I could have a go tomorrow, but it is too late tonight.

I think there will be some good savings elsewhere though.


I will try to write some better GitHub instructions tomorrow.
I have been busy this week, but I should have more time tomorrow.


#127

I see…

if (idx > -1) {
  if (_textColor == WHITE) {
    Sprites::drawSelfMasked(x, y, font_images, idx);
  }
  else {
    Sprites::drawErase(x, y, font_images, idx);
  }
}
if (draw_color || draw_background) {
  for (uint8_t a = 0; a < size; a++ ) {
    for (uint8_t b = 0; b < size; b++ ) {
      drawPixel(x + (i * size) + a, y + (j * size) + b, draw_color);
    }
  }
}

#128

You can play around with its source code and “replace” the drawSelfMasked with the actual drawSelfMasked inside Sprite class.
I guess the second section of code is the one you dig out of Sprite class.


#129

I seem to be able to delete fonts that I do not use from the program. However, it seems to be a major change. Also, I do not know how to invert font color. However, it seems that it can save considerable memory.


(Scott) #130

@BlueMax,
When posting code, please format it by starting with a line containing three backticks (usually the key below the ESC key at the top left, at least on US keyboards) followed by the letters cpp,
then your code,
then add another line with 3 more backticks:

```cpp
Your code goes here
```

I edited your previous post to add this, but please do it yourself in the future.
Thanks


(Pharap) #131

Nope, that’s from Arduboy2::drawChar, which itself is used by Arduboy2::write (which in turn overrides Print::write).


@BlueMax
The forum uses Markdown for formatting.
There’s a simple guide here:


(Pharap) #132

Here’s the really really simple version:

Creating a repo:

  1. Go to https://github.com/
  2. Click on + (top right)
  3. Name the repo
  4. (Optional) Describe the repo
  5. Select Initialize this repository with a README
  6. (Optional) Select a licence
  7. Create Repository

Uploading to a repo:

  1. Go onto your repo
  2. Upload files
  3. Drag & drop files
  4. (Optional) Add a message
  5. (Optional) Add a description
  6. Commit changes

Using GitHub ‘properly’ is more complicated than this,
but for now this is all you need to know.
(It seems you’ve already given this a go though.)


Branches and commits are more complicated. They will need more explaining.

I won’t explain branches today, but I’ll try to explain commits.
Commits are a way of representing individual changes or groups of changes.

Good commits have a brief ‘commit message’, which is like a title or a summary,
and sometimes they have some more description explaining the changes in detail.

I think the best way to understand commits is to look at some commits on another project, such as my Minesweeper game:

This commit for example:

The commit message is “Make the A button function as a back button” (i.e. A button = back),
which describes what the change does.


There are several reasons for having commits:

  • Commits help you track how your code changes
  • Commits help people understand your code
  • The git system allows you to look at old versions of your code, every commit is a ‘snapshot’ of your code at a point in time
    • This helps with finding bugs (e.g. if the code works at commit 20 but not commit 21 then commit 21 added a bug)

If this doesn’t make sense, let me know and I can explain again in a different way.


#133

I am sorry, @MLXXXp and @Pharap.

I thought that my post was hard to see. I will be careful from now on.

Many thanks, @Pharap.
It is a very descriptive explanation.
Actually, I started a Japanese tutorial for 2 days ago to learn how to use git and GitHub. “git init”, “git checkout”, “git branch”, “git add”… However, as fonts became a topic, I began to care. I am short of concentration. I have too much to learn and I am short of time. I wish I had another one…


(Scott R) #134

You can change text and it’s background colour like this

arduboy.setTextColor(BLACK);
arduboy.setTextBackground(WHITE);


(Pharap) #135

Many people don’t know about it.
We need to find a better way to inform new users.

Ah, good. I looked but couldn’t find one in Japanese.

Personally I do not use command line git - I find it cumbersome and unintuitive.

I use the GitHub UI for everything.


#136

Hello everyone.
I will release a new version 1.3.

Rogue13.hex.pdf (75.8 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] When a hero throws things, nearby things disappear
  • [FIX] Flytraps can move
  • [SYS] change font (like an old pc bios font)

Untitled

From this version, “Arduboy2Base” is used instead of “Arduboy2”. Therefore, I was able to greatly reduce the capacity of hex. Also, as a bonus, I tried putting fonts that I made hastily.

How long will the upgrade continue?
The final version of the original “Rogue” is 5.4.4! :tired_face:


(Pharap) #137

To make a release on GitHub:

  1. Go to your repo
  2. releases
  3. Draft a new release
  4. Add a ‘tag’ (this should be a version number, e.g. v1.3.0, v5.4.4)
  5. Add a title
  6. (Optional) Add a description
  7. (Optional) Upload .hex files and/or .arduboy files
  8. (Optional) tick This is a pre-release if the game is in alpha/beta or not officially released
  9. Publish release

You can then make a link to the latest release:

https://github.com/<user name>/<repo name>/releases/latest

E.g. for my Minesweeper game:

https://github.com/Pharap/Minesweeper/releases/latest

If you had a repo called Rogue then the link would be:

https://github.com/BlueMaxDX/Rogue/releases/latest

You can also link to specific releases.


Here’s the releases for my Minesweeper game:

You can see it is useful.


(Stephane C) #138

Is it still 5x7 the font? And did you make it so that it can use external fonts?


#139

To @Pharap.
GitHub can do this as well. I did not know…

To @Vampirics.
Although the size is still 5x7, the program retrieve the data from the array prepared by itself and display it. If I can secure even the data area, I think that I can change the size. 8x8 or 16x16…


(Stephane C) #140

Great! Good news. So I guess my idea of new tileset is easier to do now.

I already have 5x7 sprites done. Just need to make a font out of it or add them to an existing font.