Dungeon crawler rendering demo - LOOT!

(Bruce) #1

Inspired by the LOOT mockups, I’ve had a shot at writing a first person dungeon crawler. There isn’t any game in this release, it’s just a test for the rendering code. Tell me what you think and feel free to offer any suggestions for the next version!

The code is reasonably fast, much too fast to control at 60fps, so I consider it to be good enough for the moment. It currently works by writing walls to the screen, then drawing over them if there’s a wall infront. This is not the fastest method ever, thanks to the relatively high cost of drawing fillRects, but I bet it compiles smaller than meticulously checking every eventuality and only drawing what’s needed.

I’m using pastebin for this over github as It’s only a single file with no dependencies.

V1.0 - http://pastebin.com/A2GcsCEA

LOOT - Epic Dungeon!
(Migz) #2

Looks cool! I’ll try it when I get home. I’ve posted more assets for the LOOT game in here mostly for the UI art, https://github.com/MigZ1/LOOT

(Migz) #3

Very cool! Is there a way to add details to the walls? Like a doorway, a few brick lines, torch, (not all on 1 wall) Can we also walk backwards by pressing down? It’s cool how you see the map while moving around,

Might be cool for the player to choose map or stats/inventory to be shown on the right half of screen any time by using a button to switch.

This is such an awesome work in progress!

(Bruce) #4

Adding wall decorations should be fairly simple, you’d need to have a left, right and centre image for every distance level, then again for every wall variation. The actual drawing starts on line 134, swap out any line draws with the relevant sprite. The actual sizes for each view level are on line 116, and you’d want to have the sprites correlate with those.
For walking, duplicate the block starting on line 215, and invert the directions in the if(cameraDir==whatever) area. For the wall variations themselves, you’d need to alter the wall array to a different variable type, preferably an 8-bit type like uint8_t, and adjust anything that refers to them.

Swapping between the 3d view and map should be easy, have a bool specifying what mode it’s in and display the appropriate image. Also adjust the map drawing code so it’s aligned with the left of the screen, not the right.

I’m currently working on a v2 that should incorporate some of these changes, alongside a few other goodies :slight_smile:

(Bruce) #5

Here’s minor update for today with some suggestions from @GamerGuy. This isn’t the promised second version, just a minor patch to the first.
Added backwards walking, and the map is now on the left hand side of the screen, swappable with the B button.

And now for why viewMap is an int, a 16bit(?) variable rather than uint8_t or, even better, a bool. For reasons I cannot work out, be it either a stupid error on my part or the compiler doing something daft, if the variable value is lower than what would fit in an 8bit var, walking around makes it flip states, seemingly at random. I have literally no idea why this is happening and if anyone better at C++ could explain, I’d appreciate it. Here’s the version using bools, compile and see what happens. http://pastebin.com/ztGYrVTZ

(Migz) #6

I like your idea better with the map on the right, but when we have an ‘inventory’ or HP stats, etc. maybe we could swap that with the map with a button press, both being on the right and the 3D maze always being visible on the left.

(Migz) #7

Here’s an animated mock up of an attack.

(Migz) #9

Gettin’ loot

(Migz) #10

Not sure how many frames we can have, but having fun making these.
Idle and Attack

(Bruce) #11

My current estimates for size are “More than you’d expect, but less than you’d hope” :laughing:

Items coming up in the next day or three, depending on how busy I am with work.

(Migz) #12

Nice update, a couple suggestions for the directions:

  1. Can you change the X on the map to be a solid arrow to show which way the player is facing on the map?

  2. Looks like the direction always goes in an order N,E,S,W.(wraps around) I think If you are facing South, and you hit left on the d-pad, you would be facing East, if you press Right you would face West… Currently in the game, In that same scenario, it goes to West first and you have to cycle through to get to East which I feel makes it more difficult to navigate. Maybe not wrapping and turning right or left based on which way you are facing?

Great to see that there are items now that can be placed!!


(Migz) #13

More screen mock ups.

(Bruce) #14

Uh yeah, sorry about the direction thing, I did some optimisations to the movement code and made a typo. Somehow didn’t notice it despite loads of testing. Fixed now, should be back to the old behaviour.
I’ll add a directional arrow later today.

Sorry about not integrating any of your graphics yet, alongside general slow progress, I’m getting there.

Edit : Could you do a crate sprite for the other zoom levels? 4, 8 and 14px wide should do it, In the closed position only. I think we should have them disappear on use to save a bit of memory.

(Migz) #15

You are doing some awesome stuff here. I don’t feel this is slow progress.

A generic crate to hold items or a treasure chest in those sizes? (maybe both)

(Bruce) #16

Treasure chest please, same design as your adorable bouncing sprite.
A second one could be added no problem, but I’d wait until we’re 100% sure how much space is left after the code is all in and working.

(Migz) #17

Added Chest with LODs: https://github.com/MigZ1/LOOT/tree/master/LOOT%20Assets/Chest

(Cody) #18

In idle for the monsters why not have them bob

(Wade McGillis) #19

Since you access indices 0-11, line 22 needs to be
bool wallShow[12] = { };
instead of
bool wallShow[11] = { };

You’re accessing 12 indices total.


Looking snappy.

Don’t forget to RLE those big splash images, lots of blank space there.

(curly) #21

any progress with this?