Man vs Rat

Ok sorry for the lack of updates, I’ve been on holiday/vacation. Didn’t stop me reading about shadows though. It’s such an annoyingly massive topic and although my shadows are just about acceptable there’s still an annoying amount of jiggle.

Alex who wrote Cascaded Shadow Maps With Soft Shadows has been helping me with this a quite a bit and has kindly donated some of his time to help me solve the jiggle. Unfortunately it’s not entirely gone but it’s much improved and I’ve learned a lot anyway so that’s always useful. I will have to come back to it or else I’ll end up with beautiful shadows in a few weeks/months/years and no game.

Anyway, enough about shadows! What have I been working on? Well… quite a bit. I have come to the point where I had to decide what I was doing about the stats of the players and enemies. What determines how hard they hit, how much they can avoid, how much power they have etc. Well for now I’ve gone with the classic D&D style stats of:

  • Strength: How hard you hit and how much you can carry
  • Dexterity: How hard ranged attacks hit and how far they can travel.
  • Intelligence: How hard your spells hit.
  • Wisdom: How much power you have and how much health you can heal.
  • Stamina: How much health you have.
  • Charisma: Affects prices from merchants and how much you can resist certain enemy spells(?).

Along with that I set some other basic stats like maximum health, current health, power and gold.

Both the player and all NPCs have these along with some other minor details like if they’re dead or not.

But that’s not all! (overly dramatic) NPC’s now roam around over the hills. I had to do some rather annoying math to get them to nicely follow the terrain. I don’t just mean their position above the terrain the have to tilt and roll to the angle of the terrain or they look ridiculous. That wasn’t THAT bad though and the effect is great. Very useful too. I need to add a button to my editor to make an object (a rock or a building etc) snap to rotate to the orientation of the terrain. I do that manually now so that would be great.

Also the hotbar how lots of shiny new icons (not made by me but bought and tweaked by mean). Nice aren’t they? Anyway not only can you now hit a targeted rat, it will turn to face you (rather abruptly for now) and it’s health will go down. And there’s even more! (Ok this is getting a little silly sounding now but I really have added a lot). The game now calculated the range from the player to the targeted enemy to make sure you’re close enough for the selected attack.

I’m aiming to have the whole combat cycle. Kill or be killed by next time so.. until then.

 

Terrain Following Rats and Death

A bit of a weird and overly dramatic sounding blog title but anyway..

Ok more stuff behind the scenes. I’ve added load more attributes to npcs and made them editable. I realised I’d need my enemies to be able to follow the terrain like the player does but I didn’t account for the fact the non-bipedal creature don’t stay upright (like giant rats for example) when they run up hills. I guess humans don’t entirely but it doesn’t look ridiculous if they do.

In the screenshot above I’ve targeted a rat and I’m about to hit it with something and as you can see both rats look sort of ok but they should really be tilted to the terrain they’re on. I’ll have that working by the next blog post and that a promise. If you’re interested it’s not actually THAT complicated. Using the usual algorithm for calculating the height at an exact point of a triangle (you can find that anywhere on Elgooglado – no one call it that btw), you find the front and back height of the model and calculate the diference between and then using that different the angle you need to rotate the model about it’s X and Z axis. Not my work, some maths genius somewhere worked that out already so no need for me to devote my life to it.

ratterrainfollowing

This screen shot shows all the new attributes (I’m going to need a scrollbar or 2nd page for them clearly) and the terrain following kinda working. The rat closest looks good but the far one needs to be rotated sideways a bit (rolled in Roll, Pitch, Yaw terms).

Ok well the game interface also detects mouse clicks over the hotbar icons and whether something is targeted so now to make some basic combat code.

I also played with a particle emitter for blood splats or magic sparkles or whatever when you actually DO hit something but that’s not ready for public consumption yet.

Oh and the reason for “Death” in the title, NPCs can now be attackable (or not) and be dead. Right now if they’re dead they’re just rotated on their side. Obviously once I switch the NPC class over to using the AnimatedModel class they’ll play their death animation and end at the final dramatic pose.

Ok until next week: “Beware of Merinsard!” said the dark figure and rode away into the gloom.

Roads of the Realm

Sorry no update last week but I’ve been hard at work (at work too unfortunately).

The realm now has double blend maps so I can have grassy road or roady grass (whatever that means) or snow or whatever else really..

If you’re interested I’ll show you how it’s done. There’s basically a map of where the grass/rock/other should be that’s red for say grass, blue for rock and, green for mud. These can be blended together too. The more red the more grass, the more green the more mud etc.

Oh.. here.. a picture (or two) tell’s a thousand words..

blend1

So that’s blend map 1. Currently used for grass, rock, mud. And blend map 2..

blend2

Which is currently used for cobbled road and snow and something undecided. maybe another type of rock or gravel. We’ll see.

The end result in the screenshot at the top of this post.

I’ve also been deep in the bowels of the game code making the NPCs (non-player characters) which are, in this case, giant rats have attributes so they can be involved in combat of some kind.

I made a crude but effective editor for this too.

npcstats

See? I’ve been hard at work since my last post.

I need to get my rats to follow the slope of the terrain properly since that doesn’t work and I still haven’t fixed the jiggly shadow bug for medium quality shadows. The NPCs need to generate shadows too.

Really trying to keep focused on getting an actual game that people can really play rather than small details like that though.

I’m thinking of switching out the log walled town walls for something in stone since i’m not sure they fit well with the more modern buildings. Some historian could probably tell me. The town needs a name.

Comments and suggestions welcome!

Till next time..

Flying Rat Army

My screenshots are getting a bit less pretty lately but I thought it might be interesting to show how I’m going about adding enemies/NPCs to the game.

Using a variation of my normal entity (rocks, walls, buildings etc) editor I am able to move rotate and scale my errr monsters or whatever. From the screenshot above you can see there’s a panel with space for the rat’s attributes like health, defence, attack power and other stats.

I feel like some form of combat is on the horizon I’m taking a slight diversion to add double blend maps to my terrain so I can have snow on the caps of the mountains and cobbles on the floor in towns etc.

Still have the jiggly shadow from problem with mid range shadows but I have plenty of resources to read on how to fix that. Other than that everything is moving along at quite a pace finally.

Better when I don’t spend 2 months getting the fog to look just right.

Behind The Scenes Pt2

Well there’s not much to show visually. So much behind the scenes to do to get combat basically working.

Ok I needed to create an NPC class to store stats about them (just health, power, attack and defence for now). The player needed those too but that’s nice and simple.

I had to improve the editor so it would allow to be able to flip between editing static entities (trees, rocks, houses) and moveable, targetable things like peasants and giant rats.

That means I need to save and load npc data seperately. All the attributes about each npc.

.. yeah as I said it’s a bit of a boring update but it has to be done.

Oh one interesting thing you can see from the screen shot is where it says “rat hp” near where the rat enemy is. This is an UNprojected 3D coordinate of where the rat is. That means if he’s targetted you’ll be able to see his target arrow, name, health etc even through walls and stuff. That’s kinda how WoW/EQ2 work. Maybe i’ll depth sort it and NOT do that at some point but I like it for now. Comments would be appreciated.

I should be able to place roaming enemies and attack them soon. That sounds more fun.

 

The Blending of the Realm

Ok so lots of new stuff. Yay.

Firstly you can see there’s a working health and power bar. How power is used it’s entirely decided but it’s there and it works which is most important for now.

After all the behind the scenes stuff it was nice to just work on the game again. So now you can target other entities (NPC’s, animals etc) with the spinning targeting arrow. So there’s that.

I spend an annoying amount of time fiddling with the jiggly shadows problem which I promised I’d leave alone for now. It’s not THAT tough to fix I just haven’t figured it out yet. I will but I just don’t want to get too bogged down in a minor visual problem.

Talking of annoying problems, I wanted to get my peasant male/female models standing in a sensible rest position. I managed that eventually. I think I really need to leave SoftImage and learn 3DS though. SoftImage just doesn’t seem to like exporting FBXs that anything actually likes unless you do everything “just so” and even then you sometimes end up with a distorted mess.

Another big leap forward was the ability to be able to edit the texture of the ground using the editor (rather than the blend map in GIMP which just isn’t really practice in a 50km terrain). So this is exactly what I did, it’s not remotely perfect but I think you get the idea of the beginnings of it from the video capture below.

I’ll probably have to work out some kind of rudimentary combat soon. Kinda exciting.

Have a look at this:

Terrain Blend Map EditingĀ 

Seeya next week!

 

 

Targeting Behind The Scenes

Hmm sometimes the life of a game developer isn’t all swords and sorcery. Lot’s of fairly dull behind the scenes stuff was done this week.

Animation reared it’s ugly head again and yet again i THINK I’ve solved the problem. I won’t even bore you with the details – and I really don’t want to be writing another post about animation (the problem seemed to be that my FBX importer doesn’t like root’s of bones being rotated – anyway that’s really dull).

I wanted to move towards actual combat with the picture rat so of course I need some way of targeting it. For now I’ve gone for the Everquest/WoW targeting arrow style. The reminded me that I already had a renderer for transparent models which works quite well. So I needed to make a targetting classes so the spinning pyramid could be attached to other game objects. As you can see in this picture I’ve targetted myself.

Luckily (or not really lucky at all) I already have a nice “picking” routine for my editor to allow me to select a house or a fench or whatever and move/rotate/scale it so I can use that to select the monster that I’m going to attempt to send to a higher plane of existance.

Oh and I made the blendmap higher resolution so I can change from grass to gravel to mud or whatever over a smaller area of land. I may well use a double blendmap to allow me to have 6 textures on the terrain but we’ll see. Maybe I can use the alpha channel in a png blendmap but that didn’t seem to work last time I tried it.

Here’s hoping for a more interesting update next week.