Server Help

ASSS Custom Projects - Module requested from DrBrain

WhiskeyTango - Sat Jul 10, 2010 5:08 am
Post subject: Module requested from DrBrain
If you still have it, may I have a copy of that unfinished "multi-decoy" module you were working on.. I found it a very intriguing idea and would love to check it out.. I figure it was better to ask here rather than in-game.. Never know when to catch you.. xD
Dr Brain - Sat Jul 10, 2010 9:14 am
Post subject:

Code: Show/Hide

#include <stdlib.h>
#include <math.h>

#include "asss.h"
#include "hscore.h"
#include "selfpos.h"

local Imodman *mm;
local Ilogman *lm;
local Inet *net;
local Ihscoreitems *items;
local Iselfpos *selfpos;
local Ichat *chat;

local void Pppk(Player *p, byte *p2, int len)
   struct C2SPosition *pos = (struct C2SPosition *)p2;

   if (len < 22)

   /* handle common errors */
   if (!p->arena)

   if (p->p_ship == SHIP_SPEC)

   if (pos->weapon.type == W_DECOY)
      int decoysplit = items->getPropertySum(p, p->p_ship, "decoysplit", 0);
      if (decoysplit)
         int i;
         int offset = 0; // rand() % 40;
         double splitvel = items->getPropertySum(p, p->p_ship, "splitvel", 1000);
         struct Weapons weapon = {
            W_DECOY, 0, 0, 0, 0, 0
         for (i = 0; i < decoysplit; i++)
            int direction = (offset + (i * (40 / decoysplit))) % 40;

            // 0 = north, pi/2 = east
            double phi = ((double)(direction)) * M_PI / 20.0;
            int v_x = pos->xspeed + (int)(splitvel * sin(phi));
            int v_y = pos->yspeed + (int)(splitvel * cos(phi));

            if (i + 1 < decoysplit)
               chat->SendMessage(p, "Decoy %d: vx=%d vy=%d dir=%d", i, v_x, v_y, direction);
               selfpos->WarpPlayerWithWeapon(p, pos->x, pos->y, v_x, v_y, direction, i - decoysplit - 1, &weapon);
               chat->SendMessage(p, "Final %d: vx=%d vy=%d dir=%d", i, v_x, v_y, direction);
               selfpos->WarpPlayer(p, pos->x, pos->y, v_x, v_y, direction, 0);

EXPORT int MM_hs_decoy(int action, Imodman *_mm, Arena *arena)
   if (action == MM_LOAD)
      mm = _mm;

      lm = mm->GetInterface(I_LOGMAN, ALLARENAS);
      net = mm->GetInterface(I_NET, ALLARENAS);
      items = mm->GetInterface(I_HSCORE_ITEMS, ALLARENAS);
      selfpos = mm->GetInterface(I_SELFPOS, ALLARENAS);
      chat = mm->GetInterface(I_CHAT, ALLARENAS);

      if (!lm || !net || !items || !selfpos || !chat) return MM_FAIL;

      net->AddPacket(C2S_POSITION, Pppk);

      return MM_OK;
   else if (action == MM_UNLOAD)
      net->RemovePacket(C2S_POSITION, Pppk);


      return MM_OK;
   return MM_FAIL;

You'll need hs_util's selfpos module. I've given up on ever making this work.
WhiskeyTango - Sat Jul 10, 2010 9:25 am
Post subject:
ty very much.. icon_smile.gif
Cheese - Sat Jul 10, 2010 4:28 pm
Post subject:
ive got something that does the same thing with no dependencies if youre interested.

the most ive ever gotten from it was four though.
the reason none of these work is because the client starts ignoring them after 2-4 for some reason...
let me know if you get better results
JoWie - Wed Jul 14, 2010 1:25 pm
Post subject:
Try sending one decoy per tick using the correct timestamp
WhiskeyTango - Wed Jul 14, 2010 8:18 pm
Post subject:
I am definately interested Cheese!, thanks for the offer.. For some reason I can always get stuff from brain to compile but ALWAYS have ERROR loading module.. Probably something I'm always forgetting to include in one way or another to make them right.. I even got the hscore stuff to compile after I fixed some things, but I get the same thing... Error loading... I don't know if it's because his is for linux and mine for windows or if that even matters... I guess it could be because I don't have my SQL server connecting correctly or not.. But for now that is on a back burner because I'm working on a new turf idea I've never seen used...

I would however REALLY appreciate a working multi-decoy module.. It's directly related to what I'm doing and I need it...
Dr Brain - Wed Jul 14, 2010 9:55 pm
Post subject:
An error loading a newly compiled module is almost always a missing dependency.

Look for a line similar to this in the offending module:
Code: Show/Hide

if (!lm || !net || !items || !selfpos || !chat) return MM_FAIL;

That tells you what it expects. In this case it needs logman, net, hscore_items, hs_util:selfpos, and chat. So if the loading is failing, it's probably because you haven't loaded hscore_items or hs_util:selfpos.

The same debugging technique applies to the hscore modules, and basically any other C module.
WhiskeyTango - Wed Jul 14, 2010 10:15 pm
Post subject:
Very cool... Thanks for the info...
Cheese - Thu Jul 15, 2010 4:45 am
Post subject:
downside to mine is that its part of my 'misc' module, which is just an array of random crap i havnt put anywhere else yet...

meaning i could give you a slice of code, and not a prebuilt module
WhiskeyTango - Thu Jul 15, 2010 10:20 pm
Post subject:
That's fine... I can compile it... As long as the slice works... If not just let me know what I need to fix it, or at least, just the fact that it's incomplete.. Either works for me.. Thanks again for offering it...
Cheese - Thu Aug 12, 2010 11:38 pm
Post subject:
i tried this again in distension, and ive concluded that the success on this, like the shapnel on thors, is heavily dependant on the timestamp on the packets, as well as the client's and zone's lag. any deviation and the weapon is not seen by clients. additionally, i have to guess that the checksum has to be valid as well. additionally, the timestamp can not match that of another weapon.

i have this up and running in distension, but out of 8 it only randomly gives 4-8 decoys at once, with a 80ms and 5% ploss connection, using timestamps +1,+2,+3,etc.

i wish i knew more, but its very sensitive.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group