Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,031 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ignoring creator entity in multiplayer #450296
04/11/15 20:33
04/11/15 20:33
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
I am working on a small multiplayer game where currently every palyer joining is a block model and can shoot projectiles after the other players, however when you shoot the projectile often hits the player that shoots it instead of continuing.

The player that creates the projectile sets the "you" pointer to be the created projectile and both the projectile and player has the IGNORE_YOU flag in their movement commands, however for some reason they dont ignore each other.

I assume there is another way to do this but i just cant figure out how to do it.

Last edited by Denn15; 04/12/15 11:38.
Re: ignoring creator entity in multipålayer [Re: Denn15] #450299
04/11/15 21:02
04/11/15 21:02

M
Malice
Unregistered
Malice
Unregistered
M



Try group and c_ignore, looking at.

Bullet()
my.group = 2;

c_ignore(1);
c_move(...)

PLAYER()
my.group= 1;

Re: ignoring creator entity in multipålayer [Re: ] #450300
04/11/15 21:10
04/11/15 21:10
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
the problem is that all the players are given the same action so that they will also have the same group.
therefore the projectiles will ignore all the players and you are soppused to ba able to hit each other.

Re: ignoring creator entity in multipålayer [Re: Denn15] #450302
04/11/15 22:40
04/11/15 22:40
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I have used in the past the IGNORE_PUSH c_move modifier adding a higher push to arrows and checking the arrow parent inside the player event.

Re: ignoring creator entity in multipålayer [Re: txesmi] #450303
04/11/15 22:44
04/11/15 22:44
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
wow wtf
Im glad Im using ANet and not the native 3DGS multiplayer system.
Try to check for a group value. If its your own client-ID set it to a different group but dont change it globally for all players.
Easy as that, idk if its easy to code with the actual 3DGS multiplayer system.

Last edited by Ch40zzC0d3r; 04/11/15 22:45.
Re: ignoring creator entity in multipålayer [Re: Ch40zzC0d3r] #450304
04/11/15 22:59
04/11/15 22:59
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
well about the push stuff, they would still affect each other. i supposed you could make them ignore everything and then check collision with vec_dist in a for loop and check for client id in some way.

@chaos that sounds like it could be an option too. ill try it out tomorrow

Last edited by Denn15; 04/11/15 23:09.
Re: ignoring creator entity in multipålayer [Re: Denn15] #450305
04/11/15 23:13
04/11/15 23:13
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted By: Denn15
they would still affect each other.


They affect just on the event call. The arrow does not collide playes but calls the event and makes hurt when (you->parent != me). It works.

Re: ignoring creator entity in multipålayer [Re: txesmi] #450306
04/11/15 23:22
04/11/15 23:22
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
i havent really read into how parent works so i dont know much about that method but my guess is that it makes the projectile ignore the player but not make the player ignore the projectile? and the players movement should not be hindered by its own projectiles

Last edited by Denn15; 04/11/15 23:25.
Re: ignoring creator entity in multipålayer [Re: Denn15] #450308
04/11/15 23:34
04/11/15 23:34
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Any player should not collide with any arrow. Ignore the arrows group on player move or so.

Re: ignoring creator entity in multipålayer [Re: txesmi] #450316
04/12/15 11:36
04/12/15 11:36
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
@txesmi i have tried to do the following:

Code:
function gethit()
{
	if(your->parent != me)
	{
		your.health = 0;
	}
}

action playeraction()
{
	my.emask = ENABLE_ENTITY;
	my.event = gethit;
        ...
        while(1)
        {
                c_move(me, NULL, vector(my.velx * time_step, my.vely * time_step, my.velz * time_step), GLIDE | IGNORE_YOU);
	        c_rotate(me, vector(my.campan - my.pan, 0, 0), GLIDE | IGNORE_YOU);
        }
}

action shotaction()
{
	my.push = 3;
        ...
        while(1)
        {
	        c_move(me, vector((90 - my.shotpower * 30) * time_step, 0, 0), NULL, IGNORE_PUSH);
        }
}



however now the projectiles dont react at all when hitting any players and when you fire you often get pushed around by your own projectile. is the above code like you meant it or should i do something different?

Re: ignoring creator entity in multipålayer [Re: Denn15] #450318
04/12/15 13:00
04/12/15 13:00
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
It sounds that your problem is that the 'you' pointer is different for the server and each client. So IGNORE_YOU does not do the same on each computer. I don't know for sure though. But its easy to check if that's the problem:

When the server player fires, does his projectile also sometimes hit himself?

Whatever the case, I think the easiest problem to solve this is just to remove the IGNORE_YOU line and create the projectile a bit futher away from player/block.

Or perhaps send a handle of the firing player on the server to the clients, though the problem here is a small delay before the clients get the handle from the server.

Or or: let almost all of the code run only on the server and only small visual effects like movement and particles effects etc. run on the client. And than only create entities on the server (not on the clients) and remove the projectiles only on the server (let the server send the STATE of the projectile to the clients). This way only the server needs to know the 'you' pointer wink.

Re: ignoring creator entity in multipålayer [Re: Reconnoiter] #450319
04/12/15 13:45
04/12/15 13:45
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
The projectiles event does not seem to trigger with the server player, however the player still gets pushed all over the place because of the projectile.

I have thought about just creating the projectile away from the player, but i would rather want the two to completely ignore esch other just to be sure that there is not gonna happen some jerks in the gameplay or the projectiles spawning inside other players and stuff like that.

I have thought about the handle thing but i just dont know how to make a c_move instruction ignore an entity with a specific handle. my first thought was to use c_ignore with the handle but entity groups only ranges from 0 - 30 and the handle is something 3000 number so that would not work. is there another way to use it?

About running it all on the server, that is also an option but it then there would be small delays on players movement and such and it would feel less smooth.


Last edited by Denn15; 04/12/15 13:47.
Re: ignoring creator entity in multipålayer [Re: Denn15] #450320
04/12/15 14:19
04/12/15 14:19
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: Denn15
About running it all on the server, that is also an option but it then there would be small delays on players movement and such and it would feel less smooth.
, you will get a small delay on the clients, however this delay is technically than only a visual one since the server does the real work and the clients just move projectiles for smooth movement. To 'hide' these small delays, most mp games use things like interpolation. I don't know how experienced you are with mp, but these things can get pretty difficult and head scratching (I have experienced it myself the hard way grin ).

Is your game fps/3rd person or topdown? For topdown it is a bit easier to get things right since the camera is more far away so you could get away with a simple/not perfect interpolation function or no interpolation at all perhaps.

Last edited by Reconnoiter; 04/12/15 14:21.
Re: ignoring creator entity in multipålayer [Re: Reconnoiter] #450321
04/12/15 15:07
04/12/15 15:07
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
the game is a firstperson shooter. this is my first ever try at a multiplayer game so im not experienced at all tongue but im guessing that interpolation is some sort of prediction og players positioing and such?

Re: ignoring creator entity in multipålayer [Re: Denn15] #450323
04/12/15 15:46
04/12/15 15:46
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
You cant send handles over the internet. Well, you could, but it will most probably fail at some point...

The solution to your problem is the IGNORE_YOU method you originally tried to use laugh

The problem is that the you pointer is probably reset and you havent saved it anywhere, or on the wrong machine.

Here's what I mean:
Create the bullet on the client and attach a custom local function for it.
On the server it runs the function given in the ent_create statement on the client.
With the local function you attached and on the server's function for that bullet, search for the player entity that has the same client_id as the desired client.
When you find it, set 'you' to that player both in the server function and in the local custom function, and use IGNORE_YOU on both machines.

The other method, (I'm currently building it) is to have local bullets only.
ent_createlocal...
Its executed on the client and on the server when a client hits the mouse button. And the same process goes, search for a player entity with the same client_id, set 'you' to that player entity and IGNORE_YOU.

PS.: If you get stuck, PM me. I think I'll have my code working soon...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: ignoring creator entity in multipålayer [Re: EpsiloN] #450384
04/13/15 15:17
04/13/15 15:17
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Just wrote c_ignore - example ... then i saw the 2nd post grin but ive another idea ( no glue if this will work, guess it will )...

Like "EpsiloN" above said u could compare bullet ent handle with creator handle.
Guess it could work like that in the creator - ent:
Code:
...
ENTITY* entbullet = ent_create (bullet...);
if (entbullet) entbullet.skill100 = handle (me);
...


and in the bullet add something like:
Code:
...
ENTITY* entshooter;
if (my.skill100){
   entshooter = ptr_for_handle (my.skill100);
   if (entshooter) if (me != entshooter){
      ...bullet hit entity, but NOT the creator ( different entity - handles )...
      ...bullet removement here and so on...
   }
}

Guess this could work, give it try, doesnt hurt grin

Peace


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: ignoring creator entity in multipålayer [Re: rayp] #450397
04/13/15 20:35
04/13/15 20:35
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
i just found the problem. since you suggested that it was the you pointer that didnt point to the correct entity i decided to make the player do something visible to the players you entity and the projectile do something visible to its you entity and it seemed like the pointer was valid. because i dint know what to do about the problem i decided to try out testing the you pointers again but this time the players you entity was not the projectile and i found out why.

the player action calls a shooting function that created the projectiles with you=ent_create and thus the you pointer would not be set to that entity in the players action and the c_move instructions was in the players action and the you=ent_create was in the shooting function so i now create the projectiles in the player action and now it works laugh

in short the c_move instruction was not in the same function as the you pointer and then IGNORE_YOU didnt do anything.

anyways thanks for your time and help everyone grin

Page 1 of 2 1 2

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