MH: Monsters should not move before map starts

Discussions about Coding and Scripting
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

In Gold they don't ignore players - are just blind, by using more stuff there, monsters have a default slow reaction until you are firing first - me, one, I wrote my controller because I never loved to see monsters doing nothing right in game, I was almost to put my finger in their ass and they did not even moved. Such things I saw even at super duper tweaked DU server, a Skaarj ignored me until I fired weapon. So to speak I'm not gonna play like that, I was writing another A.I. Karmic SeePlayer type taking in account every Life-Form in range. More servers are like that, so I'm not interested about them, I'm tired of these dumb things running for years because its really frustrating - if monster is a bit masked/hidden you really might fail seeing it. If SeePlayer is not called properly at monster, for sure there is a problem.

Health 0 for player until game is being started has a deal in Higor's repository at GitHub mentioned in Splitting MH packages thread - do check functions there.
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: MH: Monsters should not move before map starts

Post by Aldebaran »

Barbie wrote:This is because the Kralls are spawned by CreatureFactory after you have applied the changes to AttitudeToPlayer of existing ScriptedPawns.
Can I put some code into the Monsterhunt.Timer function to solve this with my method? When and how often is this timer function called (I don't find info in the Web).
Barbie wrote:TPawnAttitudeToPlayer is a child of a custom double linked list.
I will try your version if mine will not work with CreatureFactorys but I don't know how to set up this variable type.
Sektor2111 wrote:Health 0 for player until game is being started has a deal in Higor's repository at GitHub
Thanx!!
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

Timer has 1 second (in theory)...
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MH: Monsters should not move before map starts

Post by Barbie »

Aldebaran wrote:Can I put some code into the Monsterhunt.Timer function to solve this with my method? When and how often is this timer function called (I don't find info in the Web).
You'll find the info in existing UC classes. Remember that the hierarchy is:
Object>Actor>Info>GameInfo>TournamentGameInfo>DeathMatchPlus>TeamGamePlus>MonsterHunt
Search backwards all parent classes for a call of "SetTimer()", and you'll find it in DeathMatchPlus: "SetTimer(Level.TimeDilation, true)" (line 144). So you don't need to set the timer in your MonsterHunt class.
Remember also if you implement MonsterHunt.Timer() to call the Timer function of parent class ("Super.Timer()").
Aldebaran wrote:I will try your version if mine will not work with CreatureFactorys but I don't know how to set up this variable type.
Just a double linked list, like in Turbo Pascal in good old DOS times :lol: If anyone is interested, I can publish it of course.

Also the idea of extracting that Dear-Monsters-please-keep-feet-still-until-gamestart into a separate Mutator has come into my mind.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

Barbie wrote:DeathMatchPlus: "SetTimer(Level.TimeDilation, true)" (line 144)
And not only there... Botpack fires GameSpeed multiple times... by calling parent super classes (Initgame) which uses to restart GameSpeed/Timer again + PreBeginPlay (which is pretty much useless). Rewrite game using only PreBeginPlay and you are in for some surprise - actually I really think that PreBeginPlay > SetGameSpeed is useless - without that, Skaarj have another operational features way improved - concluded by me in 2014 after some tests...
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: MH: Monsters should not move before map starts

Post by Aldebaran »

Barbie wrote:Also the idea of extracting that Dear-Monsters-please-keep-feet-still-until-gamestart into a separate Mutator has come into my mind.
I noticed that the MonsterSkill is not adapted to monsters if creaturefactories are used - otherwise it works fine. This Monsterskill - value read from ini file - is set in the same section (AttitudeToPlayer=ATTITUDE_Ignore) in the function PostBeginPlay(). Perhaps this can be fixed too then?
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MH: Monsters should not move before map starts

Post by Barbie »

Aldebaran wrote:This Monsterskill - value read from ini file - is set in the same section (AttitudeToPlayer=ATTITUDE_Ignore) in the function PostBeginPlay().
That should better be done either at the end of function MonsterHunt.IsRelevant() or in a Mutator's IsRelevant() or Mutator's CheckReplacement(), because this will treat later spawned Pawns, too.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

Compare original MH with MH2 types and tell me what "improvements" were added at this point. See string SetPawnDifficulty in MnsterHunt.uc class and BaseMutator. See what original MH does, for sure that's not a response (AlwaysKeep). I was one of those quitting using new MH2 types because was goofing with MonsterSkill - as making monster stronger, aka SetPawnDifficulty. For monsters entered in game later it worked only by killing a creature - ScoreKill doing the skill. Sample: A group of flies having 30 HP, once killed a fly, the rest went with 45 hp - perhaps that's why some admins configured MonsterSkill 2 (no changes) and others want MonsterHealth display from HUD removed because it's just a messed up thing. That AlwaysKeep in original uses "MonsterHunt(Level.Game)" call - see MonsterEnd problem.
This address MonsterHunt(Level.Game) will not work well outside of original MonsterHunt, it does errors and it was REMOVED in MH2 types from BaseMutator whatever, and it should be different addressed rather than removed.
Some of my contacts from Skype 3-4 years ago went mad related to this problem as well - I'm not gonna speak chat detail - is not nice. You can do a check MH/MH2 and compare Improvements/bugs because MH2 in first stage ( some chico server in that time ) has come with a few good things and other new BAD things and codes were used later with no changes. Yeah, I dared to change codes in 2013 with no fear about a game broken because nothing went broken nowhere, mainly replacements were on work for some months due to mapping style.

Edit: As a hint for other MH types used for MH maps running. It is very possible to use a child game of MonsterHunt and not a TeamGamePlus as a primary fixation, this one for sure will never need attaching new MonsteEnd types - but won't be possible fixing multiple game ends. The rest of things can be rewritten here and a lot of bugs can be vaporized this way as well. Exist such an evidence if this do works or not ? Yeah, I have a primary type of an "XC_MonsterHunt" - more fixes are coming here by using XCGE. This MH game type doesn't need spawning new Ends and tweaks and above function call MonsterHunt(Level.Game) has no flaws, this work was keeping me busy last time...
Last edited by sektor2111 on Thu Mar 23, 2017 6:13 am, edited 2 times in total.
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: MH: Monsters should not move before map starts

Post by Aldebaran »

I want to use a "for (P=Level.PawnList; P!=None; P=P.NextPawn)" loop but have to know the count of ScriptedPawns in the PawnList before. Exist a variable or command for that or should I calculate it by myself?
Sektor2111 wrote:A group of flies having 30 HP, once killed a fly, the rest went with 45 hp
Oh thank you for this info, it's important to know for me.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

Code: Select all

function Whatever()
{
	local Pawn P;
	local ScriptedPawn S;
	local int MonstersTotal;

	MonstersTotal = 0;
	for (P=Level.PawnList; P!=None; P=P.NextPawn)
	{
		if ( ScriptedPawn(P) != None )
			S = ScriptedPawn(P);
		if ( S != None )
		{
			S.... // something
			S.... // other thing
			MonstersTotal++;
		}
	}
}
Yes, ScoreKill suddenly remembered to put "difficulty" at the rest of creatures post killed.

Hint: If map has load with 1300+ creatures, PawnList is Not Faster than a "Foreach AllActors". Linked lists are working fine in a decent load.
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: MH: Monsters should not move before map starts

Post by Aldebaran »

I have implemented such a function in Monsterhunt.Timer() now. It's really not a good solution but it seems to work for me. Before gamestart monsters are ignoring players and the monsterskill factor is applied. Even on creaturefactory monsters but in some situations monsters are spawning very late and they were not included although they should be. I saw this on MH-Face where some mercs (sometimes) are spawning before gamestart but not at the same time as the other monsters.
My cpu load isn't really higher with this function as without it so I wondered if it really is called every second?
However I found a bad solution that is better than none haha...
Thank you for your help.
Sektor2111 wrote:If map has load with 1300+ creatures, PawnList is Not Faster than a "Foreach AllActors". Linked lists are working fine in a decent load.
Ok. I read here in forum that a PawnList should be better as "ForEach AllActors" relating to cpu load. And maps with 1300+ creatures are perhaps an exception. But if I get some performance issues with the PawnList I will remember the Linked lists.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

Is not a big deal if you are using timer to control things, however, if more server-tools are added using the same things, probably will affect a bit the performance - in time you'll figure better solutions, no problem.
Just note that a Linked list is like a Pawnlist - both of them are chained lists. Iterator is written in C++ not UScript - C++ is faster (considering my advantage of not having decals loaded in server). I don't know who was writing what, but I did tests using clocking system from XCGE, and at high loaded maps foreach is faster, regarding to myths spread. I'm using in 2 actors a sort of PawnList (like SkaarjBerserker) but it is spread into a state code with meaning to work as a background testing 32 Pawns / 50 ms - considering deviations, I can get an average of 600 Pawns/Second - so job is executed in time and with less Engine load. Little timings less synced are not a big deal - I mean teaming them - Actually I don't have any tick code checking their self - fight.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: MH: Monsters should not move before map starts

Post by Barbie »

Aldebaran wrote:My cpu load isn't really higher with this function as without it so I wondered if it really is called every second?
CPUs are fast... ;o)
I can only guess here, but let's say that one line in UC script results in 10,000 CPU instructions (OPs). If CPU is running at 2 GHz and its CPI (cycles per instruction) is 4, it can process 2,000,000,000,000 /4 = 500,000,000 OPs per second or 500,000,000 / 10,000 = 50,000 UC lines per second (all bases for calculations here are estimated and can vary extremely...) So if your Timer() function has 100 lines, its execution time will be around 100 / 50,000 = 0.002 seconds.
Who wants to do some measuring? :D
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: MH: Monsters should not move before map starts

Post by sektor2111 »

Me, I want to measure the number of iterations CYCLES from a default game-start. You can drop in toilette a Gorgeosus CPUsus if number of iterations are reaching at Limit - and in fast machines this is faster as well. I'm speaking about Engine Load Not CPU load. Machines from now days are more powerful than this old engine anyway, optimization of actors is the key.

Sample which came in my mind.
Why should I call CountHunters CountMonsters if nobody is in game. Let's say that humans went to sleep leaving, I should stop running things useless - just two cents...
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: MH: Monsters should not move before map starts

Post by Aldebaran »

Barbie wrote:CPUs are fast
Yes, it is still impressive for me to see that checking attributes of perhaps 1000 pawns or more actors under one second works and the cpu load isn't much higher.
Post Reply