Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (VoroneTZ), 1,244 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Engine crasht ohne Grund #430651
09/30/13 15:10
09/30/13 15:10
Joined: Oct 2005
Posts: 12
I
irchel2 Offline OP
Newbie
irchel2  Offline OP
Newbie
I

Joined: Oct 2005
Posts: 12
Ich verwende das shooter-template t_shooter_player.c usw. Funktioniert soweit einwandfrei, aber wenn ich sterbe, moechte ich gern noch nen versuch. Also von:

Code:
[...]
if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
		{
			if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
				jump_handle = snd_play(tshooter_jump_wav, 70, 0);
			vertical_speed.z = tshooter_jump * time_step; // push the player upwards
		}
		// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
		c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE); 
		// player movement end
		wait(1);
	}
	camera.z -= 30; // bring the camera closer to the floor
	camera.roll = 40; // and rotate its view (the player is dead here)
}



(das geht wunderbar) zu:

Code:
[...]
if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
		{
			if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
				jump_handle = snd_play(tshooter_jump_wav, 70, 0);
			vertical_speed.z = tshooter_jump * time_step; // push the player upwards
		}
		// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
		c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE); 
		// player movement end
		wait(1);
	}
	camera.z -= 30; // bring the camera closer to the floor
	camera.roll = 40; // and rotate its view (the player is dead here)
	wait(30);
	//printf("unded");
	camera.z += 30;
	camera.roll = 0;
	t_shooter_players_health = 100;
	goto restarto;
	//t_shooter_player();
}



was crasht, wenn man jumpt. So gehts wieder:

Code:
[...]
	if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
		{
		//	if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
	//			jump_handle = snd_play(tshooter_jump_wav, 70, 0);
			vertical_speed.z = tshooter_jump * time_step; // push the player upwards
		}
		// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
		c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE); 
		// player movement end
		wait(1);
	}
	camera.z -= 30; // bring the camera closer to the floor
	camera.roll = 40; // and rotate its view (the player is dead here)
	wait(30);
	//printf("unded");
	camera.z += 30;
	camera.roll = 0;
	t_shooter_players_health = 100;
	goto restarto;
	//t_shooter_player();
}



alles extrem unlogisch. Ich denke da hab ich einen Engine-Bug gefunden, vielleicht im Thread-Management; wegen snd_play? Kann man single-thread erzwingen?

Oder seh ich hier was grundsaetzliches nicht?

Last edited by irchel2; 09/30/13 15:11.
Re: Engine crasht ohne Grund [Re: irchel2] #430655
09/30/13 15:49
09/30/13 15:49
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: irchel2
Kann man single-thread erzwingen?
Ja. Einfach nichts tun. Die Engine arbeitet immer nur mit einem Thread.

Leider zeigst Du ja nur einen Teil Deines Codes. Was passiert denn nach dem Label "restartto" ? Goto ist übrigens Teufelszeugs. Wenn es geht, solltest Du das vermeiden.

wait(30) wartet übrigens 30 frames. Du willst aber doch sicher eine bestimmte Zeitspanne warten, oder?


Always learn from history, to be sure you make the same mistakes again...
Re: Engine crasht ohne Grund [Re: Uhrwerk] #430659
09/30/13 16:07
09/30/13 16:07
Joined: Oct 2005
Posts: 12
I
irchel2 Offline OP
Newbie
irchel2  Offline OP
Newbie
I

Joined: Oct 2005
Posts: 12
Originally Posted By: Uhrwerk
Goto ist übrigens Teufelszeugs. Wenn es geht, solltest Du das vermeiden.



Warum denn das? Ohne goto seh ich nur noch einen Himmel voll Schleifen laugh

Re: Engine crasht ohne Grund [Re: irchel2] #430661
09/30/13 16:58
09/30/13 16:58
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Ganz grob: Mit Schleifen, Funktionen usf. kannst Du dein Programm wunderbar strukturieren. Goto bewirkt leider das Gegenteil, weil die Struktur des Quellcodes dann dem späteren Programmfluß nicht mehr entspricht.

Es gibt Tonnen von Stoff online dazu...

Das Problem bleibt aber. Du zeigst nicht deinen kompletten Code. Du hast auch nicht geschrieben, was Du denn mit "crashen" meinst...


Always learn from history, to be sure you make the same mistakes again...

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1