PDA

View Full Version : Scoring in SP Campaigns



bolox
Sep-16-2013, 07:25
I'm currently testing anothe campaign, and am looking at improving on the scoring system used in the REDUX campaigns.

One of the main problems with SP missions is planes are destroyed shortly after landing which leads to gross errors when trying to track results. ATM I'm counting own Squadron losses and totalling them into the campaign score- this works fine as long as the player hares back to base and lands before the rest of the Squadron, but if lands last- eg after chasing planes back over the channel the score says all Sqn destroyed,
Any ideas on how to count this more accurately (or even better stop landed planes being destroyed- this would be really useful)?

Another thing I would like to do is to track kills in a slightly more historic fashion- ie Confirmed, probable, damaged.
For reference I'm using something like this

public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> initiatorList)
{

if (actor is AiAircraft)
{
if (shortName.IndexOf("501", 0) > 0)
{
//if (flagCompletedAnnounced = false)
mydead++;// indicate playerSqn loss
}

if (actor.Army() == 2)
{
cEnemy++;

}

if (actor.Army() == 1)
{
cFriendly++;

}

if (actor.Army() == 2)
{
if (GamePlay.gpPlayer().Place() != null)
{
bool playerWin = false;
foreach (DamagerScore i in initiatorList)
{
if (i.initiator != null && i.initiator.Actor == GamePlay.gpPlayer().Place())
{
playerWin = true;
//GamePlay.gpHUDLogCenter("1");
}

if (shortName.IndexOf("KG3", 0) > 0) cPlayerBomberKills++;// increments when players kills member of a specific unit eg bombers
}
if (playerWin) cPlayer++;

}
}
}

}

to record kills.

For confirmed kills would it be possible to only count those enemy that crashed on British soil or were within say 10km of a friendly unit, anything else being a probable? or is that too ambitious?
Perhaps easier would be to query damage caused by player so if 100% is a kill, less is a shared kill maybe.

Any ideas/suggestions?

ATAG_Bliss
Sep-17-2013, 11:24
I don't know much about SP missions, but even without a despawn script I thought planes would take around 10 minutes to despawn after landing?

Would adding a despawn script and increasing the despawn time help? Is the fact that planes despawn the main problem with the scoring?

bolox
Sep-17-2013, 14:13
Planes take a couple of minutes to 'despawn' after they stop moving after landing. On doing so they give a message in the 'server messages' info window that they have been destroyed. They are thus counted as having been destroyed in any scoring system using 'on actor destroyed'- the games inbuilt mission stats also records this as a plane destroyed.
It would appear to be a penalty of the MP and SP elements basically being the same (I can understand why it is desired in MP)

For SP though it is a problem- a Squadron takes ~10+ minutes to land with the current AI routine, so often half the squadron is recorded as destroyed by the time the player lands. Also the parking spaces are empty- no sign of your Squadron when you taxi in- sort of immersion destroying. It's even worse if using multiple squadrons.

I have did try setting a flag using 'on aircraft landed'- if 9shortname)= player squad and stopping the player squad losses count if flag was active- seemed to always give zero- might have been my bad coding:banghead:

Another ramifaication of this is if enemy AC which have been damaged by player land, they will be destroyed and player will be credited with it- I now tend to not land enemy AC in fmb, but leave them circling at edge of map somewhere.

Last resort is to count player squad that land and deduct this from player squad destroyed- there's a good chance of it getting out of sync if player lands in the time between plane landing and being despawned, Redux system seems good enough for most players , I'm just looking to see if I can improve on it.

Not sure if a despawn script will overide the the inbuilt despawn?? ideally I would be extending it not shortening it.

ATAG_Colander
Sep-17-2013, 14:22
FYI, Is in TF "to do" list to add a "despawn without destroy" option.

bolox
Sep-17-2013, 15:37
FYI, Is in TF "to do" list to add a "despawn without destroy" option.

:thumbsup::thumbsup::thumbsup:

reckon I'll go with my plan B on the player squad destroyed scoring then.

Anyone got any ideas on confirmed/probable/shared kills? Salmo?

Nephilim
Sep-24-2013, 07:16
There is method that allow You to mirror kills straight from IPlayer:



private string GetDictionary<T>(Dictionary<string, T> ds)
{
StringBuilder sb = new StringBuilder();
foreach (string key in ds.Keys)
{
T d = ds[key];
if (sb.Length != 0)
{
sb.Append(", ");
}
//sb.AppnedFormat("[{0}]={1}", key, d);
sb.AppendFormat("[{0}]={1}", key, d);
}
return sb.ToString();
}

public string WritePlayerStat(Player player)
{
if (player is IPlayer)
{
IPlayerStat st = (player as IPlayer).GetBattleStat();
string stats = (String.Format("PlayerStat[{0}] bulletsFire={1}, landings={2}, kills={3}, fkills={4}, deaths={5}, bails={6}, ditches={7}, planeChanges={8}, planesWrittenOff={9}, netBattles={10}, singleBattles={11}, tccountry={12}, killsTypes=\"{13}\", tTotalTypes=\"{14}\"",
player.Name(), st.bulletsFire, st.landings, st.kills, st.fkills, st.deaths, st.bails, st.ditches, st.planeChanges, st.planesWrittenOff, st.netBattles, st.singleBattles, st.tccountry, GetDictionary(st.killsTypes), GetDictionary(st.tTotalTypes)));

return stats;
}
else
{
return string.Empty;
}
}

public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);

AiAircraft aircraft = actor as AiAircraft;

Console.WriteLine(WritePlayerStat(player));

}

bolox
Sep-24-2013, 09:22
looks interesting:thumbsup:- perfect timing as I'm away for ~week:grrr:
'st.killsTypes'- what is this??