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
damage (binaries only)
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Module requested from DrBrain Post :: Post Python Scoreboard  View next topic  
Author Message
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Sep 26, 2006 12:29 pm    Post subject: damage (binaries only) Reply to topic Reply with quote

I have decided to release binaries of my damage module so others can experiment with it.

You can track damage on bots (like in my Pirates! zone) and you can also track damage on tiles (I'm planning to release my BF2142 project which has code examples for the tile damage).

It tracks, bullets, bombs, mines and thors. Although double barrel bullets aren't implemented. Bouncing stuff is implemented.

Here is the interface:
Code: Show/Hide
/** called when a tracked player is killed */
typedef void (*KilledFunc)(Player *p, Player *killer, void *clos);

/** user module must set new x and y coords for this players position. */
typedef void (*RespawnFunc)(Player *p, void *clos);

/** called when a tile in a tracked region takes damage. x and y are the tile
* damage is the amount of damage taken, freq is the owner of the weapon,
* wtype is the type of the weapon that did the damage, see packets/ppk.h for
* weapon types. */
typedef void (*TileDamageFunc)(Arena *arena, int x, int y, int damage,
      int freq, int wtype, void *clos);

/** the interface id for damage */
#define I_DAMAGE "damage-2"

/** the damage interface struct */
typedef struct Idamage
{
   INTERFACE_HEAD_DECL

   /** pos will get modified if this player is effected by a weapon,
    * killfunc will get called when this player dies. currently
    * killfunc is optional but respawnfunc is required. */
   void (*AddFake)(Player *p, struct C2SPosition *pos,
         KilledFunc killfunc, RespawnFunc respawnfunc, void *clos);
   void (*RemoveFake)(Player *p);

   /** call this when the fake player enters a safe zone or fires a weapon */
   void (*FakePosition)(Player *p, struct C2SPosition *pos, int len);

   void (*AddRegion)(Arena *arena, Region *rgn, TileDamageFunc tilefunc,
         void *clos);
   void (*RemoveRegion)(Arena *arena, Region *rgn);
} Idamage;


When tracking bot damage you are supposed to provide a pointer to the bot's "struct C2SPosition *pos". As in both your module and the damage module will be using the same piece of mem.

Tile damage works per region. You should paint your region on and adjacent to the tiles you are interested in for good measure.




v1.7 1.4.3 doc so dll

asss-damage-1.7.zip - 21.76 KB
File downloaded or viewed 114 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Bak
?ls -s
0 in


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

PostPosted: Tue Sep 26, 2006 1:16 pm    Post subject: Reply to topic Reply with quote

Quote:
this module is closed source due to the amount of effort I put into it.


icon_sad.gif
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sat Oct 14, 2006 7:10 am    Post subject: Reply to topic Reply with quote

Example of tracking damage on fake players:
http://forums.minegoboom.com/viewtopic.php?p=66152#66152
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu May 17, 2007 3:33 pm    Post subject: Reply to topic Reply with quote

Update
Kill callback is now asynchronous so you can safely call Add/RemoveFake inside it without a deadlock occuring.
Also added more checks if a tracked player is moved to spec.

The interface hasn't changed so it shouldn't be necessary to recompile any modules that use the damage module.




v1.8 (48k 1.4.3 doc so dll)

asss-damage-1.8.zip - 47.21 KB
File downloaded or viewed 90 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Jun 10, 2007 8:02 am    Post subject: Reply to topic Reply with quote

Update
Fixed bots not reloading settings when spawning out of spec.
Made the tile damage callback asynchronous for the same reasons as before.
Fixed possible crash when running on windows and an arena is destroyed.




v1.10 (1.4.3 doc so dll)

asss-damage-1.10.zip - 24.16 KB
File downloaded or viewed 83 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Wed Jul 04, 2007 6:05 pm    Post subject: Reply to topic Reply with quote

Update
Added arena setting: Damage:IgnoreTeamDamage (default: 0).
Added support for some of the special tiles.




1.4.3 doc so dll

asss-damage-1.11.zip - 26 KB
File downloaded or viewed 79 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Wed Jul 04, 2007 6:25 pm    Post subject: Reply to topic Reply with quote

Smong wrote:
Update
Added arena setting: Damage:IgnoreTeamDamage (default: 0).
Added support for some of the special tiles.


thank you
Back to top
View users profile Send private message Add User to Ignore List
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Sat Sep 15, 2007 6:42 am    Post subject: Reply to topic Reply with quote

Could you recompile this for 1.4.4?
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sat Sep 15, 2007 9:34 am    Post subject: Reply to topic Reply with quote

Ok.



1.4.4 doc so dll

asss-damage-1.12.zip - 33.05 KB
File downloaded or viewed 105 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Agile
Guest


Offline

PostPosted: Wed Mar 05, 2008 9:37 pm    Post subject: Smong, can you add a CB to your damage module? Reply to topic Reply with quote

The reason I ask is because I want to make all bombs do exactly 1000 damage to bots regardless of where they hit, and this isn't possible (to my knowledge) using regular ss settings. I could use a watchdamage callback (I think?) to do this, but it seems kind of redundant to have 2 damage watches on each bot, not to mention performance-draining and ugly coding.
-JP
Back to top
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Mar 06, 2008 12:55 pm    Post subject: Reply to topic Reply with quote

Sorry is there a question in there? Were you asking for a modification to this module? Watchdamage only works on the contiuum client.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Agile
Guest


Offline

PostPosted: Thu Mar 06, 2008 4:24 pm    Post subject: Reply to topic Reply with quote

Er, I wrote the first part in the subject line which is barely noticeable.
It should read:
Smong, can you add a CB to your damage module?
The reason I ask is because I want to make all bombs do exactly 1000 damage to bots regardless of where they hit, and this isn't possible (to my knowledge) using regular ss settings. I could use a watchdamage callback (I think?) to do this, but it seems kind of redundant to have 2 damage watches on each bot, not to mention performance-draining and ugly coding.
-JP
Back to top
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Mar 07, 2008 2:04 pm    Post subject: Reply to topic Reply with quote

Ok I might look into adding a callback for bot damage this weekend. The main reason I didn't do it in the first place is some weapon settings could cause it to spam callbacks causing a performance hit on the server.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Goldeye
Novice


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

PostPosted: Wed May 20, 2009 7:25 am    Post subject: Reply to topic Reply with quote

Any chance of getting the source for this, Smong? icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List Send email
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Sun Jul 26, 2009 5:45 pm    Post subject: Reply to topic Reply with quote

Update

  • Fixed EMP bomb and bouncing bomb damage (emp bombs were normal damage; bouncing bomb would do normal damage after the last bounce; bouncing emp bomb used EBombDamagePercent and not EBombDamagePercent WITH BBombDamagePercent)
  • Region damage tracking now uses EBombDamagePercent and BBombDamagePercent
  • Added EMP Bomb Shutdown

(everything else in this module is made by smong)

Contact me, not smong for any issues with this release.




damage 1.14 for ASSS 1.4.0

damage-1.14.zip - 24.79 KB
File downloaded or viewed 69 time(s)
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: Sun Jul 26, 2009 7:36 pm    Post subject: Reply to topic Reply with quote

How did you get the source?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Initrd.gz
Seasoned Helper


Joined: Sep 18 2008
Posts: 134
Location: Over there --->
Offline

PostPosted: Sun Jul 26, 2009 9:37 pm    Post subject: Reply to topic Reply with quote

Bak wrote:
How did you get the source?

Its a trojan dont download! </sarcasm>

Really how did you?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Mon Jul 27, 2009 5:57 am    Post subject: Reply to topic Reply with quote

I asked smong... But he asked me not to release the source.

We needed the source for Command & Conquer because we will most likely move to a different server which requires a recompile in a few weeks. There are also some issues that need to be resolved. (for example, i want to track energy myself, so I am going to add a callback for fake players in the same way as in TileDamageFunc).
So because smong kinda left subspace he gave us the source

Also, for those interested, the following things are not (yet) implemented in damage:


Currently, on my todo list is the callback I mentioned above, bricks, multifire and double barrel


Last edited by JoWie on Sat Jun 12, 2010 6:21 pm, edited 2 times in total
Back to top
View users profile Send private message Add User to Ignore List
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Wed Jul 29, 2009 9:23 am    Post subject: Reply to topic Reply with quote

Update

  • Added additional information about weapons to TileDamageFunc
  • New: FakeDamageFunc, allows you to watch damage on turrets
  • New: "manageenergy" boolean in the AddFake method. If this is set to false the damage module will NOT track the fake players energy and you will have to use FakeDamageFunc to track it yourself. The old behavior is true.
  • tick_t values now use the TICK_DIFF, TICK_GT, TICK_MAKE macro's
  • moved all cfg->GetInt to AA_CREATE | AA_CONFCHANGED instead of reading it on every weapon fire, weapon hit, etc.



The interface has changed! So you will need to modify and recompile any modules that uses damage




Damage 1.16 for ASSS 1.4.4

damage-1.16.zip - 26.69 KB
File downloaded or viewed 70 time(s)
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: Wed Jul 29, 2009 6:18 pm    Post subject: Reply to topic Reply with quote

I don't think anyone else uses this, because it's so limited and can't be extended (because of the closed source). I know at least HS and HZ can't use it, because it isn't compiled against our cores. Add to the fact that it's author has left the game, and I doubt you'll get many takers.
_________________
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
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Thu Jul 30, 2009 6:23 am    Post subject: Reply to topic Reply with quote

Above changes is what I needed myself. All I did extra is upload it here.

I will be willing to help others compile. But it still creates a dependency on a 3rd party (me/smong). Which is one of the reasons I wanted the source myself.

I would have put up the source if smong hadn't asked not to do so.
Back to top
View users profile Send private message Add User to Ignore List
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Sat Aug 29, 2009 3:14 pm    Post subject: Reply to topic Reply with quote

id sell the source to the highest bidder, ive got a copy, no lies.
Back to top
View users profile Send private message Add User to Ignore List
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Sun Feb 21, 2010 4:33 pm    Post subject: Reply to topic Reply with quote


  • Updated for ASSS 1.5.0rc1
  • Double barrel support
  • Fixed a small bug where TICK_GT(current_ticks(), 0) could occur (overflowed into negative)
  • weapons no longer hit dead players


I have tested a bunch of radius' and they match up to continuum.
Modified so that it makes sense out of context:
Code: Show/Hide

offset2 = shipradius * 0.7;
if (shipradius == 14) // special case, probably for VIE compatability
   offset1 = offset2;
else
   offset1 = offset2 + 1;

sin(i * PI / 20)
// double barrel 1(left one with rot = 0)
barrel1->x += round(offset1 * ( sin(((pos->rotation + 30) % 40) * PI / 20) ));
barrel1->y -= round(offset1 * ( sin(pos->rotation) * PI / 20 ));

// double barrel 2 (right one with rot = 0)
barrel2->x -= round(offset2 * ( sin(((pos->rotation + 30) % 40) * PI / 20) ));
barrel2->y += round(offset2 * ( sin(pos->rotation) * PI / 20 ));

When one of the barrels hits a player, both are removed, only one counts for damage.


Will compile windows version if needed




damage 1.18

damage-1.18.zip - 9.39 KB
File downloaded or viewed 76 time(s)


Last edited by JoWie on Mon Feb 22, 2010 4:43 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Mon Feb 22, 2010 12:29 am    Post subject: Reply to topic Reply with quote

im curious, because a bunch of my 1.4.4 modules do not work with 1.5, what did you change to make it work?


also:
1 radius + 1 radius = 2 radii
:)
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Mon May 24, 2010 12:10 pm    Post subject: Reply to topic Reply with quote


  • Removed damage->FakePosition (no longer needed due to CB_PPK) so use game->FakePosition instead
  • Minor changes in the naming in the interface
  • Other modules can now track weapon fire, weapon hit and loop over all the weapons in an arena. The weapon data can not be modified however


Linux version is compiled against trunk 1137. Windows version is compiled against the ASSS 1.5.0rc2 release.

Example:
Code: Show/Hide

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#include "asss.h"
#include "damage.h"

static Imodman      *mm;
static Iarenaman    *aman;
static Iplayerdata   *pd;
static Idamage      *damage;
static Ilogman      *lm;

static int arenaKey  = -1;
static int playerKey = -1;

struct ArenaData
{

};

#define PlayerData PlayerData_
struct PlayerData
{
   Arena *arena;
};


static struct ArenaData* GetArenaData(Arena *arena)
{

        struct ArenaData *adata = P_ARENA_DATA(arena, arenaKey);



        return adata;
}

static struct PlayerData* GetPlayerData(Player *p)
{
        struct PlayerData *pdata = PPDATA(p, playerKey);


        if (p->arena && p->arena != pdata->arena)
        {
                pdata->arena = p->arena;
           //...
        }
        return pdata;
}

static void newWeaponCB(Arena *arena, DamageWeapon *wpn)
{
   lm->LogP(L_INFO, "damagetest", wpn->p, "Added a weapon (%p) at %d, %d", wpn, wpn->x / 1000, wpn->y / 1000);
}

static void removeWeaponCB(Arena *arena, DamageWeapon *wpn, u8 removereason)
{
   const char *reason;
   switch (removereason)
   {
      case DAMAGE_REMOVEWPN_HIT:
         reason = "Hit a tile";
      break;
      case DAMAGE_REMOVEWPN_HITPLAYER:
         reason = "Hit a player";
      break;
      case DAMAGE_REMOVEWPN_OTHERBARRELHIT:
         reason = "Other barrel hit a player";
      break;
      case DAMAGE_REMOVEWPN_SHIPFREQCHANGE:
         reason = "Firer changed ship / freq";
      break;
      case DAMAGE_REMOVEWPN_LEAVEARENA:
         reason = "Firer left the arena";
      break;
      case DAMAGE_REMOVEWPN_EXPIRED:
         reason = "Weapon expired";
      break;
      case DAMAGE_REMOVEWPN_SAFEZONE:
         reason = "Firer entered a safe zone";
      break;
      default:
         reason = "UNKNOWN";
      break;
   }

   lm->LogP(L_INFO, "damagetest", wpn->p, "Removed a weapon(%p) at %d, %d. Because: %s", wpn, wpn->x / 1000, wpn->y / 1000, reason);
}

static void weaponsUpdatedCB(Arena *arena, ticks_t now)
{
   static DamageWeapon* lastFound = NULL;
   DamageWeapon *wpn;
   Link *link;

   damage->WeaponLock(arena);
   FOR_EACH_DAMAGEWEAPON(wpn, arena)
   {
      if (wpn->wpn.type == W_THOR)
      {
         if (wpn != lastFound)
         {
            lm->LogA(L_INFO, "damagetest", arena, "Found a thor while looping over all the current weapons! (only displayed once)");
            lastFound = wpn;
         }

         break;
      }
   }
   damage->WeaponUnlock(arena);
}


EXPORT const char info_template[] = "DamageTest";
static void ReleaseInterfaces()
{
        mm->ReleaseInterface(aman   );
        mm->ReleaseInterface(pd     );
        mm->ReleaseInterface(damage );
        mm->ReleaseInterface(lm     );

}

EXPORT int MM_damagetest(int action, Imodman *mm_, Arena *arena)
{
        if (action == MM_LOAD)
        {
                mm      = mm_;
                aman    = mm->GetInterface(I_ARENAMAN        , ALLARENAS);
                pd      = mm->GetInterface(I_PLAYERDATA      , ALLARENAS);
                damage  = mm->GetInterface(I_DAMAGE        , ALLARENAS);
                lm      = mm->GetInterface(I_LOGMAN        , ALLARENAS);


                if (!aman || !pd || !damage || !lm)
                {
                        ReleaseInterfaces();
                        printf("<damagetest> Missing interfaces");
                        return MM_FAIL;
                }

                arenaKey = aman->AllocateArenaData(sizeof(struct ArenaData));
                playerKey = pd->AllocatePlayerData(sizeof(struct PlayerData));

                if (arenaKey == -1 || playerKey == -1) // check if we ran out of memory
                {
                        if (arenaKey  != -1) // free data if it was allocated
                                aman->FreeArenaData(arenaKey);

                        if (playerKey != -1) // free data if it was allocated
                                pd->FreePlayerData (playerKey);

                        ReleaseInterfaces();

                        return MM_FAIL;
                }

                return MM_OK;

        }
        else if (action == MM_UNLOAD)
        {


                aman->FreeArenaData(arenaKey);
                pd->FreePlayerData(playerKey);

                ReleaseInterfaces();

                return MM_OK;
        }
        else if (action == MM_ATTACH)
        {
      damage->AddWeaponCallback(arena, newWeaponCB, removeWeaponCB, weaponsUpdatedCB);

                return MM_OK;
        }
        else if (action == MM_DETACH)
        {
      damage->RemoveWeaponCallback(arena, newWeaponCB, removeWeaponCB, weaponsUpdatedCB);

                return MM_OK;
        }

        return MM_FAIL;
}






damage-1.22

damage-1.22.zip - 30.48 KB
File downloaded or viewed 90 time(s)
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 -> ASSS Custom Projects All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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: 633 page(s) served in previous 5 minutes.

phpBB Created this page in 0.513086 seconds : 52 queries executed (89.4%): GZIP compression disabled