Probably Should Have Made Snowflake Particles

Oh well I didn’t. I was more interested in makingĀ  a sparkly effect for my players’ combat abilities (i’ve got blue sparkles like the JPRG Atelier Feris for now – Little cartoony but it’ll do for now) and blood splatters when you get hit by a monster (yes probably a rat for now).

 

These effects now need a way of being triggered at the appropriate time but I ran out of time for now to make that bit happen. The effects die after a certain number of particles have done their thing so far and can be positioned anywhere.

Depth sorting on the particles works quite well with no noticeable detriment to the framerate.

I’ll need to fire off multiple copies of the same effect again so I made need to restructure this a bit some more but It’s working well as it for now.

Will I have time for another update before Christmas? I hope so..

I really want my rat causing bloodsplats and me hitting back with my blue glitter.. Hardcore stuff!

 

Kill 10 Rats

It’s really picking up speed towards being a vaguely playable game now. I’ll just make a quick list of what’s been added:

  • NPC/Enemies now have shadows.
  • Shiny fonts
  • Loot dialog box
  • Quest dialog box
  • Enemies hit back
  • Enemies can die
  • Enemies can drop a treasure chest

Most of this is rather crude and I’m not 100% happy with any of it really (except the shadows).

The font is annoyingly spaced out and the look doesn’t quite fit but it’s better than TTF Arial. I don’t really like my dialog boxes either but they’ll do for now.

The enemies die ridiculously (just flip on the their side).

The treasure chest is just the same model moved just in front of the player.

There’s no way of actually putting the loot from chest into your bag.

But DESPITE all that I’m really really happy with how it’s going. I mean you can actually walk somewhere near an enemy, target it and go into basic combat with it and kill it (and maybe get some loot). That’s huge. It’s basically the flow of the game finally working.

Some refactoring and general neatening up is needed and also I get to do a really fun bit – add a particle effect for when you get hit or when you hit an ememy. Looking forward to that.

Hopefully I’ll get another update in before Christmas..

Oh I made a new video of the combat and loot etc. Even in it’s crude state I’m pretty happy with the result.

 

Back in the Rat Race

I’m not obsessed with rats, honestly.

Ok right well after completely taking everything apart to finally get to the bottom of my shadow jiggling problem I decided that the best solution was to make my player the centre of the known universe. This was simple enough and didn’t require me rewriting my shaders or making TOO many changes. I won’t bore you with more waffle about shadows but in a nutshell the problem was that shadows worked perfect the closer to position 0,0,0 I was in the world. So therefore position 0,0,0 is now where ever the player is standing (and everything is drawn from that perspective. Sorted.

Moving on and back to the game finally..

Ok so now you can actually assign an ability to a hotbar position. There’s only 6 abilities for now, melee attacks (short and ranged), Magic attacks (short and long range), a self heal and a monster defencSe reducer. These all worked great straight away since I designed a nice ability object to which should cover quite a few different abilities, combat and otherwise,

I made a little video which demonstrates the new stable shadows (there’s a small wipe effect between the cascades but I really don’t care about that for now, there are many ways to hide that). It also demonstrates the basic combat with me against a huge and medium sized rat. They still don’t hit back so it’s a bit one sided.

So, next up:

  • Make the rats turn to face me more realistically
  • Make the rats follow me
  • Rats need shadows! (all well all monsters do)
  • Monsters need to hit back
  • Combat effects (started that but there’s nothing nice to see yet)
  • Monsters need to die – they just do.

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.