Dark&Under - A Dungeon Crawler


(Simon) #21

How are you ‘adding’ it? Hex file, .arduboy file or compiling the code itself.


(Kevin) #22

soooooo goooood is this one of the new best games for the Arduboy? I really think so!

It’s about time to update the front page with new games I think this is going on there!


(Simon) #23

Thanks Kevin … we wanted to do so much more with it - including sound. If anyone can save some serious memory in the program without resorting to a customized bootloader or dropping USB support, I would love to hear from them!

We are also hoping that some punters will create a set of dungeons using the supplied tools that we can then distribute with the game.


ArduboyBeep: low overhead tone generation
(John) #24

It´s a really great Game, but i missed the sound. You know… The beeps, the bleeps, the sweeps^^… (Spaceballs). Maybe one BIEP when push the Button when you go, a litte bling when i collect a Potion and a little pling when we swing the sword. Thats enough i think.
Great Work!


(Darrell) #25

Just curious if anyone has this game running on an Arduboy Dev Kit (2nd Edition)? I selected DevKit in the Arduino IDE (ver 1.8.5, Linux) > Board and it compiles. I get the splash screen but nothing happens when I select ‘Play’ or ‘Credits’

Works great on a Kickstarter Edition Arduboy. :+1:


(Scott R) #26

I was hoping to get hold of a devkit but the last one recently sold from the store.

Models I have tested on are:
Red Gold backed Kickstarter with speaker holes (I think these were first run)
Green Kickstarter (I think these were Second run)
Production White


(Scott) #27

It appears that Dark&Under has it own defines for the button bits set by buttonsState(), which are different between the production Arduboy and the DevKit. You would have to change the XXX_BUTTON_MASK defines in Enums.h.

They should have just used the XXX_BUTTON defines provided by the library itself.


(Pharap) #28

I’ll look into getting this change pushed and made into a 1.0.1 release.
Until then, here’s a branch with the fix:
Sorry for the delay.


Edit:
Change is now in master branch:

v1.0.1 still pending.


(Simon) #29

We used our own masks and a exposed the (~previousButtonState & currentButtonState) as it saved a lot of memory. We were desperately scratching for any memory savings.

Edit: Right I see what you are saying, Scott. The masks I used mimicked the ones in the library with the same values. Not sure why I defined my own, possibly a bit of ‘I know best’ when of course I didn’t!


(Darrell) #30

Works perfectly! Thanks, greatly appreciated!


#31

Challenge accepted! :face_with_raised_eyebrow: I’m looking at using LUFA to implement a bare minimum USB CDC class compliant interface supporting the IDE’s reset-to-bootloader protocol. If it turns out to be significantly smaller than the Arduino core implementation then it could help freeing up some memory. In the next few days I’ll try skimming the code and see if I can spot places where memory usage can be reduced.


(Pharap) #32

I have already found one thing that would save 110 bytes, but it’s not in our code, it’s in the Arduboy2 library.


(Simon) #33

I’m happy to compile a hex file with customisations to the Arduboy library if need be. I really want to get sound into this game!


(Simon) #34

I should add … the definition for Level 1 of D&U is 140 bytes and level 3 approximately 250 bytes. A couple of these savings and you can include more levels. As it stands, the current build with the three levels is 27,778 bytes of 28,672 leaving room for 3 or four more levels.


(cyril guichard) #35

For those interested about some aspects of our work on Dark & Under, I’ve wrote a small post-mortem that you can read here > http://luxregina.com/portfolio/dark-under-post-mortem/


#36

You can save another 68 bytes by using a single tileset instead of loose tiles addressed by a table:

Dark-And-Under remove:

const uint8_t *map_tiles[] = { tile_00, tile_01, tile_02, tile_03, tile_04, tile_05, tile_06, tile_07, tile_08, tile_09,
                               tile_10, tile_11, tile_12, tile_13, tile_14, tile_15, tile_16, tile_17, tile_18, tile_19 };

and:

myLevel.setMapTiles(map_tiles);

Level.cpp use:

const uint8_t *tile = tiles + tileNumber * MAP_TILE_WIDTH * (MAP_TILE_HEIGHT + 7) / 8;

mapData.h:

const uint8_t PROGMEM tiles[] = {
0xFF, 0x81, 0xED, 0x05, 0xF5, 0x95, 0xD5, 0x05, 0xDD, 0x85, 0xB1, 0xA5, 0xED, 0x01, 0x7F, 0x7F, 0x40, 0x5E, 0x52, 0x5A, 0x4A, 0x6A, 0x02, 0x6E, 0x42, 0x5E, 0x54, 0x55, 0x45, 0x7F, 
0x7F, 0x55, 0x05, 0x7D, 0x41, 0x5D, 0x15, 0x54, 0x57, 0x51, 0xDD, 0x05, 0xFD, 0x01, 0x7F, 0x7F, 0x41, 0x5D, 0x57, 0x50, 0x55, 0x5D, 0x01, 0x7F, 0x40, 0x5F, 0x50, 0x5E, 0x42, 0x7F, 
0xFF, 0x01, 0xDD, 0x51, 0x55, 0x15, 0x57, 0x54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 0x01, 0xFF, 0x7F, 0x40, 0x5A, 0x52, 0x5A, 0x52, 0x7E, 0x02, 0x76, 0x52, 0x5A, 0x42, 0x5B, 0x48, 0x7F, 
0x7F, 0x41, 0xDD, 0x45, 0x5D, 0x51, 0x17, 0x54, 0xD5, 0x95, 0xB5, 0xA5, 0xAD, 0x81, 0xFF, 0x7F, 0x40, 0x5F, 0x41, 0x5B, 0x49, 0x7B, 0x42, 0x5A, 0x52, 0x78, 0x52, 0x5E, 0x40, 0x7F, 
0xFF, 0x41, 0x55, 0x75, 0x05, 0xD5, 0x7D, 0x04, 0xDF, 0x01, 0xF5, 0x15, 0xDD, 0x41, 0x7F, 0x7F, 0x44, 0x5F, 0x55, 0x50, 0x5B, 0x40, 0x7F, 0x41, 0x5C, 0x47, 0x50, 0x5F, 0x40, 0x7F, 
0xFF, 0x01, 0xFD, 0x05, 0xDD, 0x55, 0x55, 0x04, 0xF7, 0x11, 0x51, 0x55, 0x15, 0x45, 0x7F, 0x7F, 0x40, 0x76, 0x44, 0x5D, 0x41, 0x7F, 0x04, 0x77, 0x44, 0x51, 0x55, 0x5C, 0x41, 0x7F, 
0x7F, 0x41, 0x7D, 0x05, 0xDD, 0x51, 0x55, 0x55, 0x55, 0xD5, 0x55, 0x55, 0x75, 0x05, 0x7F, 0x7F, 0x40, 0x5F, 0x51, 0x5D, 0x40, 0x5F, 0x51, 0x5D, 0x45, 0x55, 0x51, 0x5F, 0x40, 0x7F, 
0x7F, 0x21, 0xBD, 0x85, 0xB1, 0x85, 0xFD, 0x00, 0x77, 0xC5, 0x15, 0x55, 0xDD, 0x41, 0x7F, 0x7F, 0x41, 0x5F, 0x40, 0x5E, 0x52, 0x56, 0x50, 0x55, 0x45, 0x57, 0x54, 0x77, 0x40, 0x7F, 
};

(Simon) #37

Love it. Of course, the tiles are all the same size.

Version 1.0.2 maybe? I will need to edit the ‘Level Editor’ to do the same.


(Pharap) #38

*gets out operator associativity table*

In all seriousness though, consider it queued and/or under debate.


(Simon) #39

Question: If I am just calculating an offset, couldn’t I just do this?

const uint8_t *tile = tiles + tileNumber * MAP_TILE_WIDTH;

What are you calculating with the “(MAP_TILE_HEIGHT + 7) / 8;” ?

const uint8_t *tile = tiles + tileNumber * MAP_TILE_WIDTH * (MAP_TILE_HEIGHT + 7) / 8;


#40

Strange My Arduino IDE 1.8.4 did’t complain.

The number of bytes required to store MAP_TILE_HEIGHT wall bits rounded up. I did make a typo there though the last part should have some additional curly brackets ((MAP_TILE_HEIGHT + 7) / 8); (on testing I used the hard number 30 for tile size).