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.