Page 2 of 8

Re: New DLL callbacks - any requests?

Posted: Wed Jun 26, 2013 3:09 am
by General BlackDragon
Yes. But with multiple hardpoints of same type, it fills from top down. Would be useful to be able to designate which slot to try to put the weapon in.

Re: New DLL callbacks - any requests?

Posted: Wed Jun 26, 2013 5:17 am
by Nielk1
General BlackDragon wrote:Yes. But with multiple hardpoints of same type, it fills from top down. Would be useful to be able to designate which slot to try to put the weapon in.
I can see the use of setting the index direct, allowing for more complex weapon modification and distribution. I take it this would require making a new overload for that stock function in engine though rather than just binding up some existing functions to the DLL.

Re: New DLL callbacks - any requests?

Posted: Wed Jun 26, 2013 3:23 pm
by Commando
Can't this behavior already be worked around. For example if you want to give a heavy sabre an at stabber and a sp stabber.

Just give the unit two sp stabbers so both top and bottom slots are filled with sp. Then give an at stabber to fill the top. You did say it fills from top to bottom.

Re: New DLL callbacks - any requests?

Posted: Wed Jun 26, 2013 4:13 pm
by Red Spot

Code: Select all

weaponHard1 = "HP_CANNON_1"
weaponName1 = " "
weaponAssault1 = 0

weaponHard2 = "HP_CANNON_2"
weaponName2 = " "
weaponAssault2 = 0

Code: Select all

weaponHard2 = "HP_CANNON_2"
weaponName2 = " "
weaponAssault2 = 0

weaponHard1 = "HP_CANNON_1"
weaponName1 = " "
weaponAssault1 = 0
Both sets work the same, it works based on weaponnumber, from low to high.
Just to prevent any confusion.

Re: New DLL callbacks - any requests?

Posted: Thu Jun 27, 2013 4:22 am
by Nielk1
Commando wrote:Can't this behavior already be worked around. For example if you want to give a heavy sabre an at stabber and a sp stabber.

Just give the unit two sp stabbers so both top and bottom slots are filled with sp. Then give an at stabber to fill the top. You did say it fills from top to bottom.
Lets say your 2nd gun is one you have to change into a different one the longer it is being fired (like an accelerating mini-gun). If you can't specify index, it can go quite off the rails. That is something I want to do, but I don't want to lock it to only a specific craft.

Re: New DLL callbacks - any requests?

Posted: Fri Jul 05, 2013 5:04 am
by Nielk1
GBD says the DLL can't order a factory (or recycler) to build something, only the constructor. That's gotta get fixed else we are forever tied to purely AIPs for building orders.

Re: New DLL callbacks - any requests?

Posted: Fri Jul 05, 2013 2:47 pm
by Red Spot
Not sure what the issue there is, as it is you can easilly get the recy and fact to produce whatever you want, even if its scouts from a fact and Atanks from a recy.

Re: New DLL callbacks - any requests?

Posted: Fri Jul 05, 2013 4:17 pm
by mase
It would be great if one could track all ordnance with handles and who they belong to.

// Return the current controls for the vehicle including human players
VehicleControls GetControls(Player h)

// This does not always work. First of all a weapon mask is only accepted for some AI Processes and even if then
for example activating a special like phantom vir only works when the underling AI Process would do so too.
SetControls()

However even better would be an AI Process that does nothing but accepts a complete VehicleControls Object
including a complete weapon mask. Needed for DLL controled ships.

// Might be useful, especially with the above
SetAIProcess(Handle h)

// Return true if the ship has a special like phantom vir activated. The DLL cannot know that as it is now.
HasSpecialActivated(Handle h)

// Returns the charge level of a charge gun weapon. The DLL cannot know that as it is now.
int IsChargingWeapon(Handle h)

// I think it is not possible to know what map one is on in IA
GetMap()

// Might be useful to dynamically generate paths
CreatePath()

// Since 1.3 odf inheritance is supported, whoever all of the getter function do not track back
// the inheritance tree to find a value
GetODFFloat(), etc

// Get a height map. Useful for manual navigation
GetTerrain()

// It does not seem possible to reliably test if an odf is of a certain type (see next suggestion too)
char * isClassLabel(char * odf);

// check if an odf has a section (possibly empty)
HasODFSection(char * sectionname) returns true if the odf has this section

// Return true if the user is targeted and by whom
Handle IsTargeted(Handle h);

Re: New DLL callbacks - any requests?

Posted: Fri Jul 05, 2013 4:41 pm
by GSH
// I think it is not possible to know what map one is on in IA
GetMap()
Already exists, use this. Just replace ".trn" with ".bzn", as there's a 1:1 relationship between .bzn and .trn files
// Gets the currently loaded map's .trn filename.
DLLEXPORT const char* DLLAPI GetMapTRNFilename(void);
// Since 1.3 odf inheritance is supported, whoever all of the getter function do not track back
// the inheritance tree to find a value
GetODFFloat(), etc
Tracking up the inheritance tree is *expensive*. Saved for map loading only.
// Return true if the user is targeted and by whom
Handle IsTargeted(Handle h);
Also expensive. Items know who they target. But, many items may target an object, so it has to search all items and test them individually to see if they are targeting the specified handle. Also, passing lists back and forth from exe to DLL is rarely done, and when done, only in a C-style array. This is because C++ structures (std::vector, etc) allocated from the exe cannot reliably be freed by the DLL, and vice versa. The exe uses dlmalloc for allocations, while the DLL can use Visual Studio 6, Visual Studio 2002, 2003, 2005, 2008, 2010, or 2012 libraries for allocations.

-- GSH

Re: New DLL callbacks - any requests?

Posted: Fri Jul 05, 2013 5:30 pm
by mase
Speaking if cleaning up, is there a way for the DLL to now if the user manually aborted the session?

Re: New DLL callbacks - any requests?

Posted: Fri Jul 05, 2013 7:53 pm
by Nielk1
Red Spot wrote:Not sure what the issue there is, as it is you can easilly get the recy and fact to produce whatever you want, even if its scouts from a fact and Atanks from a recy.
With what, the AIP? Making dummy AIPs just to make a factory or recycler make something is pretty nonsense.

Re: New DLL callbacks - any requests?

Posted: Wed Jul 10, 2013 12:54 am
by General BlackDragon
Thought of a neat one:

SetTeamName(int Team, name Name);

Set the name for a specific team. I know it uses Team1/2 in team play, and anything > team 10 is either a fallback or "unknown team". This would allow custom DLLs to assign the team's name.

Re: New DLL callbacks - any requests?

Posted: Wed Jul 10, 2013 12:58 am
by Nielk1
General BlackDragon wrote:Thought of a neat one:

SetTeamName(int Team, name Name);

Set the name for a specific team. I know it uses Team1/2 in team play, and anything > team 10 is either a fallback or "unknown team". This would allow custom DLLs to assign the team's name.
Isn't this already done? I've played games with custom team names...

Re: New DLL callbacks - any requests?

Posted: Wed Jul 10, 2013 2:08 am
by General BlackDragon
There's Team 1 and 2 in shell, (Team 1-5, 6-10) and then there's an svar11 for a fallback team name instead of "unknown team"

Code: Select all

11: Team name for a craft on team "group" 3 (teams
11..15). Teams must be on for this to take effect. This is not an
officially supported team group, but support was added for named items
on it. If this svar is empty, the default "Unknown Team" string is
used instead.
But, there's no way to specify a specific name for team 11, 12, 13, 14, and 15.

Re: New DLL callbacks - any requests?

Posted: Wed Jul 10, 2013 6:21 am
by mase
Would it be possible to "up" the simulation speed? Such that bots could fight each other in faster than realtime.
This would be for machine learning purposes.