Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » Multiple Respawns Causes Bug
Multiple Respawns Causes Bug [message #479262] Tue, 12 February 2013 17:36 Go to next message
Troll King is currently offline  Troll King
Messages: 56
Registered: June 2012
Location: Netherlands
Karma: 0
Recruit
Setup:

- I have aprox. 40 spawnpoints.
- I kill ALL players at the exact same time by using Set_Delete_Pending.
- Players respawn all at the EXACT same spawnpoint.

Result: everybody gets stuck.

I don't think this should be happening when I have plenty of spawnpoints for the player to spawn safely. It even happens when there are only 2 players in-game.

LE set-up:
http://i1226.photobucket.com/albums/ee415/Neijwiert/Spawnpoints_zps89cdfab6.png

This is a modded M13.mix
I'm not sure if it happens on stock maps, I'm quiete sure it will.
I have NO modifications to my Renegade nor my Server files apart from the fact that I'm using SSGM plugins.


Also Known As: Neijwiert
Re: Multiple Respawns Causes Bug [message #479263 is a reply to message #479262] Tue, 12 February 2013 17:46 Go to previous messageGo to next message
Troll King is currently offline  Troll King
Messages: 56
Registered: June 2012
Location: Netherlands
Karma: 0
Recruit
Tested in stock C&C_Volcano.mix

Does not appear to be happening there somehow.

IMPORTANT NOTE:

I am killing everybody when they are a NULL model and when they spawn I instantly change their model to a valid other model.
(did not do this model changing in stock yet.)


Also Known As: Neijwiert

[Updated on: Tue, 12 February 2013 17:57]

Report message to a moderator

Re: Multiple Respawns Causes Bug [message #479264 is a reply to message #479262] Tue, 12 February 2013 18:21 Go to previous messageGo to next message
Whitedragon is currently offline  Whitedragon
Messages: 831
Registered: February 2003
Location: California
Karma: 1
Colonel
The null model is most likely your problem. The game isn't able to check if the player would become stuck by using that spawner.

Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
Re: Multiple Respawns Causes Bug [message #479266 is a reply to message #479264] Wed, 13 February 2013 02:08 Go to previous messageGo to next message
EvilWhiteDragon is currently offline  EvilWhiteDragon
Messages: 3751
Registered: October 2005
Location: The Netherlands
Karma: 0
General (3 Stars)

Whitedragon wrote on Wed, 13 February 2013 02:21

The null model is most likely your problem. The game isn't able to check if the player would become stuck by using that spawner.

Sounds likely indeed. Would also explain why it doesn't happen on a stock map and why it fails to detect spawn collisions.


http://www.blackintel.org/usr/evilwhitedragon/pointfix.gif
BlackIntel admin/founder/PR dude (not a coder)
Please visit http://www.blackintel.org/

V, V for Vendetta

People should not be afraid of their governments.
Governments should be afraid of their people.

[Updated on: Wed, 13 February 2013 02:09]

Report message to a moderator

Re: Multiple Respawns Causes Bug [message #479270 is a reply to message #479262] Wed, 13 February 2013 05:40 Go to previous messageGo to next message
Troll King is currently offline  Troll King
Messages: 56
Registered: June 2012
Location: Netherlands
Karma: 0
Recruit
Apparantly I was too tired yesterday to notice that I didn't post my post I wrote so I'll write it again hehe..

I found what the problem was. It's becouse I'm using Disable_All_Collisions BEFORE I kill them. When I kill them and they respawn the disabled collisions is still taken into account somehow.

JonWil says that this is a very old bug and he wouldn't be looking into it right now.. Sad

EDIT: model has no effect whatsoever


Also Known As: Neijwiert

[Updated on: Wed, 13 February 2013 05:40]

Report message to a moderator

Re: Multiple Respawns Causes Bug [message #479271 is a reply to message #479270] Wed, 13 February 2013 06:31 Go to previous messageGo to next message
EvilWhiteDragon is currently offline  EvilWhiteDragon
Messages: 3751
Registered: October 2005
Location: The Netherlands
Karma: 0
General (3 Stars)

Troll King wrote on Wed, 13 February 2013 13:40

Apparantly I was too tired yesterday to notice that I didn't post my post I wrote so I'll write it again hehe..

I found what the problem was. It's becouse I'm using Disable_All_Collisions BEFORE I kill them. When I kill them and they respawn the disabled collisions is still taken into account somehow.

JonWil says that this is a very old bug and he wouldn't be looking into it right now.. Sad

EDIT: model has no effect whatsoever

Somehow? I don't know, but Disable_ALL_collisions, seems like it's doing that... Just longer than you expect.


http://www.blackintel.org/usr/evilwhitedragon/pointfix.gif
BlackIntel admin/founder/PR dude (not a coder)
Please visit http://www.blackintel.org/

V, V for Vendetta

People should not be afraid of their governments.
Governments should be afraid of their people.
Re: Multiple Respawns Causes Bug [message #479274 is a reply to message #479262] Wed, 13 February 2013 10:54 Go to previous messageGo to next message
StealthEye is currently offline  StealthEye
Messages: 2518
Registered: May 2006
Location: The Netherlands
Karma: 0
General (2 Stars)

I would not expect that, I actually find it very weird. Isn't the object destroyed before a new one is spawned?

I would also expect that players spawn at random spawners. Why would they all draw the same number?

Weird bug tbh, but I guess you can work around it by enabling collisions before spawning?


BlackIntel admin/founder/coder
Please visit http://www.blackintel.org/
Re: Multiple Respawns Causes Bug [message #479275 is a reply to message #479262] Wed, 13 February 2013 11:23 Go to previous messageGo to next message
Troll King is currently offline  Troll King
Messages: 56
Registered: June 2012
Location: Netherlands
Karma: 0
Recruit
Thats exactly what I dit by using Commands->Enable_Collisions but it doesn't work. The work-around I came up with is pretty stupid, but it works.
I'm killing the guy twice in a row. So first when it has all collisions disabled and also trying to enable collisions before killing it. Then it respawns fresh and untouched and I kill it again.

EDIT:
Also this fancy editing of object upon spawn causes some netcode bugs aswell.. I'm trying to apply some changes so fast after being created that some don't have effect until I kill them again. (Apparently only happens to other players and only the first spawn in-game). AND NO THIS IS NOT MY CODE'S FAULT. I've put lots of debug text in it and tested it numerous times and it always hits the Set_Delete_Pending and then returns the object create event. BUT IT NEVER EVER KILLS THE OBJECT

EDIT #2: If ur wondering why I'm killing them, it's becouse I'm trying to change their teams my own way and I'm doing it the exact same way as SSGM uses for fore TC the only difference is that I'm doing it in the object created event and not in a script created event. I need to do something else thats why I'm not using the Change_Team engine call..


Also Known As: Neijwiert

[Updated on: Wed, 13 February 2013 11:28]

Report message to a moderator

Re: Multiple Respawns Causes Bug [message #479276 is a reply to message #479262] Wed, 13 February 2013 11:31 Go to previous message
Troll King is currently offline  Troll King
Messages: 56
Registered: June 2012
Location: Netherlands
Karma: 0
Recruit
EXACT CODE:
Console_Output("spawning new obj\n");
	// Invalid obj, not enabled or not alive.
	if(!Enabled || !obj || Commands->Get_Health(obj) <= 0 || !obj->As_SoldierGameObj())
		return;

	Console_Output("1\n");

	cPlayer *PData = Find_Player(Get_Player_ID(obj));
	// Somehow the player does not have any WW player data.
	if(!PData)
		return;
	Console_Output("2\n");
	bool NewPlayer = false;
	TC_Player *Player = Find_TC_Player(obj);
	// Player data does not exist yet.
	if(!Player)
	{
		NewPlayer = true;
		TC_Player *NewPlayer = new TC_Player(PData->Get_Id());
		NewPlayer->Set_Spawns(InitialSpawns);
		Players.Add(NewPlayer);
		Player = NewPlayer;
	}

	if(!Player->Has_Collisions_Enabled())
	{
		Player->Toggle_Collisions_Enabled(true);
		Player->Respawn_Me();
		return;
	}
	Console_Output("3\n");
	// Invalid team.
	int PlayerType = Commands->Get_Player_Type(obj); // Must be done via Commands, becouse elseway we get an access violation.
	if(PlayerType != 1 && Player->Get_Spawns() > 0)
	{
		Commands->Attach_Script(obj, "TC_Change_Team_Fix", "1");
		return;
	}
	Console_Output("4\n");
	// Change the spawns if we should.
	if(!NewPlayer)
		Player->Decrease_Spawns();

	if(PlayerType != -2 && Player->Get_Spawns() <= 0)
	{
		Commands->Attach_Script(obj, "TC_Change_Team_Fix", "-2");
		return;
	}
	Console_Output("5\n");
	// Only display a message when we're not in a cinematic.
	if(!IsInCinematic)
	{
		StringClass Str;
		// Player still has spawns available.
		if(Player->Get_Spawns() > 0)
		{
			Str.Format("%s, you have %d spawn(s) left!", Get_Player_Name(obj), Player->Get_Spawns());
			Send_Message_Player(obj, 0, 255, 0, Str.Peek_Buffer());
		}
		else
		{
			Str.Format("%s, you have no spawns left!", Get_Player_Name(obj));
			Send_Message_Player(obj, 255, 0, 0, Str.Peek_Buffer());
			Send_Message_Player(obj, 255, 0, 0, "You can only respawn if somebody picks up a spawn powerup.");
		}
	}
	else if(CinematicStarted)
	{
		StringClass Str;
		Str.Format("%s, there is currently a cinematic playing, please wait.", Get_Player_Name(obj));
		Send_Message_Player(obj, 255, 255, 0, Str.Peek_Buffer());
	}

	// Check if we should make the screen black
	Set_Screen_Fade_Color_Player(obj, 0,0,0,0.1f);
	Set_Screen_Fade_Opacity_Player(obj, IsScreenHidden ? 1.0f : 0.0f, 0.1f);

	// Check if we should render the player.
	bool Render = !IsInCinematic;
	if(Player->Get_Spawns() <= 0)
		Render = false;

	// Default object stuff, doesn't matter if we should render or not.
	if(NewPlayer || Player->Is_Marked_As_Leaver())
	{
		Player->Mark_As_Leaver(false);
		Set_Background_Music_Player(obj, BackgroundMusic.Peek_Buffer());
	}

	Set_Max_Health(obj, Health);
	Commands->Set_Health(obj, Health);
	Set_Max_Shield_Strength(obj, Shield);
	Commands->Set_Shield_Strength(obj, Shield);
	Set_Skin(obj, "SkinFlesh");
	Commands->Set_Shield_Type(obj, "ShieldKevlar");
	Commands->Clear_Weapons(obj);
	//////////////////////////////////////////////////////////////////

	// Stuff that is dependand on rendering.
	Commands->Set_Model(obj, Render ? SpawnModel : "null");
	Enable_HUD_Player(obj, Render);
	Commands->Set_Is_Visible(obj, Render);

	// Check if we should be able to fly.
	HumanStateClass::HumanStateType State = obj->As_SoldierGameObj()->Get_State();
	if((State == HumanStateClass::DEBUG_FLY && !IsInCinematic && Render) || (State != HumanStateClass::DEBUG_FLY && IsInCinematic) || (State != HumanStateClass::DEBUG_FLY && !Render))
		Toggle_Fly_Mode(obj);

	if(Render)
	{
		int WeaponCount = WeaponList.Count();
		for(int x = 0; x < WeaponCount; x++)
		{
			StringClass *CurrentWeapon = WeaponList[x];
			if(CurrentWeapon)
				Commands->Give_PowerUp(obj, CurrentWeapon->Peek_Buffer(), false);
		}
	}
	else
	{
		obj->As_SoldierGameObj()->Set_Max_Speed(15.0f);
		Commands->Disable_Physical_Collisions(obj);
		Player->Toggle_Collisions_Enabled(false);
	}
	
	////////////////////////////////////////////////////////////////

	// Stuff that should only be toggled when we are in a cinematic.
	Commands->Control_Enable(obj, !IsInCinematic);


The script Netcode_Fix is to try to do the teamchange in the script created event instead, but does not appear to work properly aswell


Also Known As: Neijwiert
Previous Topic: PT lag
Next Topic: Fix Homing logic
Goto Forum:
  


Current Time: Sat May 18 00:31:09 MST 2024

Total time taken to generate the page: 0.00783 seconds