Author |
Message |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Tue Sep 26, 2006 12:29 pm Post subject: damage (binaries only) |
 |
|
|
|
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:
/** 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 63 time(s)
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:24 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu May 17, 2007 3:33 pm Post subject: |
 |
|
|
|
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 40 time(s)
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sun Jun 10, 2007 8:02 am Post subject: |
 |
|
|
|
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 46 time(s)
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Wed Jul 04, 2007 6:05 pm Post subject: |
 |
|
|
|
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 42 time(s)
|
|
Back to top |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Wed Jul 04, 2007 6:25 pm Post subject: |
 |
|
|
|
Smong wrote: | Update
Added arena setting: Damage:IgnoreTeamDamage (default: 0).
Added support for some of the special tiles. |
thank you
|
|
Back to top |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Sat Sep 15, 2007 6:42 am Post subject: |
 |
|
|
|
Could you recompile this for 1.4.4?
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sat Sep 15, 2007 9:34 am Post subject: |
 |
|
|
|
Ok.
1.4.4 doc so dll
asss-damage-1.12.zip - 33.05 KB
File downloaded or viewed 62 time(s)
|
|
Back to top |
|
 |
Agile Guest
Offline
|
Posted: Wed Mar 05, 2008 9:37 pm Post subject: 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
|
Posted: Thu Mar 06, 2008 12:55 pm Post subject: |
 |
|
|
|
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 |
|
 |
Agile Guest
Offline
|
Posted: Thu Mar 06, 2008 4:24 pm Post subject: |
 |
|
|
|
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
|
Posted: Fri Mar 07, 2008 2:04 pm Post subject: |
 |
|
|
|
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 |
|
 |
Goldeye Novice
Gender: Joined: Dec 15 2003 Posts: 57 Offline
|
Posted: Wed May 20, 2009 7:25 am Post subject: |
 |
|
|
|
Any chance of getting the source for this, Smong?
|
|
Back to top |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Sun Jul 26, 2009 5:45 pm Post subject: |
 |
|
|
|
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 32 time(s)
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:24 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Sun Jul 26, 2009 7:36 pm Post subject: |
 |
|
|
|
How did you get the source?
|
|
Back to top |
|
 |
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Sun Jul 26, 2009 9:37 pm Post subject: |
 |
|
|
|
Bak wrote: | How did you get the source? |
Its a trojan dont download! </sarcasm>
Really how did you?
|
|
Back to top |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Mon Jul 27, 2009 5:57 am Post subject: |
 |
|
|
|
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 |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Wed Jul 29, 2009 9:23 am Post subject: |
 |
|
|
|
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 33 time(s)
|
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:37 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Wed Jul 29, 2009 6:18 pm Post subject: |
 |
|
|
|
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 |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Thu Jul 30, 2009 6:23 am Post subject: |
 |
|
|
|
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 |
|
 |
Chambahs Power attack

Joined: Jun 19 2005 Posts: 820 Offline
|
Posted: Sat Aug 29, 2009 3:14 pm Post subject: |
 |
|
|
|
id sell the source to the highest bidder, ive got a copy, no lies.
|
|
Back to top |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
|
Back to top |
|
 |
Cheese Wow Cheese is so helpful!

Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Mon Feb 22, 2010 12:29 am Post subject: |
 |
|
|
|
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 |
|
 |
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Mon May 24, 2010 12:10 pm Post subject: |
 |
|
|
|
- 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:
#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 40 time(s)
|
|
Back to top |
|
 |
|