[Bug Report] NPC/vehicle issues when using virtual worlds
#1

EDIT: this post has been edited in order to explain better what's going on.

Okay, basically there is a streaming fail when using virtual worlds. I could reproduce this bug with two different ways. Before anything, assume all objects have been downloaded and we're relying on the cache.

Method #1 (usually happens when reconnecting to a server)
A real player reconnects, we set his virtual world to 1 in OnPlayerConnect and we set the spectate mode for him in OnPlayerRequestClass (called after OnPlayerFinishedDownloading).

Now, in virtual world 0, we connect a NPC and when it spawns we create a vehicle in order to put the NPC as driver.

Alright, if now we set NPC's and vehicle's virtual world to 1, they don't stream for the real player! Notice how in the next video OnPlayerFinishedDownloading isn't called when the player connects.

Method #1 video here.


Method #2 (happens always)
This method is very similar to the first one, but changing a little bit the order. So we connect the real player, we set the virtual world to 1 and we put him into the spectate mode.

Now we connect the NPC and we set its virtual to 1, it should stream for the player (sometimes if you're just reconnecting without leaving the game it doesn't). We create a vehicle, but surprise: it doesn't stream for the NPC, but just for the real player!

So there is no way to put the NPC in the vehicle.

Method #2 video here.


CONCLUSION
Seems that OnPlayerFinishedDownloading is not being called sometimes when reconnecting, maybe that's what causes these bugs, Kalcor said once: "players won't stream anything until after OnPlayerFinishedDownloading is called". Alright, that might explain the bug, but OnPlayerFinishedDownloading is being called when using the 2nd method to reproduce it.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=645254

You must change PutPlayerInVehicle before SetVehicleVirtualWorld.

CreateVehicle
PutPlayerInVehicle
SetVehicleVirtualWorld
SetPlayerVirtualWorld
Reply
#3

I know there are many bugs out there but allow me to bump this one, basically I reported it because it screwed up most of my NPC scripts.

Let's assume OnPlayerFinishedDownloading is being called even if the player doesn't download nothing, it's okay, but all other functions should be executed IMHO. Like setting vehicle's virtual world, PutPlayerInVehicle for the NPC, etc. They just do nothing! Shouldn't they do what they're supposed to do even if there aren't real players inside that virtual world?
Reply
#4

You could use OnVehicleStreamIn to put the player in the vehicle. That's what I've done temporarily to fix my driving school script in 0.3.8 in case it isn't fixed internally.
Reply
#5

Quote:
Originally Posted by BeckzyBoi
Посмотреть сообщение
You could use OnVehicleStreamIn to put the player in the vehicle. That's what I've done temporarily to fix my driving school script in 0.3.8 in case it isn't fixed internally.
What do you mean exactly? When the vehicle streams in for the player or for the NPC?

Grazie in anticipo!
Reply
#6

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
What do you mean exactly? When the vehicle streams in for the player or for the NPC?

Grazie in anticipo!
Whichever one you're trying to put in the vehicle.
Reply
#7

I'm trying to put the NPC, the funny fact is that both are being created at the same coordinates and everything works alright while the virtual world used is 0. Things start to mess up when going over 0. I'll give a try to what you said.

EDIT: when the player spawns, the NPC and the vehicle doesn't stream in for the player! And all them are using the same virtual world.
Reply
#8

In 0.3.8, when useartwork is enabled, the player always enters a download state when joining or changing virtual worlds (even if there are no files to download). If the virtual world has changed AND they've finished downloading any required files, the server will find them in the virtual world before they finished downloading. So basically - with useartwork enabled you're supposed to deal with all join/vworld transitions through OnPlayerFinishedDownloading.
Reply
#9

I've noticed something strange related to this bug today, maybe this helps for fixing it. Let me explain:

If you restart the server while player's virtual is set to 1 and you reconnect without closing the game, OnPlayerFinishedDownloading won't be called even if their new virtual world is 0, neither if you use SetPlayerVirtualWorld to 1. I guess, somehow, the game still thinks it's using VW 1 and it doesn't call OnPlayerFinishedDownloading .

Maybe all this doesn't happen if you connect to the server for the first time, but if you're reconnecting, while development it's really annoying.
Reply
#10

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
I've noticed something strange related to this bug today, maybe this helps for fixing it. Let me explain:

If you restart the server while player's virtual is set to 1 and you reconnect without closing the game, OnPlayerFinishedDownloading won't be called even if their new virtual world is 0, neither if you use SetPlayerVirtualWorld to 1. I guess, somehow, the game still thinks it's using VW 1 and it doesn't call OnPlayerFinishedDownloading .

Maybe all this doesn't happen if you connect to the server for the first time, but if you're reconnecting while development it's really annoying.
This occurs even if you do not restart the server. If the player reconnects, the callback is not called. I also think this should be corrected before the official release.
Reply
#11

Nice man, pastebin?
Reply
#12

Quote:
Originally Posted by waysemir
Посмотреть сообщение
Nice man, pastebin?
Reply
#13

Quote:
Originally Posted by waysemir
Посмотреть сообщение
Nice man, pastebin?
What pastebin?
Reply
#14

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
I've noticed something strange related to this bug today, maybe this helps for fixing it. Let me explain:

If you restart the server while player's virtual is set to 1 and you reconnect without closing the game, OnPlayerFinishedDownloading won't be called even if their new virtual world is 0, neither if you use SetPlayerVirtualWorld to 1. I guess, somehow, the game still thinks it's using VW 1 and it doesn't call OnPlayerFinishedDownloading .

Maybe all this doesn't happen if you connect to the server for the first time, but if you're reconnecting, while development it's really annoying.
I have encountered this issue yesterday and spent a few good hours doing multiple dry runs.

Would this be fixed in the near future or is there a workaround?
Reply
#15

Quote:
Originally Posted by waysemir
Посмотреть сообщение
Nice man, pastebin?
Fucktard, stop trying to increase your postcount so hard.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)