Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Quick help with removing entities #390212
12/24/11 08:31
12/24/11 08:31
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
As the title suggests, I am in a bit of a pickle. To keep it short and sweet when I fire a bullet from the server...

-Bullet is created and is set on its course.
-when bullet has hit something or is too far from the player, its removed.
-When bullet is removed, only the server can see it removed. Clients still see the bullet stuck wherever it hit.

And when I fire a bullet on the client side...
-bullet is created, however for one frame its in its default pan, tilt, and roll, then begins to move in the correct direction with the correct pan, tilt, roll.
- When the client bullet hits something, I get a crash on ALL clients.
-However, the server shows the bullet as "removed"


I am left to believe one of two things are happening. Either the server is deleting the bullet too early, thus returning an empty pointer on all clients, or when the client bullet is removed, it try's to remove anything with the "my" pointer. Im completely lost on this issue, and am in great need of help.

Last edited by exile; 12/24/11 08:44.
Re: Quick help with removing entities [Re: exile] #390358
12/28/11 05:15
12/28/11 05:15
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Anyone?

Re: Quick help with removing entities [Re: exile] #390363
12/28/11 12:46
12/28/11 12:46
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
I don't think that ent_create works well for something as short-lived as a bullet.

At least in older versions, you had to wait at least half a second until you could use ent_remove or any function that uses the network on the server after creation. On very slow connection, even half a second could possibly be too short. This might be the "bug"/feature you are encountering.

Also, your code is bad security wise. If you allow clients to use ent_create to create bullets, it would be very easy to write a script that would inject thousends of shots per second on all directions into the network traffic. But 3DGS native network security is nonexistent anyway, so you might as well ignore this.

Create your own network "protocol" for shooting.
Send skills or a struct that has all the necessary information to all clients, and let them handle the bullet locally (ent_createlocal).
Problem is that you'd have to rely on the local collision for removing the bullet, so it might not be perfectly on sync with the server.

You could also create a new entity-system just for bullets, by giving them IDs and removing them using these ids. That way you could have the server do the collision.

Re: Quick help with removing entities [Re: SchokoKeks] #390365
12/28/11 14:12
12/28/11 14:12
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Oh no, thats not how it works. When then client shoots, a "client shot' message is sent to the server, then the bullets position and angles are sent to all of the clients and the bullet gets created on all clients. Essentially, the client is just informing the server they shot. The server does all the work.

Here is the source in case if anyone wants to see.

http://www.filedropper.com/multiplayer8cd

Last edited by exile; 12/28/11 15:57.
Re: Quick help with removing entities [Re: exile] #390371
12/28/11 18:27
12/28/11 18:27
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
okay, so how exactly does the bullet get created on all clients?

does the server do ent_create?
or do the clients use ent_createlocal?

If the server uses ent_create then my points above probably are still valid. The current manual says:

Quote:

On multiplayer systems, it can take up to 0.5 seconds until the created entity is copied to all connected machines. During that time, the entity handle can not be used, entity skills can not be sent (►send_skill()) and the client_id parameter is not set. client_id can be polled for determining when the entity is ready on all machines: while (my.client_id != dplay_id) wait(1); .


thats a delay that should not happen on multiplayer systems. It doesn't clearly say whether this delay is shorter when the server uses ent_create.

Re: Quick help with removing entities [Re: SchokoKeks] #390385
12/29/11 06:09
12/29/11 06:09
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Just download the file, its got the source and everything in it.

Re: Quick help with removing entities [Re: exile] #390932
01/06/12 00:22
01/06/12 00:22
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Any one else have any ideas? I re uploaded the file.

http://www.mediafire.com/?nvq2tzf8429p262


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1