0 favourites

Tags


Subscribe

Get emailed when there are new posts!

Stats

  • 554 words
  • ~2-4 mins read time
  • Published
  • 212 visits
  • 65.1 visits per week
  • 270 page views

License

This blog post is licensed Creative Common Attribution Required v4.0.

Share

Enjoy this blog? Share with your contacts!

Share now

Laura_D's avatar
Medal
Construct Team Community Manager

That’s right, the title says it all, I am DONE with NPCs. For the moment anyway.

On Tuesday’s stream, I put in the last bit of code to make sure that my NPCs moved how they should. Sure, it needs a bit of tweaking here and there, but largely it works.

So, the game now has:

  • Static NPCs which stay in one spot and only move when the player interacts with them. The only available movement for them is to change direction. When I implement the battle system, I’ll be giving them a way to walk towards the player when they see them. Same goes for the rest of the NPCs.
  • Rotating NPCs which either spin around in a standard clockwise/anticlockwise fashion or pick a random direction every so often. These are actually two separate object types, one for random and one for non-random and they make use of different instance variables accordingly.
  • Set Path NPCs which follow a path defined by ‘mover’ objects. Basically, these guys have a variable that sets their movement direction, and when they hit a mover object, they take on the same direction as assigned to the mover. There are also variables to control their speed, how long they wait before changing direction etc. It’s quite customisable!
  • And finally, the bane of my life – Random Path NPCs. The basic idea was simple enough but trying to get it so that they wouldn’t continuously walk into walls was harder than I realised. We looked at choosing, arrays, but in the end TechBoxNorth sent me an example using Booleans, and that’s what I’ve gone with. So, depending on which directions are available to move to, the Booleans are either set to true or false. Then the NPC picks a new direction based on the Booleans which are true. It’s a good little system, if a bit of a pain to do initially. But, it’s easy enough to understand and copes with multiple instances perfectly.

There’s also some placeholder code for allowing the player to talk to these NPCs. Currently, it just calls a function that makes the NPC disappear briefly (purely so we know the function is being called) but I am hoping to replace that with the dialogue system – my next major task.

Side note – I put all the interaction system in myself, and I am SO proud! It’s the little things.

So, next steps? Well, I’ve started planning the tutorial to go with this NPC system and I need to tweak my example project to make it ready to share. Then in terms of the game itself, I’ll be looking at implementing dialogue for signs and NPCs. This should be fun.

Also, thanks to Skymen for recommending that I play Aline on Thursday – despite it freaking me out, it was good to play something unlike anything I have before. And I have to say, it’s impressive how atmospheric the developer made that game. I will admit I was sceptical when I looked at some screenshots, but I am always happy to be proven wrong about this sort of thing!

I think we’re going to give Healer’s Quest a go next Thursday, but remember if you do have any suggestions for games, please do pop them into the suggestions box on our Twitch channel!

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!