[FilterScript] NPC Drivers - Citizen & Fully working Taxi script - (FS-Version)
#61

Quote:
Originally Posted by Azhar
View Post
Awesome!

Nice Job.
Thanks!


I fixed some bugs for the Stop\'n\'Go, they now correctly respect other Drivers in front of them. They did before but they sometimes recognized drivers behind them or just bashed through if the timing was bad.

Note that this still happens if there are no players around or they are far away from any players, this is done to save resources.


Also added 3 Skin Arrays for Civilians, Cops and Taxi Drivers.


Some optimizations to the paths unfortunately make the paths a bit longer now (Max. path length jumped to 2000).
Reply
#62

why they bugged? if server slots < maxnpc
Reply
#63

Quote:
Originally Posted by OmegaKiller72
View Post
why they bugged? if server slots < maxnpc
The maxnpc should always be lower than maxplayers (SAMP will throw a warning if not), it won't bug anything though unless you try to connect too many.
Reply
#64

Just wanted to leave a note that I'm using this on my 0.3.7 server and its working 100%. Its splendid and I love it!! Since a few players have gone on NPC murdering sprees (entire highway in LV strewn with corpses) I'm setting up some code to respawn the NPCs on death and start them on their pattern again.

I tested w/ 883 simultaneous bots and they worked, albeit kinda skippy/lurchy. I've dialed it back to 500 NPCs and its much smoother.

I'm about to embark on some behavior edits tho...please let me know if these are even possible so I dont beat myself against something that isn't going to work anyways I eventually want:

A certain percentage of 'asshole' drivers (drive fast, knock things down, etc).
I'd like some of the vehicles to have armed passengers
I'd like some of those armed passengers to randomly attack human players they encounter
**I'm trying to find the code that prevents the drivers from spawning tanks and riding around in those. I really want random tanks, so I can make them randomly fire and blow stuff up. Can you tell me where the code is that determines which vehicle models are spawned by non-taxi drivers?


Basically I'm trying to set up some hint of an AI system that may mimic single-player pedestrian behavior, if only just a little bit.

This script is awesome on its own though, without edits. Good job!!!!!
Reply
#65

Quote:
Originally Posted by kaisersouse
View Post
Just wanted to leave a note that I'm using this on my 0.3.7 server and its working 100%. Its splendid and I love it!! Since a few players have gone on NPC murdering sprees (entire highway in LV strewn with corpses) I'm setting up some code to respawn the NPCs on death and start them on their pattern again.

I tested w/ 883 simultaneous bots and they worked, albeit kinda skippy/lurchy. I've dialed it back to 500 NPCs and its much smoother.

I'm about to embark on some behavior edits tho...please let me know if these are even possible so I dont beat myself against something that isn't going to work anyways I eventually want:

A certain percentage of 'asshole' drivers (drive fast, knock things down, etc).
I'd like some of the vehicles to have armed passengers
I'd like some of those armed passengers to randomly attack human players they encounter
**I'm trying to find the code that prevents the drivers from spawning tanks and riding around in those. I really want random tanks, so I can make them randomly fire and blow stuff up. Can you tell me where the code is that determines which vehicle models are spawned by non-taxi drivers?


Basically I'm trying to set up some hint of an AI system that may mimic single-player pedestrian behavior, if only just a little bit.

This script is awesome on its own though, without edits. Good job!!!!!
Thanks, nice to hear you like it. I made another update to the drivers for better start & end paths (copy the gps.dat from github too, many fixed nodes).
With JIT Pre-Compiler 999 NPCs are not a problem on a homeserver btw.

The array VehicleZOffsets determines which cars can be driven (-1000.0 for unusable).

Change
Code:
-1000.0/*(432)*/
to
Code:
0.6743/*(432)*/
to enable the Rhino

About the ped AI, I wrote a plugin for an AI library which works almost exactly like the GTA SA one for Peds. I managed to load the original SP ped files & config already (Ped types, relations (like/hate etc)).
It works pretty well, but pretty resource intense and limited to about 200 Peds. And Paths are a problem yet.
If you want to see it PM me, I can show you some cool things.

The armed passengers are definitely possible and could be added on top of something we have already planned.
Our goal is to make them stop if a player is in front of them (atm they just brake when another driver is in front of them) and they would perfectly produce a traffic jam. Aggressive drivers would just not give a damn about anything then or just kill the barricade with his passenger. However I don't see anything to "knock down" except players.

And for the deaths - I will add code for the respawning later, totally forgot that yet.

About the Drivers Update:

- Updated GPS.dat (for RouteConnector) with many fixed nodes and a lot
more parking lots
- Random Drivers & Cops drive from parking lot to parking lot now with a
little break -> More realistic paths
- Better and more efficient movement streaming - FCNPC 1.0.5 required

Make sure to get the newest GPS.dat from GitHub.
Reply
#66

How I can put taxis or police cars only for a particular city?
It would be interesting to city routes only.
Reply
#67

Quote:
Originally Posted by hydewhyd
View Post
How I can put taxis or police cars only for a particular city?
It would be interesting to city routes only.
You would need to exclude all LV and SF nodes from the PathNodes array. I can make a define set for disabling specific areas of the map later Make sure to not add too many NPCs then, this will produce horrible lagg (net & client-side).
Reply
#68

Its not possible put some NPC's coming down on bikes at chiliad? Or that zone its too bugged for that?
Reply
#69

Quote:
Originally Posted by PT
View Post
Its not possible put some NPC's coming down on bikes at chiliad? Or that zone its too bugged for that?
Bikes are generally ugly because they don't lean left/right. Mt chiliad is disabled for the same reason, theyre warping all the time and the path is quite small.
You can enable Mt Chiliad inside the IgnoredPathNodes array.
To add bikes read a few posts above, there I gave an example on how to add vehicle models. The z offsets for bikes are about 0.4.
Reply
#70

You have a little mistake in there, Drivers[] shouldnt be accessed via npcid, but with the driverid.
If you have more player slots than NPCs, this will lead to an index out of bounds error.

Use GetDriverID(npcid); to get the driverid of an NPC and Drivers[driverid][nNPCID] for the other way around.
And they don't use Playback, guess they don't continue driving with the code you used in StopAttack.

Other than that nice idea If you want I can make an efficient version using the stuff I already have for the Peds.

But before that I'll add Bikes and correct rotation in all directions.

PS Checked your server, most of them are stuck at parking lots and not driving anymore. I can give you some better code for returning to the car and even stopping. Just removing them from the car will probably break them.
Also they're gathering at 0,0,0, heavy laggs going on there. Look at Driver_Init how I put them in their vehicles and so on, that should help.
Reply
#71

Make it NaS.

I have another question. Do you think in future you can make some pedestrians without cars? Just walking with some weapons and that stuff?

What happens if an player stop his car in front an driver npc? And if he try stole it?

I'm at army base I can't see the code I just saw the post and videos however I think it's pretty interesting..
Reply
#72

Quote:
Originally Posted by PT
View Post
Make it NaS.

I have another question. Do you think in future you can make some pedestrians without cars? Just walking with some weapons and that stuff?

What happens if an player stop his car in front an driver npc? And if he try stole it?

I'm at army base I can't see the code I just saw the post and videos however I think it's pretty interesting..
We were working on Peds too but that project is paused I guess. We are for now concentrating on Drivers.
For now the Drivers don't give a damn about players, but they already brake for other NPCs - So I will add interaction with players once the driving is finished (Bikes, rotation, some path optimizations). Should be soon.

And you unfortunately can't steal a vehicle from an NPC, I'm not sure if they can steal yours though.

Maybe we will continue the Peds after this, can't promise that though.
Reply
#73

Sometimes there are some nodes that when parking a vehicle as a taxi or police car are "bugged" or what? Look at this image.
There are routes that vehicles arrive to collide. Look at this second image.

And another question, can you make a choice to disable or enable the parking of vehicles in the script?
Reply
#74

Quote:
Originally Posted by NaS
View Post
You have a little mistake in there, Drivers[] shouldnt be accessed via npcid, but with the driverid.
If you have more player slots than NPCs, this will lead to an index out of bounds error.

Use GetDriverID(npcid); to get the driverid of an NPC and Drivers[driverid][nNPCID] for the other way around.
And they don't use Playback, guess they don't continue driving with the code you used in StopAttack.

Other than that nice idea If you want I can make an efficient version using the stuff I already have for the Peds.

But before that I'll add Bikes and correct rotation in all directions.

PS Checked your server, most of them are stuck at parking lots and not driving anymore. I can give you some better code for returning to the car and even stopping. Just removing them from the car will probably break them.
Also they're gathering at 0,0,0, heavy laggs going on there. Look at Driver_Init how I put them in their vehicles and so on, that should help.
Oh thanks for the tip! yeah its defintely a work in progress still. This morning I copied some of the drivers_init stuff but didnt have much time to test. On test server now the driver AND the car end up at 0,0,0 hovering...but once you shoot at them they drop to the ground and attack etc. I'll play more with it later tonight.

Thanks!
Reply
#75

This is really awesome. Looks really smooth. Keep up the good work.
Reply
#76

Quote:
Originally Posted by hydewhyd
View Post
Sometimes there are some nodes that when parking a vehicle as a taxi or police car are "bugged" or what? Look at this image.
There are routes that vehicles arrive to collide. Look at this second image.

And another question, can you make a choice to disable or enable the parking of vehicles in the script?
I can't see one of the images, can you upload the other somewhere else? The one at the garage door loads fine.
And did you download the newest GPS.dat from my GitHub? With that version there are actually no paths to get stuck anymore. However some end-nodes are badly chosen (I will rework some of them).
About vehicle collision, I could do something about that but that would make the script even more ressource intense, they now ignore every other NPC that is not facing the (almost) same direction, which makes it quite efficient. Removing that will make a quite complex loop at every node point

I'll add a define for parking later. But imo this is way better than having vehicles 180-turn in the middle of the street (which is not possible to fix except editing the GPS Plugin to start calculations in a defined direction - it's discontinued by Gamer_Z).

Quote:
Originally Posted by kaisersouse
Oh thanks for the tip! yeah its defintely a work in progress still. This morning I copied some of the drivers_init stuff but didnt have much time to test. On test server now the driver AND the car end up at 0,0,0 hovering...but once you shoot at them they drop to the ground and attack etc. I'll play more with it later tonight.
Once they exited you should catch FCNPC_OnReachDestination to not do anything anymore.
When they should get back to the car, check if the vehicle has respawned (Drivers[id][nVehicle] is the vehicle ID). If yes, put the car next to them, else they will be doing unpredictable stuff.
If they re-entered call "pubCalculatePath" (using a timer, copy from somewhere else) and they should continue as normal. WhenRouteIsCalculated resets all important variables (including state) for you. If theyre back in a vehicle and no other part of the script is accessing the NPC it should work well.

However you can also wait for me to add it, not like you couldn't, but I guess there are quite a lot of things to take into account. I have a quite good system in my head already how to make it efficient and nice. For example letting them drive off the road a bit when exiting.
Reply
#77

I uploaded new pictures here.
Yes, I have the last GPS.dat in your GitHub and all updated to the latest versions.
And thanks for putting to enable/disable routes of each city.
Reply
#78

I'll dabble with resetting them back on their path using the method you listed above. I'll wait for your additions because its your system and I'm sure it will look 100% better than what I'm doing with it lol. Me screwing around with all that is just me teaching myself NPC stuff so I can expand its use on my server further down the road.

Excited for your upcoming update. Thank you again!
Reply
#79

Quote:
Originally Posted by hydewhyd
View Post
I uploaded new pictures here.
Yes, I have the last GPS.dat in your GitHub and all updated to the latest versions.
And thanks for putting to enable/disable routes of each city.
Are those police cars moving? If yes, they won't detect each other if they're too close since theyre always swapping server-sided (due to lagg). If not I'll check the nodes again, but for me this never happened since I added the Parking Lots.

Quote:
Originally Posted by kaisersouse
I'll dabble with resetting them back on their path using the method you listed above. I'll wait for your additions because its your system and I'm sure it will look 100% better than what I'm doing with it lol. Me screwing around with all that is just me teaching myself NPC stuff so I can expand its use on my server further down the road.

Excited for your upcoming update. Thank you again!
No problem. Actually nice to see someone using it on their server!

We will first improve the Start-/End nodes and add correct X-rotation to Bikes and Cars. Not sure how long that will take, the Bikes are already done and working though.
After that we will add more actual features, like the one you're working on (guess that works well together with aggressiveness) and passengers.

If you get the NPC exitting/reentering working I'd appreciate if you could PM me the code, that would speed things up a bit If you want to, of course.
Reply
#80

Quote:
Originally Posted by NaS
View Post
Are those police cars moving? If yes, they won't detect each other if they're too close since theyre always swapping server-sided (due to lagg). If not I'll check the nodes again, but for me this never happened since I added the Parking Lots.
Yes the cars are try to moving.
The parking of these vehicles on this path is strange...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)