Building Builders

It’s not all sunshine and roses or whatever the expression is…

The last week or two were spent making “builders” to help my make my villagers (and other monster type things) behave how I want them to.

As you can see I ended up needing a bunch of panel of info to make a quest builder. This allows me to make quest steps of all different types (kill things, collect things, find a special thing, speak to someone or  go to a err special place). I can order them or allow them to be done simultaneously along with set any relevant text dialogue for the various NPCs.

This was a large (and not particularly exciting) slab of coding but hey, it’s done now. So now I can add 1 or more quests to an NPC.

In other news I had to do something about the bounding area of an roaming enemy. They can roam around in their area just fine but what about if they’re attacked (and therefore start to run after you) and get to the edge of their area? Well my solution was to allow them to go to twice the side of their bounding area once they’re attacked and if they get to the edge of that (ie that would probably mean you’ve run away) they will give up and spin around and head back to their area. While they’re heading back they’re also unattackable. This is pretty much how it works in Final Fantasy 14 and Everquest (not sure about World of Warcraft as I’ve never played it) and various other RPGs. I’ve never been 100% happy with that solution but the alternative aren’t that great either (monsters that chase you forever or you being allowed to just stand outside the monsters area and pick them off from range).

We have a new NPC type too. Female Peasant Roamer NPCs. Handily I found a way of using the same skeleton from the Male Peasant NPC so therefore I can use the same animation. At least as a base anyway, I can always tweak it.

This then means I need a “roamer builder”. She can’t just randomly roam around like a mad woman or zombie so she’ll need to follow a “script”. For now it’ll be moving from A to B, pause for x time, turn left/right. She can play a selected animation along with each step. With those step types I should be able to make her wander around the village in an eventual loop. Much like the West World characters although she won’t be quite as intelligent.

Some smaller stuff. The player now hold’s he weapon properly and I added a sparkle to follow his weapon when he attacks, like so:

stab.png

Oh and when a monster is killed it now updates the quest journal with a message to say that the player needs to kill more or that they’ve finished that step of the quest (also with a green tick). I’ll need to make it so you get your reward soon!

journal.png

And finally the slope is now checked to prevent you walking up sheer surfaces although that’s not perfect yet since you can turn at a shallow angle to the surface and creep up it slowly but I’ll fix that later by checking the slope angle (as suggested by a nice guy on the Monogame forum).

Until next time..

 

Roaming and Targetting

Ok loads of updates. Some of which took absolutely ages to get look reasonable.

First up I continued where I left off (which is rare for me since I tend to hop around rather a lot). So before I had it to a quest npc (a male peasant farmer) would offer you a quest to help him with a rodent problem. You can accept this quest and will be offered an item to help you complete the quest. A dagger in this case.

The quest object is added to the player object and appears in your journal a a quest name. Nothing too complicated there but it works pretty elegantly at least and lends itself to easily making so I can save the game state (ie the Player wants to quit and play something else – heaven forbid).

Ok so now I needed some rodents for said rodent problem. I already had my rats kinda walking in a straight line and following the terrain if i told them to however that’s all they did. Unless you attacked them in which case they will follow you to the ends of the earch (around 25km away in this case) and try and kill you. Since they hit for hardly anything that would take probably hours for a rat to kill you. These are, after all, the started quest monsters.

Anyway so I had to make the roam but not too far away from the farmers farm or else what kind of problem would he have exactly? “Oh these rats that are 10km away are bothering my crops?”. I’m not even sure rats eat corn.. but anyway. So the rats first had to roam within an invisible bounding box. That was simple enough,  I just had to add some code to the editor to allow you to set the min/max for the box and save it for each rat.

Now onto the roaming itself. There a simplistic AI for this. The rats have 8 different actions they can perform. One of these is randomly picked after a random time (only a second ish) and they will various in turning rate, speed, animation speed. Also they will avoid each other and try not to make it too obviously they’re in an invisible box.

Here’s a video showing how that looks. I’ll tweak it some more but i’m fairly happy with it:

So there you have it. Next up i’ll be making it so you can kill the rats (which already kinda is done) and make them respawn after a while. They will leave a corpse for a few minutes first and possibly even drop some treasure. Oo Treasure!

On a side note I’m really starting to see why there’s such a long list of people in the credit at the end os PS4 game. Wow there’s a lot of work. I’m glad I didn’t go with my original idea of making an MMORPG. I mean this isn’t going to be Witcher 3, let’s be realistic it’s also not going to cost £50-60. Also remember, No Man’s Sky was only 2-3 guys at first (6 in the end) and that was a pretty huge success. I loved it anyway.

Until next time.

 

Quest and Tasks

Ok lots more work behind the scenes with a bit more for you to actually see this time. So… NPC/Quest Characters can now have quests/tasks attached to them.

Quests contain some text for the name, what the quest giver will say to you to entice you to do the quest, an initial reward (for example something you’ll need to actually complete the quest) and any number of final rewards. Also, of course, it contains what you actually need to do.

When you select an NPC who has a quest for you he will talk to you about it and a summary of what you’ll need to do and what your reward will be with pop up too.

You can accept or decline this and then, if accepted, then “Quest Accepted” will dramatically appear and the quest object is attached to your player object.

quest2.png

Before this of course I needed to actually make a version of my villager that wasn’t a merchant (I only had a merchant). He stands by his farm and fidget a bit (weird how hard it is to make a fidget animation not look ridiculous). He’s also set as a different type of NPC so now I have enemies, merchants and quest/task npcs. And as I mentioned above npcs can have quests attached to them.

I also had to find a nice shiny font which I semi copied from Final Fantasy 14 (not literally – just based on before i get sued). There’s is far nicer than mine but I’m happy enough with the result.

Next up I need to make the initial quest reward appear (I’ve made a dialog for this already) and then when you accept it, it will appear in you bag and you should be able to use it (a dagger in this case).. So yeah a lot to do before you can complete a whole quest cycle (get – do- get reward) but that’s what I’m aiming for.

I keep seeing mist rising from trees in films and TV shows. I’d really like to add that effect to my game but I have to resist adding effect after I found myself spending 2 months getting ground fog looking just right.

Anyway, until next time…

 

Realm of Buttons

Well it’s not all swords and sorcery, sometimes you have to focus for a little while on the little things. In this case buttons and icons.

The game now has items which can have all manner of different attributes attached to them. Things like their quality, value, weights and they can also have any number of required skills attached to them (ie so your could  carry a crossbow in your bag but you couldn’t actually used it with no knowledge of say bows and maybe specifically heavy crossbows – or maybe with some penalty without all the required skills).

Items all needed an icon to represent them so I added in a few items for starters: A basic healing potions, a dagger, a mysterious scroll, a leather belt, a chain mails hat and leggings and a couple of others.

The Character Screen’s Inventory tab now allows you to click and move items around to arrange them in your bag and have your character use them by dragging and dropping them over the relevant equipment slot. Like so:

buttons2

That all works rather well and is hopefully pretty standard stuff for role playing game fans. I’ve done it in a kind of Dungeon Master style but in more of a Final Fantasy 14 layout (without the confusing armory chest idea that I wasn’t a fan of).

Another screen I needed was for when you open a chest or a merchant or villager gives you an item. This is the “Reward Screen” which is the featured image at the top.

And finally I needed yet more buttons for you to be able to answer questions from the villagers and merchants about transactions or accepting some task they offer you (also I had to make it so you could only actually talk to a villager from a reasonable distance away). So the buttons for this are like the screenshot below:

buttons1

So what’s next?

Well, I need to tie all this together now so I have story line for the game planned out but I don’t really want to start making that yet until all the pieces work together. So next up is to make it so an NPC (villager) can offer you an item (A dagger), which you can then equip in your weapon slot. He will also offer you a question to help with the rat problem they have West of the village (a classic kill 10 rats quest). After you kill a few rats (lets make it 3 just to be different) then you can return to the villager and he will give you a reward (a healing potion). If all that hangs together then I have rewards working, inventory working, quests working, combat working and well.. lots of stuff working.

Exciting stuff.

Until next time…

Editing the Realm

Well, loads to tell.

From the picture above you can see I “slung” together a basic terrain editor. This isn’t for reshaping mountains or making huge changes to the world (ie use my terrain generator for that). This is for tweeking the odd nasty pointy hill or overly sleep slope. It was rather complex in the end since it had to find the exact patch of terrain to edit then match up the height with the heightmap (the aerial view of the terrain that determines how height each square meter of the terrain is.

I’d been wanting to do that for a while but I thought it would be too much of a pain. Then I read some post somewhere about using SetData on the vertex buffer after adjusting the position of one of them. I always thought that would be too complex but since my world is centred on the player (0,0,0) it wasn’t so bad to work out. I won’t bore you further with the details.

Other things.

I imported a load more rocks and trees. I think I really do have enough of those now.

morerocks

So yeah those look nice I think (there’s some mossy ones around but i’ll probably show those in the video).

I’ve done a lot of work behind the scenes on the actual player class. He/she/it now has lots of data attached to them like their name, experience, level, health, power and I made a base skills class which initially just has a dagger skill. The thought being that each item can have a required skill attached to it (or multiple skills or none) for you to be able to use it or at least use it effectively.

That done I moved on to making a character screen, I combined the look of the Final Fantasy 14 one with the look of a more classic RPG. It will have tabs for your skills and stats, equipment and quests. I’m trying to avoid making windows open all over (ie like Everquest) and try and keep the interface as user friendly as possible.

Here is the initial layout, the tabs and data will go on the right.

characterscreen

I’m not 1005 happy with it yet at all but I’ll try not to get too bogged down with making it look perfect and get on with making it usable.

Well that’s it for now.

Until next time…

Rats and Shopkeepers

It’s been a couple of week since my last post but that doesn’t mean that not much has been done in term of getting the world together.

First up I worked on getting some nice dialog boxes (and a font (SpriteFont if you’re interested) and a papery texture for the font to go on. This was inspired by Final Fantasy 14 (ARR)’s dialog boxes but it’s not close enough to get me sued. Could someone sue you over dialog boxes being too similar? Probably.

Anyway after fiddling with fire some more I made the editor able to handle animated models better and fixed up a really deeply hidden bug in the instanced grass I moved on to getting some new trees and bushes in. I added total of 7 types of tree, 3 flowers, 2 bushes and 2 shrubs. That should be plenty to keep things looking interesting.

Here is a video of a few of the things I just discussed.

NPC’s can now have a ton of attributes edited as you can see from that video. I followed one of my one roam rats all the way to a mountain to see if it would roam the terrain nicely and it did. It’s amazing how watching something you wrote actually work can bring you so much pleasure.

Until next time..

 

Animation and Tiny Details

It’s amazing how much time you can spend on the really small things. For example my flaming brazers took up way too much more time. My fault.. I spotted them in Final Fantasy 14 and though “Damn they’re way better than mine”. So I found a better flame texture, added a surrounding glow and that improved things no end. I wanted them to start off slightly blueish and fade to the orangey color as they fade away completely….

This then led to me finding a bug where my colors weren’t even being used at all (was just defaulting from fading from white to white). That was a pain to track down but the result is much nicer flames which look realy realistic now. I’ll put them in a video another time.

The other, somewhat daunting task, is to make the NPC class support animated models. As you can see from the screenshot above, I succeeded in that. But again, this meant a fair bit of work behind the scenes cleaning up the animated model class to use the same shared texture resources as static models and also make the npc class supported by the editor with extra data (like animations and how fast to play them). A headache to say the least.

Feel like I didn’t make THAT much progress when I don’t have a pretty new video to show but I had to make the support for things for the player to interact with a lot more sophisticated or else it would just be a world of roaming non-animated rats. Not a world I’d want to live in anyway..

Until next time.