Author Topic: Gettotalplayerstrength  (Read 1944 times)

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Gettotalplayerstrength
« on: April 09, 2009, 09:35:20 AM »
I've been experimenting with GetTotalPlayerStrength.  It seems to return the number of combat vehicles a player has.  Note that it DOES NOT count Guard Posts.

I guess you could use this to tell your AI to prey on a significantly weaker player, or to strengthen its defenses if it's outgunned by another player.  There are a few problems though, because there's no way to tell what kind of combat vehicles or weapons another player has (as far as I could tell anyways).  So it could mislead your AI into spamming Laser Lynx and sending them all on a suicide mission against a bunch of ESG Tigers...

I assume GetPlayerStrength does the same thing but at a specified location.

A test DLL is attached.  It will output a file (GTPS Test Results.txt) which will tell you your initial strength level (zero) and notify you of any changes (and at what mark those changes occured).  I'll also upload the source to the SVN, for whatever reason.  It runs in normal OP2, even though I put it in MT2\Colony Games.
« Last Edit: April 09, 2009, 09:37:24 AM by Sirbomber »
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Gettotalplayerstrength
« Reply #1 on: April 10, 2009, 02:16:15 AM »
Hmm, I checked into this a little while back, and wrote some notes into the SDK in the SVN. It's not simply a count of the units. Although, they did choose some fairly arbitrary weightings that you might not agree with.


Code: [Select]
	// [Get] Player Strength  [Calculational]
// Note: Unit Strengths are as follows:
// Spider/Scorpion : 4
// Lynx   : Laser/Microwave: 5 Other: 6 ThorsHammer: 7
// Panther   : Laser/Microwave: 7 Other: 8 ThorsHammer: 9
// Tiger   : Laser/Microwave: 8 Other: 9 ThorsHammer: 10
// Guard Post  : Laser/Microwave: 4 Other: 5 ThorsHammer: 7
// Other   : 0  [Including Units in a Garage]
int GetPlayerStrength(MAP_RECT& mapRect);      // Returns (strength / 8), where strength is the sum of all units owned by the player in the given map rectangle
int GetTotalPlayerStrength();         // Returns (strength / 8), where strength is the sum of all units owned by the player


I noticed the code seems to check the contents of garages, but then I think it throws away the results. It was kind of odd.

 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Gettotalplayerstrength
« Reply #2 on: April 10, 2009, 06:15:44 AM »
Quote
int GetTotalPlayerStrength();           // Returns (strength / 8), where strength is the sum of all units owned by the player[/CODE]
Ah, that would be why I thought it was simply a count (I tested with MT2, meaning I built a bunch of Rail Gun Panthers, which had a value of 8).  Regardless, a simple count of all combat units would probably be more useful anyways.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials