No telefrag at start - update to V3

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

No telefrag at start - update to V3

Post by sektor2111 »

Addressing custom game-types using Maps with very few PlayerStarts and if telefrag-kill looks annoying to you. Sequence from my MH2 - March 06 2016 - they day of reducing spawn-while-dying stupidity.
Spoiler

Code: Select all

function bool RestartPlayer( pawn aPlayer )
{
	local NavigationPoint startSpot, NewSpot;
	local bool foundStart, bCollisionWarning, bNewSpotBusy;
	local Pawn P, Ps, Mp;

	if ( MonsterReplicationInfo2(GameReplicationInfo).bUseLive )
	{
		if( bRestartLevel && Level.NetMode!=NM_DedicatedServer && Level.NetMode!=NM_ListenServer )
			return true;

		if ( aPlayer.PlayerReplicationInfo.Deaths < 1 )
		{
			BroadcastMessage(aPlayer.PlayerReplicationInfo.PlayerName$" has been lost!", true, 'MonsterCriticalEvent');
			For ( P=Level.PawnList; P!=None; P=P.NextPawn )
			{
				if ( P != None && P.PlayerReplicationInfo != None && (P.PlayerReplicationInfo.Deaths >= 1) )
					P.PlayerReplicationInfo.Deaths += 0.00001;
			}
			if ( aPlayer.IsA('Bot') )
			{
				aPlayer.PlayerReplicationInfo.bIsSpectator = true;
				aPlayer.PlayerReplicationInfo.bWaitingPlayer = true;
				aPlayer.GotoState('GameEnded');
				return false;
			}
		}
		startSpot = FindPlayerStart(None, 255);
		if( startSpot == None )
			return false;
//------- Screwing a bit because looks stupid - AddOn March 05-06 2016
		if (bStartMatch)
			log (aPlayer.GetHumanName()@is seeking a startSpot.);
		foreach startSpot.RadiusActors(class'Pawn',Ps,22)
		{
			if ( Ps != aPlayer )
			{
				if (bStartMatch)
					log (startSpot.Name@has a nearby Pawn > @Ps.GetHumanName());
				startSpot.taken = True;
				bCollisionWarning = True;
			}
			if ( bCollisionWarning )
			{
				if (bStartMatch)
					log( "Telefrag danger at "$startSpot.Name$" as long as "$aPlayer.GetHumanName()$" attempts using that spot too." );
				break;
			}
		}
		if (!bCollisionWarning)
		{
			if (bStartMatch)
				log (aPlayer.GetHumanName()@attempts spawning at@startSpot.Name);
			startSpot.taken = True;
		}
		if ( bCollisionWarning )
		{
			foreach startSpot.RadiusActors(class'NavigationPoint',NewSpot,500)
			{
				if (bStartMatch)
					log ("Testing a New spot"@NewSpot.Name);
				bNewSpotBusy = False;
				foreach NewSpot.RadiusActors(class'Pawn',Mp,22)
				{
					if ( Mp != aPlayer )
					{
						if (bStartMatch)
							log ( NewSpot.Name@has in range@Mp.GetHumanName());
						bNewSpotBusy = True;
						break;
					}
				}
				if (!bNewSpotBusy)
				{
					startSpot = NewSpot;
					startSpot.Taken = True;
					if (bStartMatch)
						log (aPlayer.GetHumanName()@will be moved at@NewSpot.Name);
					break;
				}
			}
		}
//----------- End of AddOn March 05-06 2016
		foundStart = aPlayer.SetLocation(startSpot.Location);
		if( foundStart )
		{
			startSpot.PlayTeleportEffect(aPlayer, true);
			aPlayer.SetRotation(startSpot.Rotation);
			aPlayer.ViewRotation = aPlayer.Rotation;
			aPlayer.Acceleration = vect(0,0,0);
			aPlayer.Velocity = vect(0,0,0);
			aPlayer.Health = aPlayer.Default.Health;
			aPlayer.ClientSetRotation( startSpot.Rotation );
			aPlayer.bHidden = false;
			aPlayer.DamageScaling = aPlayer.Default.DamageScaling;
			aPlayer.SoundDampening = aPlayer.Default.SoundDampening;
			if ( aPlayer.PlayerReplicationInfo.Deaths < 1 )
			{
				aPlayer.bHidden = true;
				aPlayer.PlayerRestartState = 'PlayerSpectating';
			} 
			else
			{
				aPlayer.SetCollision( True, False, False );
				AddDefaultInventory(aPlayer);
			}
		}
		return foundStart;
	}
	else 
		return Super.RestartPlayer(aPlayer);
}
And... me, looking what's logged while nobody has died at start...
Spoiler
ScriptLog: MH-AbsoluteZero_R16.MonsterHunt0 > reports GameSpeed value = 1.000000
ScriptLog: ME is seeking a startSpot.
ScriptLog: ME attempts spawning at PlayerStart4
ScriptLog: Sarena is seeking a startSpot.
ScriptLog: PlayerStart2 has a nearby Pawn > Visse
ScriptLog: Telefrag danger at PlayerStart2 as long as Sarena attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart2
ScriptLog: PlayerStart2 has in range Visse
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode0
ScriptLog: Sarena will be moved at A_PathNode0
ScriptLog: Archon is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Archon attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart3
ScriptLog: PlayerStart3 has in range Raynor
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode1
ScriptLog: Archon will be moved at A_PathNode1
ScriptLog: Liche is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Liche attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart3
ScriptLog: PlayerStart3 has in range Raynor
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode1
ScriptLog: A_PathNode1 has in range Archon
ScriptLog: Testing a New spot InventorySpot2
ScriptLog: Liche will be moved at InventorySpot2
ScriptLog: Necroth is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Necroth attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: Necroth will be moved at PlayerStart1
ScriptLog: Arachne is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Arachne attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart3
ScriptLog: PlayerStart3 has in range Raynor
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode1
ScriptLog: A_PathNode1 has in range Archon
ScriptLog: Testing a New spot InventorySpot2
ScriptLog: InventorySpot2 has in range Liche
ScriptLog: Testing a New spot InventorySpot3
ScriptLog: Arachne will be moved at InventorySpot3
ScriptLog: Visse is seeking a startSpot.
ScriptLog: Visse attempts spawning at PlayerStart2
ScriptLog: Raynor is seeking a startSpot.
ScriptLog: Raynor attempts spawning at PlayerStart3
ScriptLog: MH_A_V1.MonsterHunt game-mod has been initialized and started
ScriptLog: Detected TickRate at 30
ScriptLog: Tick interval is around 33 ms.
Yay, we are all alive!

Edit: No worries for Maps with 1 Playerstart and Nothing else around, enjoy your death in retarded empty cubes if pathing is not your way. I'm no longer using any trash with 0 options. So to speak everything must be good if exist PathNodes, Weapons Ammo, around PlayerStarts.
Potential Bugs: See teleporters around and avoid them - it's your turn.

Edit2:
Not a super duper update but V2 can spawn some additional starting option (at least 5 Starts in Levels with 1 start). It's a nonsense to put such a map for 1 player in servers addressing 6+ players. However we might have teams took in account and depending on locations new spots are available. Adding spots should stop if number of locations are already 16 (they can be more - depending on Level...)
[attachment=0]LessTele2.zip[/attachment]
Source-Code included so you don't have to make any effort for asking it from me. Improve/Change it as you like.
EDIT: V3 can be downloaded from this page... viewtopic.php?f=15&t=11350&start=15#p98642
Attachments
LessTele2.zip
Adding some PlayerStart types, might have teams in account.
(205.14 KiB) Downloaded 113 times
Last edited by sektor2111 on Tue Jul 18, 2017 4:20 pm, edited 2 times in total.
User avatar
UnrealGGecko
Godlike
Posts: 2900
Joined: Wed Feb 01, 2012 11:26 am
Personal rank: GEx the Gecko
Location: Kaunas, Lithuania
Contact:

Re: No telefrag at start

Post by UnrealGGecko »

Interesting, looking forward to this one, would be cool to not get so many suicides on smaller DM maps etc.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: No telefrag at start

Post by Barbie »

If I understand the code right, your idea to spawn players is, to use not only PlayerStarts but any NavigationPoint nearby PlayerStarts?
(I still have a similar task on my to-do-list: Before game starts, the number of PlayerStarts is checked, and if its below a constant (or dynamic) threshold, iterate through all existing active PlayerStart and spawn new Playerstarts around (like crystal grow)).
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
OjitroC
Godlike
Posts: 3605
Joined: Sat Sep 12, 2015 8:46 pm

Re: No telefrag at start

Post by OjitroC »

Yes, this would be very useful for smaller DM maps - can the code be made into a mutator?
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: No telefrag at start

Post by sektor2111 »

You can do tracing around (or Not - using a giant actor) for testing if place allow adding PlayerStarts. If you have linked (NavigationPoint list), they are major candidates and then if these are "busy" move the rest of pawns at your custom Starts (any type - even decorations rotating or whatever). I'm not 100% sure if a mutator can fail at fixing this chapter but for sure a new game controller won't fail. ModifyPlayer get's called in that time if I'm not mistaking.
OjitroC wrote:Yes, this would be very useful for smaller DM maps - can the code be made into a mutator?
I might try something via mutator. Or a new DM - perhaps I have to finish and post some final version of NsDM whatever with code implemented. There are multiple tweaks:
- Fixing dumb Inventories (bStatic unreplaceable);
- Allowing old weaponry Internal or external with XC_Engine support;
- ScriptedPawn support - MonsterShadow decal included;
- Linear game-speed Client-Server + the same NetSpeed for all players;
- Moving items nearby their InventorySpot (recover some Bot blabbering);
- Allow Bot translocation at several spots where usually won't go + combat a bit tuned;
- Log-File fixing when Monsters Get weapons;
- Spree took in account even for killing monsters > Rampage, Dominating, etc;
- Hunter Killer feature - finding opponent using Bot Pathing;
- Others of Bot problems belong to pawn's internal code (gotta update new MBot link for March 2016);

The rest of Telefrag problems occurs at Teleporters. In my MH2 Bot/MBot somehow respect pawn walking around teleporters but... we have random problems which I start to hate them too. If Attraction is false for reasons, Telefrag will occur. If a pawn A is at exit side and the other B goes in there = Pawn B kills A.
For me the way in solving problem is not what teleporterfix (any) does (ruin paths through them and bugging them). I'm thinking for an alternate option in solving default crashes (for Non XC users) and telefrag problem.
Technically I wanna spawn some keypoints controllers. They grows a bit bigger than Teleporter (probably 20 units or more). Mainly they can be touched. Then shortly disabling Teleporter. At other side, Destination will inform Source about Pawn new comer. As long as destination is busy, source will be disabled (I'll test which ways are suitable). When Pawn is far from Destination (Untouch perhaps) the source will be enabled. In order to not mess with Teleporter code I'll switch method of disabling. Also these won't be added at Teleporters directly visible (those cute things used in Navigation ) or they might not have problems if are part of prevention. Gotta do some study first, I cannot promise anything yet.
User avatar
papercoffee
Godlike
Posts: 10443
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: No telefrag at start

Post by papercoffee »

This sounds great and promising!
User avatar
FXANBSS
Skilled
Posts: 231
Joined: Thu Dec 26, 2013 7:03 pm

Re: No telefrag at start

Post by FXANBSS »

It works in maps without player starts?

EDIT: To fix the telefrag problem, type "set bot bblockplayers false", they still telefrag me somehow, what a dumb fix.
User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA
Contact:

Re: No telefrag at start

Post by Chamberly »

Interesting. If you have a mutator made for this, it'll be popular. Meanwhile in Siege, the code would probably be added. :loool:
Image
Image
Image Edit: Why does my sig not work anymore?
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: No telefrag at start

Post by sektor2111 »

FXANBSS wrote:It works in maps without player starts?
I'm talking about maps - if you know what I mean. Files dumped from Editor as empty trash doesn't make subject for current topic.
FXANBSS wrote:EDIT: To fix the telefrag problem, type "set bot bblockplayers false", they still telefrag me somehow, what a dumb fix.
For your personal knowledge I know these things and I have tested them already - before opening topic, including bBlockActors. The problem of A.I. Pawn colliding only with projectiles is that he cannot find paths, so to speak Bot without bBlockActors (it won't telefrag anybody) cannot roam, it's a stupid camper doing nothing. Yes read well twice, that's not an answer.
Chamberly wrote:Meanwhile in Siege, the code would probably be added
I thought that Siege might have already some... tweaking... Code fore-mentioned is from a game-controller - so..., next one will be a mutator (as requested).

Edit:____
Let me see if first try fails in MAPS - I repeat MAPS. For No Maps I won't do anything.
LessTele.zip
(4.5 KiB) Downloaded 100 times
I've been testing ME+7 Bots in this Level with 4 PlayerStart Actors.
MH-AbsoluteZero_R16.zip
(47.01 KiB) Downloaded 101 times
And it was working well enough... Next homework is for some Teleporter problems.....
User avatar
OjitroC
Godlike
Posts: 3605
Joined: Sat Sep 12, 2015 8:46 pm

Re: No telefrag at start

Post by OjitroC »

Thanks for this - it is excellent - have tried a couple of small maps without the mutator and with it and it certainly works.

EDIT
Further testing suggests that, on occasion, the first time a map is played there may still be telefragging but that when that map is played again telefragging no longer occurs.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: No telefrag at start

Post by sektor2111 »

Actually I guess is pure randomness. Mutator works simple as follows:
- Player wants spot;
- Code enter the stage checking if spot is not busy - testing around spot 30 UU (default player collision);
- If spot spot is free won't be computed any option;
- If spot is busy then we have a circle defined in INI between 100 - 710 UU;
- In this circle ignoring everything we scan NavigationPoints except Teleporters (yep, I've added code);
- These auxiliary points if have pawns around 30 UU nothing will be changed (still chances to telefrag);
- If one point is found free then spot for spawn player is set there;
The fact is, if by chance normal spots PlayerStart are busy and we don't have a closer point available, telefrag-kill will still occur.

Perhaps in some future add-on I might think at using a fake tracer (trash style but Might help). Testing ground using a sort of actor pushed away. If actor stay properly, we have place, if is moved we have troubles and we try to hunt another spot. Technology might not work fast so in this moment I don't think is priority no. 1.

I'll try to figure entire Teleporter mechanics in purpose to develop a tool for teleporters because watching Bot killing me and/or other Bots doesn't make me happy.
User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA
Contact:

Re: No telefrag at start

Post by Chamberly »

I was thinking of some kind of delay to do this... to prevent the telefrag.

then I remembered in BT games, their code is already set up but I think it'll be more difficult to try working with it if it involve with the "ghost" system but it would probably make sense, if the player is spawning, they would have a transparent effect... but not many ppl want that kind of stuff on the server eh?

Maybe if having some kind of anti-telefrag code would help give some idea too. There is a NoTelefrag mod, and then a different kind of no telefrag on devilfish in siege.
Image
Image
Image Edit: Why does my sig not work anymore?
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: No telefrag at start

Post by sektor2111 »

I'm sorry but I don't know at this moment another way to deal with that START, it happens in "Startmatch()" which takes... let's say instantly so a delay probably will need to make pawn spectating or such state change, testing place, and all sort of processes which if causes troubles then we follow wrong way right from start.
Look at code and release "your demons" related to improvements.
I did this thing without to see anything similar (so to speak no code "rented"). If this is causing troubles, is probably because of some premature amnesia which I might have.
Last edited by sektor2111 on Mon Mar 07, 2016 10:01 pm, edited 1 time in total.
User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA
Contact:

Re: No telefrag at start

Post by Chamberly »

Will do. Already showed this to Higor. :satan:
Image
Image
Image Edit: Why does my sig not work anymore?
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: No telefrag at start

Post by sektor2111 »

Then... another server-side (and not only) which I think I'll use in purpose to modify teleporting rate of pawn and removing that annoying message delivered by VisibleTeleporters to nowhere because Destination if drives nowhere is Useless to be visible and Setup is bad, it's just spamming screen with crap.
If I did wrong timings source-code is available. It says shortly "TelTweak" aka "Teleporter Tweaker Bugger".
TelTweak.zip
(48.45 KiB) Downloaded 109 times
Tiny PDF document badly written is available too.
Post Reply