|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Thu Jul 01, 2010 10:12 am Post subject: Balls stuff |
|
|
|
|
I worked with the balls module a lot last night... and I must say, making ASSS modules is way easier than Merv plugins
I did in one night something less buggy than my old merv plugin, and that worked much better.
But I had some questions...
-What's the simplest way to have the ball respawn X seconds after a goal? Move the ball away, and call a spawnball after a timer? Or maybe SetBallCount(0) then SetBallCount(1) ?
-Is there a way to know the current location of the ball? More precisely, the location of the ball where it is picked up from, and not where the player who picked it is. i.e. player position +/- ball proximity in some direction.
-The advisers... If you block a goal, for example, the callback for the goal still gets called. The AllowThrow one seems pretty buggy, if I disallow the throw, I still see the ball take off, and it only comes back to me after like 5 seconds (with no ball timer, but that's explained in the comments)
I thought advisers would be awesome, but I ended up only using the AllowPickup one, and managing everything else with the callbacks.
-Is there an easy way to phase the ball? When a player shoots the ball from the offensive crease, I wanted to disallow the throw with the adviser, that didn't work well. So I just place the ball there, and I plan to warp the player away, but I need to temporarily phase the ball. I could always tag the player and disallow his pickups for a while, don't know what would be best...
-Is there any way to detect a ball phasing/lagging through people? Can this even be a concern in ASSS? I guess that's when the 'I caught the ball' packet sent from the player doesn't reach the server in time...
-Non-ball related: What's the most efficient way to warp someone? I'm used to the merv way of pm'ing a warpto command, but I doubt that's the way to go here (though it would work I assume). I just need a simple warp, no need to maintain momentum or whatever.
Edit: Another non-ball related: Is there something already done to extrapolate the player's actual position, instead of using the last position packet received? If not, how can I know when the last position update was? in mervbot, the players had a 'lastpositionupdate' field, but I didn't see any here.
Thanks _________________ (Insert a bunch of dead links here)
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Thu Jul 01, 2010 11:56 am Post subject: |
|
|
|
|
Another one...
I use this code to disallow someone to fire the ball from the opposing crease...
int i;
//Do not allow player to fire ball from enemy crease
for (i = 0; i < N_TEAMS; i++)
if (i != p->pkt.freq)
if (checkcrease(p, i))
{
struct BallData newpos;
//Penalize player
givepenalty(p);
//Give ball to the goalie if there is one
Player* goalie = getgoalie(i);
if (goalie)
{
newpos.carrier = goalie;
newpos.x = goalie->position.x;
newpos.y = goalie->position.y;
newpos.state = BALL_CARRIED;
newpos.time = current_ticks();
}
else
{
//Leave ball there if there is no goalie
newpos.carrier = NULL;
newpos.x = p->position.x;
newpos.y = p->position.y;
newpos.state = BALL_ONMAP;
newpos.time = current_ticks();
}
newpos.xspeed = 0;
newpos.yspeed = 0;
newpos.freq = i; //Ball belongs to defending team
//If future pos is in the goal, do something
balls->PlaceBall(arena, bid, &newpos);
snprintf(msg, sizeof(msg), "%s attempted to fire ball in team %i crease", p->name, i);
chat->SendArenaMessage(arena, msg);
carrier[bid] = NULL;
lastcarrier[bid] = NULL;
return;
}
carrier[bid] = p; |
So if that team has a goalie, the ball is given to him, otherwise it's just dropped there. The problem is that if the goalie is on a goal tile, the ball will get scored, even if the carrier team is set to the defender's team...
Is this just because the shooter's client sees the ball in the goal before it realizes it doesn't belong to him anymore? Or am I doing something wrong
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Thu Jul 01, 2010 1:48 pm Post subject: |
|
|
|
|
I'm going to leave the ball questions for Arnk, since he does a lot with powerballs for Hockey Zone, and he's the one that actually wrote all those advisers.
As for the warp, there should be a simple warp function in game.h. You can take a look at the /?warpto command (Cwarpto in playercmd.c, I believe) for usage details, though it should be fairly self explanatory. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Thu Jul 01, 2010 2:16 pm Post subject: |
|
|
|
|
Right... just found the warpto :slaps self:
Actually, a lot of the things I asked about might be very simple, I was getting pretty tired last night...
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Thu Jul 01, 2010 8:56 pm Post subject: |
|
|
|
|
Ok, I checked again, and the adviser really does block the CB_GOAL callback... scratch that part
|
|
Back to top |
|
|
Arnk Kilo Dylie Seasoned Helper
Age:36 Gender: Joined: Jul 14 2006 Posts: 108 Offline
|
Posted: Fri Jul 02, 2010 12:14 pm Post subject: |
|
|
|
|
Wow.. I was so sure I clicked Post after typing up the full reply.
But since either I didn't or it got baleeted,
Use a timer.
Not really, there's imperfect solutions out there.
Dunno about blocking the ball outright but it should work, check your soccer settings and lag. I've only used AllowBallFire to modify the speeds.
No way.
No reliable way. Balls protocol is hands off in SS. Wouldn't that be nice?
|
|
Back to top |
|
|
Goldeye Novice
Gender: Joined: Dec 15 2003 Posts: 57 Offline
|
Posted: Sat Jul 03, 2010 4:20 pm Post subject: Re: Balls stuff |
|
|
|
|
Samapico wrote: |
-Is there a way to know the current location of the ball? More precisely, the location of the ball where it is picked up from, and not where the player who picked it is. i.e. player position +/- ball proximity in some direction.
|
Ya I wrote a module to apply friction and do the physics although it seems to be buggy around corners still.
Quote: |
-Is there an easy way to phase the ball? When a player shoots the ball from the offensive crease, I wanted to disallow the throw with the adviser, that didn't work well. So I just place the ball there, and I plan to warp the player away, but I need to temporarily phase the ball. I could always tag the player and disallow his pickups for a while, don't know what would be best...
|
There is a cont setting Soccer:PassDelay which phases the ball for that many ticks after you fire it. Dunno if its the intended purpose but the effect is to eliminate some of the advantage of a low ping by allowing the ball fire packet to reach everyone before it can be picked up. Perhaps you can just bump this up enough that the warp has time to kick in.
As for phasing the ball... I don't think there is an easy way. There's a harder way to get 'variable phase' but it's quite bug prone as well.
Quote: |
-Is there any way to detect a ball phasing/lagging through people? Can this even be a concern in ASSS? I guess that's when the 'I caught the ball' packet sent from the player doesn't reach the server in time...
|
It's theoretically possible, but you'd need ball motion info and extrapolated player positions. I tried it once and it was very unreliable. Phase happens when one client extrapolates the position of another player and the ball hits their extrapolated prox. The result is you don't underlag someone who caught the ball before you. If that player doesn't actually ever catch the ball on his screen, the ball remains phased for 1 second.
Quote: |
Edit: Another non-ball related: Is there something already done to extrapolate the player's actual position, instead of using the last position packet received? If not, how can I know when the last position update was? in mervbot, the players had a 'lastpositionupdate' field, but I didn't see any here.
|
The C2S position structure (packets/ppk.h) includes a time field. In open space you can easily extrapolate the position += speed * (current_time - packet_time). To deal with bounces requires at least a little possibly a lot more work...
PS I will drop that ball_motion module on here later today.
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Jul 03, 2010 7:45 pm Post subject: |
|
|
|
|
Ya I'm working on extrapolating positions just now... Dunno why I didn't see the 'time' field before, but that's what I'm using now. Dealing with bounces is indeed more work... might be interesting.
Extrapolation of a player with around 400ms lag. Only large offsets are when bouncing off a wall.
Red is the extrapolated path calculated every 2 ticks, blue crosses are position packets
extrapolate.PNG - 29.01 KB
File downloaded or viewed 44 time(s)
|
|
Back to top |
|
|
Goldeye Novice
Gender: Joined: Dec 15 2003 Posts: 57 Offline
|
Posted: Sat Jul 03, 2010 8:03 pm Post subject: |
|
|
|
|
I'm told that continuum doesn't actually do linear extrapolation. But I'm not sure what it does do. Bak said it's cubic. I'll dig up the link he sent me.
If you want to deal with bounces, the safest way to do it would be the same way as in ball_motion; The logic for bounces should be the same as for the ball except multiply speed by the bounce factor.
Also the key problem with extrapolating is how it behaves when the ship is accelerating (bounces count but not only). If it doesn't match what other clients would see, it's not right.
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Jul 03, 2010 10:01 pm Post subject: |
|
|
|
|
OK
Very weird thing...
I have code that sends an arena message on the goal callback, and on the BlockBallGoal:
int BlockBallGoal(Arena *a, Player *p, int bid, int x, int y, struct BallData *newbd)
{
chat->SendArenaMessage(a, "Goal??? %i", p->pkt.freq);
|
If a player throws the ball, then gets killed before the ball reaches the goal, there is absolutely no callback whatsoever when the ball enters the goal. It just gets in it and bounces back out like nothing happened... Noticed that bug a while ago, but I thought it was me doing something wrong, even though I do absolutely nothing on the kill callback yet.
EDIT: Just did the test in Hyperspace... same bug. So it's definitely some bug deeper in the core
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Jul 03, 2010 10:16 pm Post subject: |
|
|
|
|
Ok... turns out a cfg setting 'Soccer:AllowGoalByDeath = 1' fixes this... It's supposed to toggle whether or not a player dying ON a goal tile should score, but from what I get in the code, even if you die after shooting a ball, it will clear the carrier of the ball in the 'CleanupAfter' function. If possible, it should test whether or not the ball is being dropped due to the player's death, or because he threw it earlier.
Also, Soccer:GoalDelay = xxx delays the ball respawn with no need of a timer and clumsy ball moving and hiding... neato.
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Jul 03, 2010 11:20 pm Post subject: |
|
|
|
|
Wow... another very weird thing... It happens with my module unloaded as well, so...
If you fire the ball from inside your own goal, it triggers a goal and the ball respawns... I'm guessing I could work around it by blocking the goal, but wtf?
|
|
Back to top |
|
|
Hakaku Server Help Squatter
Joined: Apr 07 2006 Posts: 299 Location: Canada Offline
|
Posted: Sun Jul 04, 2010 4:03 am Post subject: |
|
|
|
|
Samapico wrote: | If you fire the ball from inside your own goal, it triggers a goal and the ball respawns... I'm guessing I could work around it by blocking the goal, but wtf? |
Are you sure your settings are properly configured? (e.g. Soccer:Mode=1) I tested this on my end and can't reduplicate this behaviour.
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sun Jul 04, 2010 12:39 pm Post subject: |
|
|
|
|
Yes, soccer mode is 1
I'm using 1.5.0
|
|
Back to top |
|
|
Arnk Kilo Dylie Seasoned Helper
Age:36 Gender: Joined: Jul 14 2006 Posts: 108 Offline
|
Posted: Sun Jul 04, 2010 2:43 pm Post subject: |
|
|
|
|
Sounds like a bug. There was code added to make sure that if you fired a ball on a goal, it would not wait for a goal packet. However if it assumes Soccer mode is 0 that would be unfortunate.. blah :/
Incidentally that code could also be reformed to make the Soccer:AllowGoalByDeath setting more natural.
|
|
Back to top |
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 767 page(s) served in previous 5 minutes.
|