Wednesday, 25 May 2011

Long time no write

Yeah, well progress is happening, slowly; exercise seems to have gotten in the way as well as other diversions.
Well yes, I was working on inventory management getting items to be picked up and slotted in the first available space was rather simple, picking up an item was quite simple, swapping the picked up item and the item beneath it was a little trickier but eventually was solved.
Looking at my code I can't help but feel there is a little bit of redundancy in there somewhere, it's being implemented as a bag has an inventory grid and a list of items, each inventory grid has a number which correlates to the position of the item in the corresponding list. Each item then has a position within that bag and an x and y size, equating to the same information as the inventory grid, the item also knows which bag it is in or if it is on the map (i think that information is redundant, it wasn't when I was implementing the inventory in a slightly different way) but any that's enough rambling.



I promised myself I'd look at targeting next, I'm feeling like there should be some stepping out checking squares in a 45 degree arc (dependent on the direction selected) to see if there is anything there, items or monsters that the player can see or has seen. What is under the cursor should be relayed to the player. There should also be an option for looking at every single tile or just the important things, monsters/interactable features (items, doors, stairs), although given it is a graphical roguelike maybe the visual feedback will be enough for non-interactable objects that can easily be recongised (doors, stairs and the like).

Thursday, 21 April 2011

Mini-update

For some reason time has been skipping by at a rate of knots without me touching the keyboard as much as I should, well at least in the way which leads me to program my game.

Some progress has been made though, items are visualised on the map and in the inventory and a cursor can scroll about the inventory. When an item is picked up it automatically finds the first space available in any of your bags.

Next on the to do list, is to implement moving items around in the inventory and dropping items.

Sunday, 10 April 2011

Lists are handy

So a wee little update on what has been crossed off the list so far, oh and when I've said it is done, it's more like the mechanic is in place but future refinements will be needed.

Combat feedback - done
Complete with warnings of when you are injured, bloodied or critical, <99%, <50% and <10% respectively.

Death Screen - done
Complete with a picture of the brute who killed you and space for sarky failure comments in the future.

Targeting System - not done
Mainly because I needed items to target and scroll through as well as monsters.

Item/Equipment System - getting there
Structures have been set up for items and the players inventory, including bags, at the moment equipable slots consist of the following.

Head, eyes, neck, ring left hand, ring right hand, shoulders, arms, wrists, hands, torso, belt, legs, feet, back, main hand, off hand, backpack, satchel, belt pouch.

with possibility of "feats" that increase the amount of equipable slots you have.

Items programmed so far include

container, weapon, weapon components, coins

for future inclusion

armour (for all body locations), rings, amulets, belts, quivers, glasses, mask, potions (including tonics and tinctures), scrap, shields, guns, bandoleer, food and probably many more.

Saturday, 2 April 2011

Story Time!

As mentioned previously there may be a little bit of a plot bobbing around the whole game. Here is just a little taster of what is going on.


*image of a steam train running along it's tracks along some green countryside, possible abandoned towns or ruins in the background*  
"It is 2218 in the reign of Her Royal Highness Victoria VII, Queen of England, Empress of the British Empire and ultimately your patron and benefactor. 
*sound of shots being fired and screams of dying men, silhouettes of men with swords and pistol vs rifle and bayonet*  
It has been three decades since the last prodigious conflict was fought between any of the twelve influential Empires. 
*Show a map with the various Empires*  
A state of peace through necessity has come about, the powers of each being so balanced that if one were to attack then the resultant advantage of the increased resources would trigger the others to enter the fray, and the question of who would emerge victorious would be in the hands of the Gods. 
*back to the steam train, slowly zooming in on a carriage window*
It is your duty to be the eyes and ears of the Her Majesty, you have been trained in many arts unique to G.L.A.I.V.E personnel. 
"Do your duty in all things. You cannot do more, you should never wish to do less." Robert E. Lee 
*Cut to the character generation screen*
*Show a dossier marked Most Private the below text is overlaid* 
 Your mission is to investigate any untoward technology from other Empires that may destroy the delicate stasis, if you uncover any you must find the source and either eradicate or procure it as the situation dictates. 
The world technology exhibition is your primary area of concern, but after the conclusion of the fair you are to stay in the surrounding area for a six month period as it has been rumoured that scientists in the area have been making unusual progress with their experimentations."
So yes, this is still very much a work in progress, the Empires are to be worked out and I like the idea of adding in a few more Victorian quotes.


If you can guess the acronym I would be very impressed.

Friday, 1 April 2011

Featurific

Well I've been poking and hacking at my code for the past week or two now and what do I have to show?
Quite a bit actually.

First of all I've been getting the basic monster AI to work, they will now happily run toward our hero when they have heard him and hack at his legs until they get turned into gobbits of xp.
Secondly I've updated the lighting algorithm so that seen areas that are not lit are in a darker shade.
Third new feature is a scrolling option, by holding down left trigger or left shift the player can move the map around to see what's off the screen.




What next to implement, good question, there are many things on my horizon, but in rough priority order:

Combat feedback
Death screen and restarting of the game
Targeting System
Items and Inventory
Advanced monster AI
Options screen
Save/Load Option Data
Monster/Item editor
Load Monster Data

Saturday, 19 March 2011

Dijkstra's AI!

Taking some inspiration from Roguebasin, yes I'd love to say any of these mechanics are actually original and mine alone but no, they aren't, yet. It just seems a waste of time to figure out the most efficient way of doing things when people have already found them out, I've taken algorithm ideas from the web but programmed them myself apart from the ones that are included in the XNA platform.

Anyway I got a bit distracted, yes Dijkstra, he was the man who came up with a solution to finding the shortest path between two points on a graph. I've adapted this idea to produce an "AI map" which allows a monster to use the map to head towards it's goal, at the moment I have just implemented the player as a target, so the monsters can now navigate the terrain and find the player from anywhere on the map, hurrah!
At the moment though the combat system is in it's infancy and only one way so the poor little monsters don't stand a chance, boo!
Soon I'll put that right, oh yes, I will.

To keep to subject the idea of the AI map is quite powerful, one could for example make a map to flee from the player or to head towards an item and nab it or even head towards it's friends till there are enough of them that they think tackling the player is a good idea.
If I add a system where the monster is given a weighted chance of which map to follow, perhaps for a given number of turns or until another condition is met, then some quite interesting emergent behaviour could follow, that is until the player caves the poor little monster's head in.

Still to come - time/combat system...

Time for an upgrade

It was niggling at me, bit by bit, every time I went to Microsoft's api for XNA it kept saying version 4 and I knew I was on version 3.1, I kept putting it off like one of those awkward conversations, until I decided to take the plunge.
Taking the appropriate steps, like crossing my fingers, making a backup and praying to the Tetris God I dove in head first.
It went quite painlessly to be honest, there was one minor change in one of the spritebatch methods (the method's that display 2D sprites on screen, apparently additive alpha channels were gone and it is now multiplicative), half an hour got the code working again.

But that wasn't all I wanted to upgrade, I was also interested in perfecting the lighting algorithm before I got on to anything serious like AI as it will also be acting as my line of sight algorithm, looking through the various algorithms on roguebasin. I decided to go for Restrictive Precise Angle Shadowcasting because it claimed to produce no artifacts(glitches), was fast and I actually understood what it was trying to do, so debugging my code  would be easier.
It sounded very simple, you work out each eighth of a circle seperately, you assign the cells angles by dividing 1 by the number of cells in the row and assigning start mid and end angles, if the square is a blocking square ie a wall, you say that all cells after that have angles between the and blah blah blah, click the link if you want to see the details.
After implementing it, I seemed to be getting artifacts, so I studied the code of the guy who has actually implemented it and it seems he omitted to mention that you need to check if the cells in the previous row were blocked. So a few typos in my code and many hours later, I ended up with a fully functioning lighting system.


Still on the horizon, monster AI and time/combat system.

Sunday, 13 March 2011

I've seen the light!

Or rather anyone in the game whose field of view sees the light from a light source can. Dungeon now looks blank outside of the light radius, except for walls which remain on the map whether you can see them or not. Light radius algorithm also acts as a field of view algorithm.
Unfortunately I'm not quite happy with it, at the moment it spreads rays from the centre of the character and counts a square is in view if the square is traversed 1 pixel along the line, unfortunately that produces situations where A can see B, but B cannot see A.
I'll revisit it in the future and come up with a better algorithm that doesn't visit the same squares multiple times, but the time being something that functions is better than something that doesn't.

Monsters have been displayed on the map and carry their own light sources, well monster type singular, a kobold, more will be introduced of course.

Still debating on the size of the graphics tile's I will be setting as standard, at the moment they are 25*25 which may be a bit large, I might take it down to 16*16.

Next up will be a combat system, first of all the player hitting monster and the monster dying, then figuring out some kind of turn counter and allowing the monster to fight back. After that monster hunting algorithms will be needed so they stand a chance against the over powered adventurers.

Wednesday, 9 March 2011

Slow and steady wins the race, right?

A couple more features have been added!

I should have a check list somewhere that I can tick off, but that sounds like more effort than it is worth at the moment.
First of all we have a main menu, it's not much, but it displays the menu items, then a method to boxes a String of text if the menu item is selected and then enabling the user to switch between menu options and implementing the change of the game from main menu to "dungeon" when New Game is selected.
Oh yeah, the boxes surrounding the menu items glow, well more of a pulsate I guess.
Second we have the scrolling, scrolling has been implemented to centre on the current character, scrolling the screen by 1/6th of the screen width if the character gets within 1/6th of the screens width. These options may change, or indeed be implemented as options.

I'm quite sure I want the characters to be able to be controlled independently, but in the main I want the player to have the party on follow and the other characters to act as support. Thinking about it I may introduce a party time mode, bit like bullet time, whereby you can control all of the characters at once independently.

Tuesday, 8 March 2011

Just a sheep

It seems rather popular at the moment, opening your design decisions to the world. I don't have the hopes of attracting the masses to this blog, it's more a space for my thought processes to be nailed down and to document the journey.

In fact this first existed as just an OpenOffice document (you might be able to spot as OpenOffice insisted with it's red undulating scrawl that it be capitalised not just once but twice). This was mainly because when faced with the task of naming the blog a blank space just opened up in my mind and was flooded with possibilities, is this going to be my development blog, perhaps a space for all my programming attempts or was it going to be just this game, this Cogband-esque effort?

I think i'd pretty much decided it was going to be the page for just this game, for better or worse it might motivate me to completion. 


I suppose you might want to know what kind of game I'm planning, well it's based on a category of games called roguelikes, except I have planned for a few deviations from the norm, using non-ASCII art for a start and actually having a plot, if the player ever finds out about it that is.

Projects usually start small with some ambition, lets get a list of what I think is going to be included in this game.
  • A starting roleplaying scenario to choose initial party composition, I'm afraid there is going to be a story.
  • Multiple Party Members – with programmable actions.
  • A Marching order that adapts to the dungeon layout.
  • Adjustable and adaptable weapons, upgradeable via cogs, pipes, valves, blades and other components. Inspired by Resonance of Fate.
  • Upgradeable towns.

Then the standard stuff
  • Combat system
  • Randomly generated dungeons
  • End game goal.
  • Deep and varied equipment
  • Customizable characters – Via skill trees and other means.
  • Stat allocation

So far I have
  • A window that shows a stats bar at the bottom of the screen,
  • The ability to change which character you are controlling and which is being displayed in the stats screen.
  • A very poorly randomly generated map.
  • Detection of characters bumping into walls.
  • Window that works with adjustable tile sizes and map sizes.





Next

Work on camera and scroll bars if necessary to view dungeon. Centring on current player optional of course.
Menu for launching the game/load/save.

One big thing about my code, is I'm trying to make as many things as possible optional or at least adjustable, probably going to have the biggest option menu ever.