Question of interest : how do you make NPC harassing you?

Just want to get ideas :slight_smile: The npc is searching for contact . (Im working on fighting game)

Take into consideration movement, distance, attack range, remaining health and energy, etcétera in relation to the player, then build rules out of that. Guard down and fairly close? Punch. Low on health and running away? Pursue. Lower movement speed? Hit and run.

Side note is sometimes a little bit of stupid makes good AI. Deliberately having goons make mistakes from time to time gives them more of a human-like feel, as opposed to just letting them always pull off the right moves with flawless execution.

1 Like

i mean, how do you do it in the BGE ? Messages going both ways , Propriety actuators… ? Nevermind, meanwhile i got my idea. It will be epic ;D

This one Game random 1 of 10 generator could give You some ideas if You click on hyperlink about 1 of 10 generator that can be applied to an npc game mechanics system left on layer 2 to whatever. However keep in mind it can be set for pregeneration of data cubes or balls for data takers as eqalizer punch the bottom or the last items qued on slope to get the results for npc actions as you wouldn’t want it to spam the same all the time.
Imagine if You’ve been by the npc You could set up something that character gives to npc based on collisions and leave there as in terms of spawning an object and parenting it to npc in background layer or invisible for keeping as a button that holds true value upon collision for some cycle to be activated based on rigid body object drop with sensors for a chance of overlay scene as a message with options from the npc.
But best way i guess would be to set up an opt out option so that the actuator object disappears or it’s end if something is completed in case if it is a task or a quest and why the npc is harrasing the character.
I personally think that best way to start any kind of game mechanism for characters or npc’s would be by giving it it’s idle animation in which it grooves in position or let it be it’s chest inflating as it is beathing.
Set the character and its armature on a tile. And add an object “sensor” with material parented to the characters tile. Then cut a square in characters chest and separate its face as a separate material. Make it to breathe and the motion of breathing would make a collision between these 2 things that can be set up with actuator for a release of physics generator set up with pretty much anything You want it to do. Other thing that was on my mind was that if Your character gives an object to an npc, and as it takes it, it should move it to a place let’s call it a board that would parent to it and servo control up the board by 1 unit in case if other player decides to interact with it and receive messages from it, depending on what You do.
Item that characters give to npc and that move to a board could have properties for example if more characters interact with npc then npc’s given out overlayes could set to different sets with something new or different based on values of characters that could change states.
You could give it a shot and try opening these blendfiles i found on internet.
Set client and the server.blend on 3rd layers. Press P on server and then P on client.
A round plane should appear in server after client joins the server. I have tried with more clients and it works well but have’nt tried it from different connections as i have only 1 laptop.
I guess a great thing to look into and consider building something on top of these files by remaking some things and maybe thought to implement chat in it for client to send things to servers log or between clients that gets +servo control triggered actions to move up if something new gets written.
Client Example.blend (721.4 KB)
Server Example.blend (684 KB)

thx for answer. But do you know that your message is almost unreadable ? Please try to format your ideas.

I cheat, obviously. Purely python.

Get a grip on working with packages. Set some values in module A, read them in module B.
I keep a reference to the player on an attribute on an empty class. Aye, judge me.
But this class can be accessed by all other modules. So basically, it’s where globals be at.
Now if I’m working on a module where the AI gets it’s orders, I can do something like, say,

from dsm.world import users

if users.player["some_property"] == some_value:
    doSomeThing()
    own.state = 4

elif users.player["another_property"] < another_value:
    doAnotherThing()
    own.state = 8

That’s the basic gist of it; nowhere near the actual level of sophistication these kinds of systems can have of course, but hopefully it helps you get a clearer picture.

I think I just bothered a little bit to give You an idea.
I can’t even write to You that You should learn how states and collision actuators work that should ideally blow anyone’s mind and bury in possibilities.
Or how to set object on layer2 and an empty on layer1.
Then adding a keyboard sensor for empty to add object after hitting desired button from layer 2 to spawn it in layer1 as rigid body, + set with velocities for spinning or any other kind of combinations.
I guess it also can be an asset. I am no expert, just an enthusiast and if i bother to think about Blender stuff at all.
https://blenderartists.org/t/states/1147494

thx, for the moment i work only with 1 state :wink: but i guess i will need more later.
I’m suspicious with anything working with Physics such as Collisions , i’m scared it’s a bit random when it comes about triggering events. But, well, i will give a try later

Alot of games i’ve played, and all i know that most of the secrets on how stuff works are hidden from players eyes. Just tryin’ to help with what i know.

For the moment, i create in a main.py a matrix of behaviours and pick up elements regarding some in game variables. ‘States’ are bit too much more appropriate for something during which the game commands (sensors in general) are re-configured.

Im interessed to know how do you motion your NPC in function of your playable character.

I don’t have it yet i only joggle with loads of stuff on me mind and model stuff for consideration of implementing into project along to some story line in the same time thinking is this kind of art something i wish to float around every day with as i have killed the demon of addiction of playing games. But imagine making a control tiles with empties above that releases a timed cubes that holds true values for action while they collide for times of a state when and if npc is in Your control with mouse over, overlay action buttons or how to fit options in sotries context. Just an idea really. Npc as i see is some kind of creature, a part of a tale in game. Set it’s armature to a cube and I it to different locations in map. As it moves, it must be applied with walking animation or few even the act of if it’s getting tired. Whatever. Make it to go to woods, collect mushrooms and make it to come back to town and set them out in baskets for sale let’s say. Then make it to go to chop some bushes, and make stacks of branches to hang them out on the line to dry or make it shout “FRESH TAMIBERRIES FOR SALE” for alchemists uses of making health topups. (did you know you can make your own alchemists table based upon collision between 2 materials in order to get the 3rd out of 2. Go fishing, make it to rub in with salt, set out to dry and set it out for sale… you’re the rockstar, make it all happen cause how else you will get people hooked in your thing unless things are going on in Your project. Just put it into a state so that it is not possible to interact with it while it is on its mission. Set up it’s timelines when it is interactable and approachable with action buttons based on some values character has gained during some mad stuff, ebrace ideas, shring gaps for gaining if you make UPS, test it, stretch values and pack it in as you wont want to gain something for 2 frikkin weeks knowing the fact that if You tighten gaps between ups to set out your ideas for gains just to achieve and understand the importance of making drivers for game mechanics. But with generators for idle randomness. Think of a mind thieve.
Make it to build or rebuild parts of town. Move the weight.

If your behaviours are already defined then it’s a question of assigning them as either idling or having a movement pattern. Usually what I do is have the int value of an object’s state correlate to the indexes in a list of functions, then have main call those that are needed.

Now, is your game 2D or 3D? Do NPCs have to navigate through obstacles? Fill me in on the specifics, I might have an example or two.

my thread

Less scared than when i saw your first comment :ok_hand:

Alright, you said fighting game and I was here thinking about Street Fighter and Soul Calibur :B
Now I’m guessing circle strafing, advancing and backing up would cover most of it.

So, let’s see.

The strafe is a matter of having the npc lock on to the player, then picking between left or right.
One could just choose direction at random, but you may also want to cast a few rays to look for walls or other obstacles. Lock-on can be done by messing with the orientation matrix in ways I haven’t bothered with since I discovered the TrackTo actuator. Applying movement on local coordinates does the rest.

Advancing and backing up is a similar story. You’ll want to choose between the two depending on whether the npc is set to close in, attack, evade or just get some distance – part of that one brief, faux “let me think the next move” moment enemies have inbetween attacks in games like Skyrim; it’s basically idling most of the time, but you can also use that time to actually pick what the npcs next move will be. So go with a timer up to random number of seconds, then go back to either strafing or advancing depending on the situation. Or both.

Most of what I have already written is for completely different types of games but if you like I can produce a brute prototype of something like what I just described.

Cheers.

Street fighter and Soul Caliburs are boring. I’ll do better

1 Like

How dare you! Got any idea how many quarters I lost at the arcades? MADNESS!

the combat system of my game is already enjoyable to play. Well, i will stop bla blafor nothing

You can get them on mp3
https://www.youtube.com/channel/UCiAR31hxtBzUpL6oo_OZMog/videos?view_as=subscriber