HERE'S THE GAME :>
So, day 6. Only ONE DAY LEFT! I’m nearly there, even though I have again been awake for over 24 hours, I’m only now getting tired. Today I’ve been working on what partially inspired me to start this challenge – a dungeon crawler. My goal was to create something akin to Moraff’s World, which was kind of a roguelike, but from first person perspective. to deal with lack of peripheral vision, it displayed the world through four cameras – one for each direction.
I started by creating couple textures: for Thong Goblin, Gold, Ladder Down, ceiling, floor and walls. Yeah, I know that programming is more important than art, and I should stick to temporary graphics till I’m done, but I’ve enjoyed working in C64′s 16 colour palette so much yesterday, that I wanted more of it. Being limited really does make you think more carefully about which colour to use to achieve what effect. Also, because of that, I created name for the game: DITHER CASTLE . I wrote a quick billboard class, so that 2D sprites in the world would always be looking at the camera. (speaking of camera, I’ve learned how to use split/multiscreen)
So, after wasting some time on making myself feel better, I’ve started working on the game. Firstly, I needed some kind of level generation. I have already been working on procedural dungeon generators, but it was mostly for Diablo-like levels (which, as far as level generation was considered, had zero thickness walls). After several failed attempts, I have managed to write something decent, here’s the algorithm, maybe it’ll be useful:
1) Generate X rooms (X is most likely some random number between minRooms and maxRooms). The rooms can overlap, actually, if they do, it sometimes looks better. So your only worry is to create them in a way that makes them fit on the screen.
2) Create a list (vector in C++ most likely) ‘unvisited’, and put all rooms on it.
3) Create a list ‘visited’. Put first element of ‘unvisited’ list on it
4) Find closest to it room on the ‘unvisited’.
5) iterate over all rooms on visited (1 so far), and check which one is closest to the new room.
6) connect the rooms (here’s my algorithm)
6a) pick a random tile within both rooms (as defined by Room class – origin.x/origin.z (y is up), width/height, or something to those extents)
6b) from one of the tiles, check difference between X an Z coordinates of two tiles (y is up still).
6c) if vertical difference is greater than 0, move one square in that direction, mark the tile as clean/empty/floor/whatever
6d) if vertical difference is still greater than 0, go back to 6d)
6e) once you’ve created vertical route, do the same (one by one ‘eat’ tiles)
There. Really simple, and looks quite nice:
After the levels were created, I’ve started adding features:
First was ladder to a new level, which just picked random room (but not player starting room), and when you collide with it, it generates the next level.
Second came AI. This was really simple, just a bunch of ‘move towards player, check for collisions’ routines, and it was good enough for the demo.
Then came player stats. I decided to make a scene with player creation, and I had to learn how to share variables between different scenes (turns out it’s incredibly simple in Unity – just use PlayerPref.Set/Get Int/String/Float(), and you’re done. I decided to create 3 classes for the player, and following mechanics:
Character consists of: HP/MaxHP, Strength, Dexterity, Constitution, Minimum Damage, Maximum Damage, Gold carried. Base stats were calculated by rolling six sided die (or, to be precise, Random.Range(1,6) ), and adding 6 to the result. Also, each class has one ‘strong’ stat, and one ‘weak’ stat.
Berserker gets +3 to Strength, -1 to Constitution
Warrior gets +3 to Constitution, -1 to Dexterity
Monk gets +3 to Dexterity, -1 to Strength
Combat is calculated by comparing attacker’s Strength score + result of rolling a six sided die, and defender’s Dexterity + result of rolling a six sided die. If attacker wins that, he then subtracts from defender’s HP random score between his min and max damage. If player dies, well then, he dies and is taken to results window, which shows how much gold he managed to collect, but if he wins, then monster dies and drops the gold he’s been carrying (determined by kind of monster, dungeon level, and – as always – chance).
Speaking of monsters, we have 3 of them, from common Thong Goblins, through strong Cookie Monsters, to incredibly powerful Christmas Elementals. More powerful monsters start appearing the lower in the dungeon you are.
So, what else? I sprinkle the dungeon with gold, but obviously would like to add more enemies, items (currently we only have gold as pickable. there is even no inventory).
What more would I want to fix? Well, there’s a problem with converting floats to integers, and since I use sometimes floats, sometimes ints (because I was lazy), then at times you encounter invisible wall where you should be able to pass freely. That’s the reasong [D]ie shortcut was added :/. Also, since I didn’t have any place left on screen, I didn’t put any output telling you what you pick up, or how much damage you do. Same is the reason why [L]ook command doesn’t work, and it’s a damn shame, because i put funny descriptions there .
Since it’s already 13:40 on Sunday as I’m writing it, I don’t think that I’ll be finishing 7th game today – I need to prepare some code for owrk on Monday as well. I will try however, and as always – keep you posted. Before I go, let’s look at our the game list again
- Strategy game.
And here is a list of the entries in the series:
Last Day summary and Challenge Post Mortem
Ludum Dare preparation
Day 6 summary
Day 5 summary
Day 4 summary
Day 3 summary
Day 2 summary
Day 1 summary
Series kick off
Ta ta for now!