About this blog
Development of a 3D maze game
Entries in this blog
This is just a reminder and some advice to all you developers, make sure you backup your data. Stop for a minute and think - what would happen if you lost your hard drive? If you were flooded? Shark attack:? OK maybe not but you get the idea. Something dramatic happens and your computer is trashed. Would you be able to start again? Would you have the motivation to start from scratch? It doesn't take much to protect yourself from the worst, and believe me, you will thank me one day.
1) buy a cheap 1gb memory stick and write on it 'Backup'. Don't use it for anything else.
2) Make sure you backup regularly. Once a week, once a month. Whenever. Just get into the routine of doing it.
3) Store your backup away from your computer. Put it in a different room in a safe place.
Thats it! You may be asking, why is he telling us this? Has something happened? Well no. But it could, and that's the point. You never know.
Last week I did a bit of work on lighting and applying normals to my walls. This gives the impression that they are made up of more than just a flat polygon. However because the viewpoint is so fixed (at 90 degrees and no vertical movement) it's really difficult to tell that the normals are even there! I might take them out at some point in the future, or put in a switch so I can turn them off if necessary.
So with the pathfinding in place, my engine is just about complete. I've implemented -
Procedural level generation
Mapped level generation
Movement with collision detection
Item management, with equipment/inventory screen
Interactive objects (doors etc)
wow, there's a lot of work gone into that lot! My next step is to start putting in the game elements and making it fun. The first step is to design a 'tutorial' level which introduces the elements of the game, tells you how to play, what are the goals etc. When I was playtesting other dungeon games, I found this was a big let down for some of them, there was no help at all so you didn't know how to play the game, what keys to press, what the goals were etc. I'm a big fan of in-built help systems and I think they are especially useful in an RPG game.
So I have started programming the first level, it is mapped rather than generated so it will be the same every time. I have a portrait graphic and a script which runs and gives you the basics from your Mission Controller, 'Theora'.
By the way I found this wonderful site, really useful if you are struggling for art assets.
I've been on holiday this week, so not got much done. Last time I got monsters in and randomly walking around, but when they see the player they should walk towards him and this calls for pathfinding.
There's a fantastic page here which explains how it works.
I could have downloaded a library but I thought it would be better to do it myself. Also I couldn't drop it straight into the game, because it would be a nightmare to debug in first person! I therefore programmed it as a separate function and I can just drop it in now. It's my own version of the algorithm called 'A+' because you can't travel in diagonals, just on the x and y axis. This is because the game is grid based (like Dungeon Master or Eye of the Beholder for example).
Here is a demo video, the starting point is the green square and the finishing point is the red square. Purple squares are checked (on the open list) and the blue line is the final path.
So all I need to do is replace the green square with the monsters x,y and the red square with the players x,y and it should work...
It was surprisingly easy to get the monsters in and animated, and facing the correct direction in relation to the player. Basically the player has one of 4 directions (0, 1, 2 and 3) and the monster has 1 of 4 directions (0, 1, 2 and 3) and you subtract the monsters direction from the players direction to give you which sprite to plot. If the result is less than 0 you add 4.
E.g. if player is facing East (1) and enemy facing South (2)
1-2 = -1
-1+4 = 3
Plot monster sprite 3. Repeat!
Have made a start on the combat today, I have populated the maze with a random amount of monsters and when you bump into one, the combat routine is called.
Currently it's realtime and you have to manage your heat compared to how much damage you can do. I am going to add a 'block' function and I also still need to put some weapons in, but the basics are there. I will also need to add a 'run away' option, in case things are getting bad!
I am also going to have to source some proper monster graphics, I'm just using googled images at the moment (I think the zombie monster is from Left for Dead!)
Onwards and upwards..............
Wow a whole 14fps quicker! But I still need to do some work to get it up to 60fps. Perhaps that is too high for a netbook, perhaps it only needs to be 30fps?
The plan is that eventually the game will be ported to iPhone/android but currently the target is a netbook. These devices have quite low graphics capability and are slower than regular desktop machines.
I've been testing my game on my netbook and as I've been adding stuff its been gradually getting slower and slower. Today I've done some optimisation to hopefully make it run a bit quicker.
The maze is made up of a series of textured cubes. Where there is a wall, there is a cube of 6 sides and 12 polygons. This is wasteful because you never see the top and bottom of the cube, and if you are in a corridor, chances are you will never see the sides either.
So I have replaced the cubes with flat polygons, and I'm only drawing what I need. I'll do some comparisons on the netbook later to work out if this is faster. (it runs at a smooth 60 fps on my desktop regardless of which method I use)
Also, the entire maze is being built before the player starts and I'm just moving the camera around. I could just draw the maze as I get to it, instead of generating it all at once. However this is a big change and I will probably leave it for the moment and come back to this topic later.
I've been working on the inventory screen today, have added -
Tooltips - when you hover the mouse over an item it will show you the details
Icons - each item is represented by a unique icon. This icon is displayed on the Inventory screen
Drag and Drop - You can click an item and drag it to another 'slot'. The item's icon follows the mouse as you hold down the button and when you let go, the item is moved to that slot. If the inventory slot is not empty, the items are swapped.
The number of Inventory and Heatsink slots change depending on the chassis you have installed. Bigger chassis mean more inventory space and more heatsink space.
It's still untidy because i'm using scratch graphics but the inventory background and the tooltips backgrounds are bitmaps so they can be redrawn at a later date with nice fonts, borders etc. I'm also displaying a bitmap of the chassis in the centre of the screen. I will add some animations and stuff later to make it a bit nicer to look at. I'm hoping it will look a bit like the inventory screen from this mech game I googled. Not exactly the same but the same style.
UI work is so boring!
This is my 3D maze game. It is designed to feel like an old-school RPG such as Dungeon Master, Eye of the Beholder, Dungeon Hack etc. I am posting this blog mainly to force myself to actually finish it, otherwise it will probably disappear into the ether like so many other projects I've started!
I have set myself milestone targets which I hope to hit regularly and will be updating this journal with screenshots, updates, problems etc.
Hope you enjoy!