Server Help

Bot Questions - Moving ball

Doggeti - Tue May 25, 2004 5:08 am
Post subject: Moving ball
Is it possible to move a ball without touching it ( warping the ball carrier to the new position and spec / shipchange him ) ?
wEaViL - Tue May 25, 2004 7:57 am
Post subject:
http://www.subspacedownloads.com/index.php?act=list&cat=22 theres 2 ball mover plugins in there. I'm not sure if this is what your looking for but they where made to move the balls if they spawn or are placed in a area outside of the map or in inclosed sections of the map.. from the description of one of them you just input the coords into the ini for the sections of the map that the bot will move the ball out of if the ball is in there.
Doggeti - Tue May 25, 2004 8:40 am
Post subject:
I am not looking for already made plugins but I want to know what you have to code into MervBot to move it.
I am currently writing a plugin and it would help me a lot if I knew how to do that.
Mr Ekted - Tue May 25, 2004 11:07 am
Post subject:
Bot needs to send packet to pickup ball. This only has a chance of working if the ball is loose. Then the bot has to wait until the ball is caught by someone. If it is not itself, then it must wait until the ball is passed to try to pick it up again (another pickup packet), or spec the carrier. Even that does not guarantee a loose ball as another nearby ship may quickly pick it up.
Doggeti - Tue May 25, 2004 1:02 pm
Post subject:
I don't understand this process so please forgive me if my question sounds stupid in your ears. How do I control to where the ball will be moved?
Mr Ekted - Tue May 25, 2004 1:35 pm
Post subject:
Once the bot has the ball (I assume whatever core you use has some "ball has been picked up by player" event), you just need to issue a ball-pass packet. To place it unmoving at a location, use zero for dx and dy (movement vector). Sorry for the vagueess; I don't know the API's for other bot cores.
50% Packetloss - Tue May 25, 2004 4:02 pm
Post subject:
tell(makeShip(SHIP_Warbird));//sc to ship 1
tell(makeGrabBall(0));//the 0 is the ball's ident

me->move(512*16,512*16);//tells the bot the coords you want
tell(makeSendPosition(true));//makes the bot actually go there

You might even want to turn off some stuff when the bot goes in,

tell(makeFollowing(false));//makes the bot stop following people
tell(makeFlying(true));//makes the bot stop sending it's own position BS

if you do the avove, add in event_positionhook:
tell(makeSendPosition(false));


then at end,
tell(makeShip(SHIP_Spectator));//the ball is dropped at bot's final location
Doggeti - Tue May 25, 2004 4:08 pm
Post subject:
Thank you very very much ! grav_cool-hands.gif
Mr Ekted - Tue May 25, 2004 4:20 pm
Post subject:
That will not work if the bot fails to grab the ball. A bot (client) cannot forcibly take a ball from a player without putting them into spec.
D1st0rt - Tue May 25, 2004 4:46 pm
Post subject:
unless you know how to forge a packet from someone else
Mr Ekted - Tue May 25, 2004 5:30 pm
Post subject:
D1st0rt wrote:
unless you know how to forge a packet from someone else


Which would cause them to be disconnected when they get out of sync with ACK's. icon_smile.gif
50% Packetloss - Tue May 25, 2004 5:31 pm
Post subject:
yah, you cant take the ball from someone else

so if(ball->carrier != 0xFFFF)
then you wont be able to get the ball. You can force a player to drop the ball by shipchanging them
Mr Ekted - Tue May 25, 2004 10:37 pm
Post subject:
Even if ball->carrier == 0xFFFF, there's no guarantee that issuing tell(makeGrabBall(0)); will get you the ball. Someone else may grab it first.
Anonymous - Wed May 26, 2004 1:19 am
Post subject:
you CAN take the ball when another player is holding it... It's a subgame bug and won't work in ASSS (unless you tell ASSS to let it work), but does work in subgame.

all the code you really need is:

int ident = ball->ident;

tell(makeShip(SHIP_Warbird));
tell(makeGrabBall(ident));
tell(makeFireBall(ident, ball->x, ball->y, ball->xvel, ball->yvel));tell(makeShip(SHIP_Spectator));

the bot might "flicker" for a second over a player but it shouldn't affect the game. You also might want to prevent disable the default mervbot turret behavior... as he might kill the player he "flickers" over if this option isn't disabled.
Anonymous - Wed May 26, 2004 1:20 am
Post subject:
opps... forgot to press enter

int ident = ball->ident;

tell(makeShip(SHIP_Warbird));
tell(makeGrabBall(ident));
tell(makeFireBall(ident, ball->x, ball->y, ball->xvel, ball->yvel));
tell(makeShip(SHIP_Spectator));
Anonymous - Wed May 26, 2004 1:31 am
Post subject:
or instead of using ball->x and ball->y you can use your position in pixels and ball->xvel and ball->yvel is in pixels / 10 seconds

Sry about the triple post
Mr Ekted - Wed May 26, 2004 11:11 am
Post subject:
Anonymous wrote:
you CAN take the ball when another player is holding it... It's a subgame bug and won't work in ASSS.


I don't believe you. What is the bug?
50% Packetloss - Wed May 26, 2004 11:30 am
Post subject:
It seemed to have worked, the tell(makeGrabBall(ident)); was enough to do it. Here is the code that is executed
Code: Show/Hide

h->postRR(generatePowerballRequest(pb->hosttime, id));//this is what
//happens after the tell(makegrabball(int)); Below are the functions


clientMessage *generatePowerballRequest   (Uint32 timestamp, BYTE ball)
{   clientMessage *ret = new clientMessage(6);
   if (ret == NULL) return NULL;
   char *msg = ret->msg;

   /*   Field   Length   Description
      0      1      Type byte
      1      1      Ball ident
      2      4      Timestamp
   */

   msg[0] = 0x20;
   msg[1] = ball;
   *(Uint32*)&msg[2] = timestamp;

   return ret;
}
void Host::postRR(clientMessage *cm)
{
   if (cm)
   {
      post(cm->msg, cm->len, true);
      delete cm;
      cm = NULL;
   }
}

void Host::post(char *msg, Uint32 len, bool reliable)
{
   char buffer[PACKET_MAX_LENGTH];

   if (len > CHUNK_SIZE + 12)
   {   // Chunk it
      if (len > 1000)
      {
         for (Uint32 i = 0; i < len; i += CHUNK_SIZE)
         {
            buffer[0] = 0x00;
            buffer[1] = 0x0A;
            *(Uint32*)&buffer[2] = len;

            Uint32 remaining = len - i;

            if (remaining > CHUNK_SIZE)
            {   // Chunk body
               memcpy(buffer + 6, msg + i, CHUNK_SIZE);

               post(buffer, CHUNK_SIZE + 6, true);
            }
            else
            {   // Chunk tail
               memcpy(buffer + 6, msg + i, remaining);

               post(buffer, remaining + 6, true);
            }
         }
      }
      else
      {
         buffer[0] = 0x00;
         buffer[1] = 0x08;

         for (Uint32 i = 0; i < len; i += (CHUNK_SIZE + 4))
         {
            Uint32 remaining = (len - i);

            if (remaining > (CHUNK_SIZE + 4))
            {   // Chunk body
               memcpy(buffer + 2, msg + i, CHUNK_SIZE + 4);

               post(buffer, CHUNK_SIZE + 6, true);
            }
            else
            {   // Chunk tail
               buffer[1] = 0x09;

               memcpy(buffer + 2, msg + i, remaining);

               post(buffer, remaining + 2, true);

               break;
            }
         }
      }
   }
   else
   {   // We're dealing with byte-sized messages now
      if (reliable)
      {   // Stamp reliable header
         buffer[0] = 0x00;
         buffer[1] = 0x03;
         *(Uint32*)&buffer[2] = localStep;
         memcpy(buffer + 6, msg, len);
         msg = buffer;
         len += 6;

         if (queue(msg, len) == false) return;
      }

      if (clustering)
      {   // Append to cluster list
         clusterMessage *m = new clusterMessage(msg, len);
         if (m)
            clustered.append(m);
         else
            send(msg, len);
      }
      else
      {   // Send right away
         send(msg, len);
      }
   }
}

Mr Ekted - Wed May 26, 2004 12:55 pm
Post subject:
I know how the packets work. I don't need to see the MERV garbage.

If any client can send grab-ball packet and have it work, then clients with higher ping would be stealing the ball from other ships all the time. I don't see how this makes sense at all.
Anonymous - Wed May 26, 2004 1:37 pm
Post subject:
Maybe because when another player gets near the ball it goes fazed so the lagged player won't even send a ball request?
Mr Ekted - Wed May 26, 2004 2:09 pm
Post subject:
Phasing is client-side.
Anonymous - Wed May 26, 2004 2:31 pm
Post subject:
Which is why the bot can get the ball as it doesn't implement phasing.
Mr Ekted - Wed May 26, 2004 2:36 pm
Post subject:
Yes, but that means that any client that doesn't think another player should be able to grab the ball could steal it from them. I've never seen this happen, only the opposite (both clients think the other player should grab it, so neither tries, ball phases and no one gets it).
Anonymous - Thu May 27, 2004 12:20 am
Post subject:
in botdll.cpp event_ballgrab:

h->postRR(generatePowerballRequest(pb->hosttime, id));

it looks like it uses the same timestamp from the last ball event... which is probably before any player could pick it up.

The server probably takes whichever one grabbed it earlier and uses that.

In either case, I've made a bot that can "steal" the ball from players... so it can be done.
50% Packetloss - Thu May 27, 2004 1:45 am
Post subject:
catid says that subgame inadequately checks powerball requests. I forgot his exact words.
Mr Ekted - Thu May 27, 2004 10:38 am
Post subject:
Interesting. JeffP relied too much on client authority.
2dragons - Mon Jun 07, 2004 12:22 am
Post subject:
I wrote a bit of code for TWCore to move balls awhile back. I was able to take a ball from other players who already had posession of the ball. In fact anytime I issued the packet to grab a ball the bot got the ball.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group