New DLL callbacks - any requests?

Moderators: GSH, VSMIT, Red Devil, Commando

Commando
Flying Mauler
Posts: 2176
Joined: Fri Feb 18, 2011 6:41 pm

Re: New DLL callbacks - any requests?

Postby Commando » Tue Mar 15, 2016 1:18 am

Could always swap out the G66 DLL for a Stock DLL to see if it still happens. If I had the source to RD's G66 I could check to make sure it's not DLL caused.


Easier said than done. It's hard enough to find G66 games, it's even harder to find stock games.

mase
Thunderbolt
Posts: 155
Joined: Sat Mar 05, 2011 11:17 am

Re: New DLL callbacks - any requests?

Postby mase » Tue Mar 15, 2016 9:09 am

The server knows when a resync happens and then sends hat info to the clients affected, couldn't they then call a callback into the DLL?

Couldn't you test that resync issue locally by starting 2 bz2 sessions?

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Thu Apr 21, 2016 4:18 pm

I'd like to request a Vector GetWhere(Handle h); function, that works similar to GetWho, but returns the current vector of where the current command (GetCurrentCommand) is set to. This would help know where a unit is going, or etc.
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: New DLL callbacks - any requests?

Postby Nielk1 » Tue Aug 16, 2016 9:33 pm

Any way to get an enumerable set of handles would be awesome, it would really help my lua wrapper. Right now I am looking at keeping a sequence number octree as my core and at postload pushing in meta data for querying. Be nice if I didn't have to store everything myself for basic lookups (plus the fact I'd have to only sometimes update my construct's locations).

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Sun Aug 28, 2016 5:34 pm

A few functions that would be useful:

A SetCanSnipe function that sets the same as canSnipe = true/false in the ODF, on the handle. This would negate the need for modders to make special, non snipe-able odfs for SP missions.

// Sets if a handle can be sniped, -1 = Auto-determine from type (default, tracked/walkers/flying not snipe-able), 0 = Not snipe-able, 1 = snipe-able.
DLLEXPORT void DLLAPI SetCanSnipe(Handle me, int CanSnipe = -1);


A version of Damage/DamageF that takes a handle for the causer. The current method, if something is killed by this in MP, it says killed by (AI Unit) in chat. Requesting a way to assign an owner to the damage the way SelfDamage does.

DLLEXPORT void Damage(Handle him, Handle me, long Amt);


Functions to Get/Set the spin rate of vehicles.

// Gets the omega rate of a vehicle/person.
DLLEXPORT vector DLLAPI GetOmega(Handle h);

// Sets the handle's omega rate to the specified vector.
DLLEXPORT void DLLAPI SetOmega(Handle h, Vector omega);


Also, some more functions that quarry basic types like IsPerson() might be more efficient then manually using GetObjClass and stricmp_s.

// Returns true if it's a CraftClass.
DLLEXPORT bool DLLAPI IsVehicle(Handle me);

// Returns true if it's a BuildingClass.
DLLEXPORT bool DLLAPI IsBuilding(Handle me);

// Returns true if it's a PowerupClass.
DLLEXPORT bool DLLAPI IsPowerup(Handle me);
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
Red Devil
Recycler
Posts: 4394
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains
Contact:

Re: New DLL callbacks - any requests?

Postby Red Devil » Mon Oct 17, 2016 2:32 am

DLLEXPORT bool DLLAPI IsTargeted(Handle me, Handle him);

DLLEXPORT bool DLLAPI IsTarget(Handle him);
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA

User avatar
GSH
Patch Creator
Posts: 2448
Joined: Fri Feb 18, 2011 4:55 pm
Location: USA
Contact:

Re: New DLL callbacks - any requests?

Postby GSH » Tue Oct 18, 2016 1:20 am

RD-
The first request seems like you could use this already-existing function:

Code: Select all

DLLEXPORT Handle DLLAPI GetTarget(Handle h);

bool IsTargeted(Handle me, Handle him)
{
return (me && him && (him == GetTarget(me));
}


Second is a lot more work. Each GameObject can have (at most) one target. To see if something is targeted by someone else, the code has to do an iterate over all GameObjects, and check its target. Probably not noticeable even if called 25 times per turn thanks to all the other optimizations I've put in, but still, not free.

-- GSH

User avatar
Red Devil
Recycler
Posts: 4394
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains
Contact:

Re: New DLL callbacks - any requests?

Postby Red Devil » Tue Oct 18, 2016 1:47 am

darn it, i looked for Target and it found nothing :-/
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Tue Oct 18, 2016 2:36 am

Q about the new handle list function:

Can it work similar to the GetAllSpawnpoints() where it fills in a struct with some of the useful info about a handle already filled out? Idk if it'd be easiest to just copy all the GameObject* vars into the struct, but I imagine filling out half of the useful ones wouldn't be too hard.

something like:

Code: Select all

// Structure for GetAllHandles()
struct HandleInfo
{
   Handle   m_Handle;
   Matrix   m_Position; // Matrix, so no need for separate Front. //GetFront()
   int      m_Team;
   int      m_PerceivedTeam;
   int      m_Group;
   int      m_Independence;
   int      m_Skill;
   long      m_CurrHealth;
   long      m_MaxHealth;
   long      m_CurrAmmo;
   long      m_MaxAmmo;
   long      m_WeaponMask;
   Vector   m_Velocity;
   Vector   m_Omega;
   char      m_Race;
   char*      m_Name; // Same as GetObjectiveName().
   char*      m_Label;
   char*      m_PilotClass;
   int      m_CategoryType;
   Handle   m_Owner;
   float      m_LifeSpan;
   float      m_RemainingLifeSpan;

   char*      m_Classlabel;
   char*      m_GOClass;

   int      m_CurrCommand;
   Handle   m_CurrWho;
   Vector   m_CurrWhere;

   Handle   m_CurrTarget; // Does this differ from CurrWho/GetCurrentWho?
   Handle   m_WhoShotMe;
   int      m_LastEnemyShot;
   int      m_LastFriendShot;

   int      m_TeamSlot;

// Things not currently retrievable, aside from direct ODF reading, that might be more efficient to retrieve here, and might be useful.
   float      m_EngageRange;
   float      m_CollisionRadius;
   int      m_ScrapCost;
   int      m_ScrapValue;
   int      m_PowerCost;
   char      m_ArmorClass;
   char      m_ShieldClass;
   int      m_ScanTeamLimit;
   bool      m_IsAssault;
   bool      m_CanCollide;
   bool      m_CanDetect;
   bool      m_CanInteract;
   bool      m_CanSnipe;
   bool      m_CanBeIdleVictum; // Useful for selecting targets for DLL driven attacks to omit this object.
   bool      m_DoIdleDispatch;
   bool      m_CanAIPForceIdle;
   bool      m_WingmanProcessAttackMines;
   bool      m_NonWingmanProcessAttackMines;
   bool      m_Bailout;
   bool      m_AIEject;

};
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Wed Oct 26, 2016 7:53 pm

Dunno why I didn't think of this earlier...

DLLEXPORT int DLLAPI GetCurrCommandPriority(Handle me);
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
GSH
Patch Creator
Posts: 2448
Joined: Fri Feb 18, 2011 4:55 pm
Location: USA
Contact:

Re: New DLL callbacks - any requests?

Postby GSH » Wed Oct 26, 2016 8:22 pm

// Structure for GetAllHandles()
struct HandleInfo
{
...


That type of interface is extremely fragile, and would basically prevent additions in the long term. If this thread is any indication, "moar info!" is the DLL author's motto. However preserving back-compat to existing DLLs would be extremely tricky to do while adding in more info in later versions. BZ2's simple C-like API is extensible; this is not.

-- GSH

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Wed Oct 26, 2016 9:50 pm

Ah, okay. I was just wondering. :)
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Thu Oct 27, 2016 2:51 pm

Something that would be useful, would be something similar to KillPilot, which simulates a snipe, but takes a handle or team to give credit to. ATM it just says killed by (null) in MP. (I use it to simulate sniping)

DLLEXPORT void DLLAPI SnipeObject(Handle me, Handle him); // (or instead of him, int SniperTeam) Kills the pilot, and reports the killer as the specified handle.
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Thu Oct 27, 2016 6:55 pm

Another small request:

Can "GetPilotClass()" return the cfg, not the odf? It's an odd asymmetry, SetPilotClass("blah") vs GetPilotClass() returning "blah.odf".


EDIT:

Can PreOrdnanceHit callback be made to also trigger when a terrain owning building is hit? Currently it doesn't.
Battlezone Classic Public Forums
*****General BlackDragon*****

User avatar
General BlackDragon
Flying Mauler
Posts: 2401
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: New DLL callbacks - any requests?

Postby General BlackDragon » Thu Nov 03, 2016 3:56 pm

DLLEXPORT long DLLAPI GetSwitchMask(Handle h); // Like GetWeaponMask, but returns the object's switchMask (used by pilots and morphtanks).
Battlezone Classic Public Forums
*****General BlackDragon*****


Return to “Battlezone 2 Mod Making”

Who is online

Users browsing this forum: No registered users and 2 guests