[Solved] My map produces a server crash?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

[Solved] My map produces a server crash?

Post by Bjarne BZR »

I'm having a really annoying problem, and I fear that I need some of the best and brightest to figure it out.

On some servers that run "Vemork approach", the map runs once, and at next mapstart the server crashes.

The problem is that it only does this when logfile (and possibly developer) is set to 0. :cry:
I managed to provoke it into crashing with logfile set to 1 once. BUT the log function in MOHAA appears to suck so badly that it buffers some the log before writing it to disc: thus, the last ( most important ) log entries are lost.

So I need help by either:
1) Someone managing to make a crash that logs the error. ( You need to be 2 players on the server, its not enough to remove the level waittill roundstart )
2) Someone telling me how I can setup a server so it writes faster to disc.

In short: HELP! :cry:

The map is here.

PS: The scout function is not the problem, same thing without it
PS2: A recompile of the map does not help.
Last edited by Bjarne BZR on Tue Aug 05, 2003 8:26 am, edited 1 time in total.
Admin .MAP Forums
Image
Head above heels.
[AoHx]Omnicient
Corporal
Posts: 44
Joined: Sat Jul 26, 2003 1:44 am

Post by [AoHx]Omnicient »

one thing u may want to do - if u havent already - is have someone play w/ u and have them start a logfile. if ur the host of the server this might work. if it only crashes the server and not MOHAA entirly console still has the errors in it so u can check there if it didnt write to ur log file. im noob to all this but it might work :D
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Hmmm... Its worth a try...
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I'm afraid it will just say 'server disconnected'...

Does it still crash if you take out the script altogether?
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Hmm... Did not try that, as it is objective... I only removed the "Scout mod" ( And that made no difference ).
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Bjarne BZR wrote:Hmm... Did not try that, as it is objective... I only removed the "Scout mod" ( And that made no difference ).
Well if you have the chance I think you really should try running it without a script, or maybe a script like this:

Code: Select all

main:
  level waittill spawn

  level waittill roundstart

  wait 5

  teamwin allies
end
Then at least you'll know whether the map or the script is the problem.
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

OK!

Tried it without the script. Worked like a charm... Not really sure to use a :D or a :cry: ... but I guess a :D because a scrip error sure beats a bsp error. :wink:

So now I'm down to the script... cant see anyting wrong with it ( code blindness is a known fact of scripting ).
So I guess its OK to move this thread to scripting now. :wink:

So here is the main script:

Code: Select all

// obj_vemork_approach
// ARCHITECTURE: Bjarne Gr?nnevik
// SCRIPTING: Bjarne Gr?nnevik
// LINK: http://www.planetmedalofhonor.com/rjukanproject/
// VERSION: RC1

main:
	setcvar "g_obj_alliedtext1" "Get past the Axis"
	setcvar "g_obj_alliedtext2" "patrols and get to the"
	setcvar "g_obj_alliedtext3" "factory to the south."
	setcvar "g_obj_axistext1"   "Scouts have reported"
	setcvar "g_obj_axistext2"   "Allied troops north"
	setcvar "g_obj_axistext3"   "of Vemork factory."

	setcvar "g_scoreboardpic" "vemork_approach_status"

	// Haze
	$world farplane_color "0.5 0.4 0.5"
	level.fogplane = 4500
	$world farplane level.fogplane

	level waittill prespawn
	exec global/DMprecache.scr
	level.script = maps/obj/obj_vemork_approach.scr
	exec global/ambient.scr m6l1a
	exec global/rjukanproject_scout.scr

	level.dmrespawning = 0 // 1 or 0 (0=no respawn)
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = draw // set to axis, allies, kills, or draw

	local.master = spawn ScriptMaster
	local.master aliascache fireplace sound/amb/Amb_FirePlace.wav soundparms 1.3 0.0 1.0 0.0 150 2000 auto loaded maps "obj_vemork_approach dm obj"
	local.master remove

	level waittill spawn
	
	//The snow
	level.rain_speed = "32"
	level.rain_speed_vary = "16"
	level.rain_length = "2"
	level.rain_width = "1"
	level.rain_density = "0.2"
	level.rain_slant = "250"
	level.rain_min_dist = "1800"
	level.rain_numshaders = 12
	level.rain_shader = "textures/snow7"

	level waittill roundstart
	thread print_message
	$fire_speaker loopsound fireplace
	// All objectives handled by triggers calling the below methods...
end

/******************************************************************
 * Axis victory test ( Win by timeout or eradication of opposing
 * force )
 */
axis_win_timer:
	level waittill axiswin // At the end Axis win
end

/******************************************************************
 * Checks to see if an allied soldier has reached the escape area.
 */
objective_reached:
	if(parm.other.dmteam == allies) { // parm.other is the triggerer
		iprintlnbold_noloc "The allies have escaped!"
		teamwin allies
	}
	else
	{
		if ( parm.other.dmteam == axis )
		{
			parm.other iprint "You are trying to leave the area," 0
			parm.other iprint "get back and kill the allies!" 1
		}
	}
end

/******************************************************************
 * Level start message. Printed randomly.
 */
print_message:
	println ("print_message thread started")
	if (randomint(15) == 0)
	{
		iprintlnbold_noloc "In the mountains somewhere above the"
		iprintlnbold_noloc "Heavy water production  plant at Vemork"
		iprintlnbold_noloc "in Rjukan, Norway, feb 1943."
	}
end

/******************************************************************
 * Warn forces that try to escape on the allies side of the map.
 */
allied_chicken_warning:
	parm.other iprint "You are trying to leave the area," 1
	parm.other iprint "get back to the mission soldier!" 1

end

/******************************************************************
 * Punish forces that try to escape on the allies side of the map.
 */
allied_chicken_punishment:
	parm.other hurt 10 "BULLET"
	if (randomint(4) == 0)
	{
		parm.other iprint "Get back in there soldier!" 1
	}
end

/******************************************************************
 * Punish axis forces that try to escape on the axis side of the
 * map.
 */
axis_chicken_punishment:
	if ( parm.other.dmteam == axis )
	{
		parm.other hurt 10 "BULLET"
		if (randomint(4) == 0)
		{
			parm.other iprint "Get back in there kraut!" 1
		}
	}
end

/******************************************************************
 * Make fire hurt players.
 */
fire_hurt:
	parm.other hurt 10 "FIRE"
end

/******************************************************************
 * Kill any players managing to get under the map.
 */
landshark_hurt:
	iprintlnbold_noloc  "A landshark is beeing burned in hell!" 1
	parm.other hurt 666 "FIRE"
end

/******************************************************************
 * Activated when allies has traveled 2/3 of the map.
 */
allied_breach:
	if ( parm.other.dmteam == allies )
	{
		if (!level.breach)
		{
			level.breach = 1
			iprintlnbold_noloc "The allies have passed the stone wall!"
		}
	}
end

/******************************************************************
 * Give the players the ability to "tag" enemy with the binoculars.
 */
clickitem_fail:
	exec global/rjukanproject_scout.scr::binocular_fire
end
I've tried to rip out the scouting, no difference...
I've tried to change level.clockside...
Every part of the script works, except that it crashes the server after the first round when logfile and developer is set to 0...

And here is global/rjukanproject_scout.scr:

Code: Select all

// Scout modification
// ARCHITECTURE: Bjarne Gr?nnevik
// SCRIPTING: Bjarne Gr?nnevik
// LINK: http://www.planetmedalofhonor.com/rjukanproject/
// VERSION: BETA
// THANX: jv_map at .MAP for all the help and code.

/******************************************************************
 * How to insert scouting in your map:
 *
 * 1) Put user-rjukanproject_scout.pk3 in the <MOHAA>/main folder.
 * 2) Insert this line in your main method ( after roudstart ):
 *      exec global/rjukanproject_scout.scr
 * 3) Insert this method last in your script ( outside of main ):
 *     clickitem_fail:
 *       exec global/rjukanproject_scout.scr::binocular_fire
 *     end
 * 4) Done! Lets scout them out!
 */

/******************************************************************
 * Script main entry point.
 */
main local.instruction_frequency:

	local.master = spawn ScriptMaster
	local.master aliascache snd_binoculars sound/mechanics/Mec_RadioNoise_11.wav soundparms 0.5 0.2 0.9 0.1 160 1600 item loaded 

maps "dm obj"
	local.master remove

	level waittill spawn

	level.the_gametype = int( getcvar( g_gametype ) )
	
	if (local.instruction_frequency == NIL)
	{
		local.instruction_frequency = 15
	}
	thread print_instructions local.instruction_frequency
end	

/******************************************************************
 * Level start message. Printed randomly.
 */
print_instructions local.inst_freq:
	println ("print_instructions thread started")

	wait 10
	if (randomint(local.inst_freq) == 0)
	{
		iprintlnbold_noloc "You can scout by using your binoculars:"
		iprintlnbold_noloc "(Aim at an enemy and press fire to mark"
		iprintlnbold_noloc "them with intense colored lights)"
	} else {
		if (randomint(40) == 0)
		{
			iprintlnbold_noloc "Scout modification by The Rjukan project:"
			iprintlnbold_noloc "www.planetmedalofhonor.com/rjukanproject"
		}
	}
end

/******************************************************************
 * Give the players the ability to "tag" enemy with the binoculars.
 */
binocular_fire:
	local.fwd_vec = angles_toforward self.viewangles
	local.start = self gettagposition "Bip01 Head"
	local.hit_location = trace (local.start + local.fwd_vec * 64) (local.start + local.fwd_vec * $world.farplane) 0
	local.ent = spawn script_origin origin local.hit_location

	// local.beam = spawn func_beam origin local.start endpoint local.hit_location maxoffset 0 
	// local.beam color (0 1 0) 
	// local.beam doActivate
	// local.beam commanddelay 1 remove
	
	println "Binocular target: " local.hit_location
	if ( $player.size > 1 )
	{
		for(local.i = 1; local.i <= $player.size; local.i++)
		{
			local.player = $player[local.i]
			if(self != local.player)
			{
				if(self.dmteam != local.player.dmteam)
				{
					if(local.ent isTouching local.player)
					{
						self iprint "You have tagged an enemy soldier!" 1
						local.player thread light_up 0
						break
					}
				}
				else
				{
					if(level.the_gametype == 1)
					{
						if(local.ent isTouching local.player)
						{
							self iprint "You have tagged an enemy soldier!" 1
							local.player thread light_up 1
							break
						}
					}
				}
			}
		}
	}
	local.ent immediateremove // do it! do it now! :)
end

/******************************************************************
 * Light up a player as a chrismas tree ( if not already lit ).
 */
light_up local.ffa:
	println "Player tagged: " self "(Glow-state=" self.glowing ")"
	if( self.glowing != 1 )
	{
		if(local.ffa == 1) {
			{
				self light 0.0 1.0 0.0 300
			}
		}
		else
		{
			if ( self.dmteam == allies ) // can be 'spectator', 'freeforall', 'allies' or 'axis' 
			{
				self light 0.0 0.0 1.0 300
			}
			else
			{
				if ( self.dmteam == axis )
				{
					self light 1.0 0.0 0.0 300
				}
			}
		}
		self iprint "You have been sighted by an enemy scout!" 1
		self lightOn
		self.glowing = 1
		wait 10
		self lightOff
		self.glowing = 0
	}
end
...but as I said, removing it did not remove the problem...

So, anyone without code blindness that can spot the error ( see earlier posts for crash details ) :?:
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

local.master remove

Remove this line.

(I'll remove it from my tut as well :oops: )
Valoche wrote:Aloha,

Just tested jv's tip, it works like a charm, but... it keeps crashing the server :evil:

I declared 14 customs sounds using mp3's, and when you restarted the map (console restart or one team wins, so restart), the game server crashed, both Windows server (@ home), and leased Linux server.

I first tried to put the aliases declarations in the XXXX_precache.scr file, didn't work.
I finally removed the last line:
local.master remove
and now the server does not crash anymore.
How weird is that ?

Valoche
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Jv, your an angel for finding the problem.
Youra devil for causing it with the soud tut.
Your an angel for making the sound tut.

So... taking everything into account: I guess your an angel :D
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Valoche actually found the problem, he's the angel :wink:

Uh oh... I guess that makes me a devil then :twisted:
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Nope, that makes you equal of both angel and devil... Thats a regular human... is't it? :D
Admin .MAP Forums
Image
Head above heels.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Theory?

Post by tltrude »

Any theories as to why "local.master remove" causes servers to crash? Could it be that the clients have slower computers and don't finish loading there wav files before the entity is removed?
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Re: Theory?

Post by jv_map »

tltrude wrote:Any theories as to why "local.master remove" causes servers to crash? Could it be that the clients have slower computers and don't finish loading there wav files before the entity is removed?
I don't know :?. It's also kind of impossible to find out why exactly without having the source code :(

It doesn't really matter though, the remove line is not that important I think.
Image
Post Reply