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
LVZ toggling

 
Post new topic   Reply to topic Printable version
 View previous topic  making .c and .h files into a .dll Post :: Post Bot Problem.  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Feb 12, 2008 12:51 am    Post subject: LVZ toggling Reply to topic Reply with quote

In mervbot's spawn.h:

// Increase this beyond 1 when Continuum supports LVZ object toggling with more than 1 object at a time.
#define MAX_OBJECTS 1


Can we toggle more than one lvz at once now? Does *objset really toggles many images at once, or sends a single packet for each object individually?
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
dugwyler
Newbie


Joined: Nov 29 2007
Posts: 7
Offline

PostPosted: Fri Feb 22, 2008 12:03 pm    Post subject: Reply to topic Reply with quote

Yeah, there's support for this now in packet C2S 0x0A:

index length desc
1 1 type byte (0x0A)
2 2 player id (0xFFFF for all players)
4 1 lvz packet type byte (0x35 for toggle)
5 2* lvz objID bitwise AND with 0x7FFF to turn on, 0x8000 to turn off

* repeat until done with all objects.


As for whether or not MERV supports this, dunno. See TWCore's GamePacketGenerator for an implementation that was ganked from Cerium's Hybrid. Also includes support for the type 0x36, for modification of LVZ objects.



As for just using *objset, yes, it works for any number of objects: *objset +5,-4,+3, -- just remember that you have to end with a trailing comma. I would recommend implementing on the packet level if MERV doesn't yet do it, though.
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: Fri Feb 22, 2008 12:08 pm    Post subject: Reply to topic Reply with quote

Yeah, I'll check that... thanks

(If anyone else more familiar with the Merv core wants to help me out on this, it could help a lot tongue.gif )

Is there really no limit to the number of objects you can toggle with one packet? Would ridiculous amounts like 2000 work? or 70000? tongue.gif
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: Fri Feb 22, 2008 12:21 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
clientMessage *generateObjectToggle      (Uint16 player, objectInfo *objects, Uint16 num_objects)
{   clientMessage *ret = new clientMessage(4 + 2 * num_objects);
   if (ret == NULL) return NULL;
   char *msg = ret->msg;

   /*   Field   Length   Description
      0      1      Type byte: 0x0a
      1      2      Player ident (-1 = all players)
      3      1      LVZ type byte: 0x35
   The following are repeated until the end of the message
      4      2      LVZ bitfield
   */

   msg[0] = 0x0a;
   *(Uint16*)&msg[1] = player;
   msg[3] = 0x35;

   memcpy(msg + 4, objects, 2 * num_objects);

   return ret;
}


It seems to be implemented already... But when I changed the MAX_OBJECTS value, my display got kind of screwed up... I'll do some more tests
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: Fri Feb 22, 2008 1:35 pm    Post subject: Reply to topic Reply with quote

hmm... it only effectively toggles HALF the objects

I wanted 5, it toggled 3, I wanted 10, it toggled 5

EDIT:

oh wait... look at the packets the bot received... from the terminal:

PV:Samapico> !toggleon
A:Toggling ON 10 objects
Object number 200 enabled
Object number 19917 disabled
Object number 211 enabled
Object number 19917 disabled
Object number 222 enabled
Object number 19917 disabled
Object number 233 enabled
Object number 19917 disabled
Object number 244 enabled
Object number 19917 disabled

It was supposed to toggle on: 200, 211, 222, 233, 244 and 300, 311, 322, 333, 344
for some reason it queued these 19917 objects off...


Last edited by Samapico on Fri Feb 22, 2008 2:01 pm, edited 1 time in total
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: Fri Feb 22, 2008 1:54 pm    Post subject: Reply to topic Reply with quote

Quote:
5 2* lvz objID bitwise AND with 0x7FFF to turn on, 0x8000 to turn off
Wouldn't that be 0xFFFF to turn it off?

If you do ( id bitwise AND 0x8000 ) it will always give 0...

edit: oh.. it would be a bitwise OR with 0x8000 to turn it off...
Either way, the MSB of that integer is whether or not the object is being disabled, and the other 15 bits are the objectID.
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: Fri Feb 22, 2008 2:06 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
union objectInfo
{
   struct
   {
      Uint16 id         : 15;   // Object ident
      Uint16 disabled      : 1;   // 1=off, 0=on
   };

   Uint16 n;
};


I'm not familiar with unions... is this thing 2x 16bits long?
If it is... then that's the bug tongue.gif

Edit: yeah it is... sizeof says it's 4 bytes long... what's the 'n' for???
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: Fri Feb 22, 2008 2:19 pm    Post subject: Reply to topic Reply with quote

what the hell... now it says it's 2 bytes long.. I don't understand anything gaaaah

I made Console application projects in both VS6 and VS2005, and both give me a size of 2 bytes for that union...

Why does it show up as 4 in the plugin project...

Plugin project:
Code: Show/Hide
sendPublic("*arena size: " + (String) sizeof(Uint16) + " " + (String) sizeof(objectInfo) );

Outputs: "size: 2 4"

Visual Studio new console application project:
Code: Show/Hide

#include "stdafx.h"

typedef unsigned short    Uint16;

union objectInfo
{
   struct
   {
      Uint16 id         : 15;   // Object ident
      Uint16 disabled      : 1;   // 1=off, 0=on
   };

   Uint16 n;
};


int main(int argc, char* argv[])
{
   printf("%i %i\n", sizeof(Uint16), sizeof(objectInfo));

   getchar();

   return 0;
}

Outputs: "2 2" in both Visual C++ 6.0 and Visual Studio 2005

What the hell am I doing wrong?




EDIT: I found the problem... the union posted above is from the clientprot.h file, in the core...

In spawn.h, there is a different definition of objectInfo:
Code: Show/Hide
union objectInfo
{
   struct
   {
      unsigned id            : 15;   // Object ident
      unsigned disabled      : 1;   // 1=off, 0=on
   };

   Uint16 n;
};

... so yeah.... tongue.gif unsigned != Uint16 I guess


By changing these 'unsigned' to Uint16, and changing MAX_OBJECTS to something bigger, anything using lvz's will be much more efficient...
Any chance of getting an updated version of Merv released with this?
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:24
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Feb 22, 2008 9:07 pm    Post subject: Reply to topic Reply with quote

wowow that's retarded. good find.

As for your union question, it's a way of having different ways to refer to the same memory location.
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Fri Feb 22, 2008 11:07 pm    Post subject: Reply to topic Reply with quote

Works like a charm now by the way...

My display module responds MUCH faster... When you change team for example, the whole display is changed on your screen with 1 packet, instead of like 20 :/
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Mar 02, 2008 12:01 pm    Post subject: Re: LVZ toggling Reply to topic Reply with quote

Samapico wrote:
In mervbot's spawn.h:

// Increase this beyond 1 when Continuum supports LVZ object toggling with more than 1 object at a time.
#define MAX_OBJECTS 1
Looks like you have an old version of the mervbot tutorial plugin code. I just downloaded a copy and it's set to 20.

Samapico wrote:
In spawn.h, there is a different definition of objectInfo
Can't see that in the tutorial code.

You might want to check for other differences between the latest tutorial code and your plugin before other old bugs creep in.
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Mar 02, 2008 7:50 pm    Post subject: Reply to topic Reply with quote

hmmm you're right...
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot 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: 661 page(s) served in previous 5 minutes.

phpBB Created this page in 0.608007 seconds : 37 queries executed (94.1%): GZIP compression disabled