Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Balls stuff

 
Post new topic   Reply to topic Printable version
 View previous topic  Mainloop Timer Post :: Post Some crash log  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Jul 01, 2010 10:12 am    Post subject: Balls stuff Reply to topic Reply with quote

I worked with the balls module a lot last night... and I must say, making ASSS modules is way easier than Merv plugins tongue.gif
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 tongue.gif (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
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Jul 01, 2010 11:56 am    Post subject: Reply to topic Reply with quote

Another one...

I use this code to disallow someone to fire the ball from the opposing crease...

Code: Show/Hide
   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 icon_surprised.gif
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Jul 01, 2010 1:48 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Jul 01, 2010 2:16 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Jul 01, 2010 8:56 pm    Post subject: Reply to topic Reply with quote

Ok, I checked again, and the adviser really does block the CB_GOAL callback... scratch that part
Back to top
View users profile Send private message Add User to Ignore List
Arnk Kilo Dylie
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Fri Jul 02, 2010 12:14 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
Goldeye
Novice


Gender:Gender:Male
Joined: Dec 15 2003
Posts: 57
Offline

PostPosted: Sat Jul 03, 2010 4:20 pm    Post subject: Re: Balls stuff Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat Jul 03, 2010 7:45 pm    Post subject: Reply to topic Reply with quote

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 41 time(s)
Back to top
View users profile Send private message Add User to Ignore List
Goldeye
Novice


Gender:Gender:Male
Joined: Dec 15 2003
Posts: 57
Offline

PostPosted: Sat Jul 03, 2010 8:03 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat Jul 03, 2010 10:01 pm    Post subject: Reply to topic Reply with quote

OK

Very weird thing...

I have code that sends an arena message on the goal callback, and on the BlockBallGoal:

Code: Show/Hide

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
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat Jul 03, 2010 10:16 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat Jul 03, 2010 11:20 pm    Post subject: Reply to topic Reply with quote

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? icon_surprised.gif
Back to top
View users profile Send private message Add User to Ignore List
Hakaku
Server Help Squatter


Joined: Apr 07 2006
Posts: 299
Location: Canada
Offline

PostPosted: Sun Jul 04, 2010 4:03 am    Post subject: Reply to topic Reply with quote

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? icon_surprised.gif

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
View users profile Send private message Add User to Ignore List Send email
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Jul 04, 2010 12:39 pm    Post subject: Reply to topic Reply with quote

Yes, soccer mode is 1

I'm using 1.5.0
Back to top
View users profile Send private message Add User to Ignore List
Arnk Kilo Dylie
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Sun Jul 04, 2010 2:43 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 668 page(s) served in previous 5 minutes.

phpBB Created this page in 0.480728 seconds : 42 queries executed (91.3%): GZIP compression disabled