Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/01/26 16:40
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (DrissB, clint000), 5,237 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: No level_load for session_open and session_connect [Re: JibbSmart] #373654
06/11/11 17:56
06/11/11 17:56
Joined: Aug 2000
Posts: 1,141
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,141
Baunatal, Germany
Why do you level_load(NULL) when you have no level? Or do you also have a NULL level on the server?

Re: No level_load for session_open and session_connect [Re: Tobias] #373655
06/11/11 18:06
06/11/11 18:06
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I'm not sure I understand your question. "level_load" must be called before creating entities, even if it is a NULL level. So at the beginning of main() I call level_load(NULL), before it's determined whether the game is a client, a server, or just to play offline.

There are no other levels, and no other level_load calls except a level_load(NULL) immediately after joining a game as a client, and immediately after disconnecting as a client, because otherwise I get a "no level!" error.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: No level_load for session_open and session_connect [Re: JibbSmart] #374065
06/15/11 08:54
06/15/11 08:54
Joined: Jul 2000
Posts: 28,077
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,077
Frankfurt
Connection to a server has nothing to do with level loading.

But when you have a level on the server, and need to synchronize your level with it, you should reload it first for resetting it to its initial state. Otherwise you might have entities in your client level that don't exist on the server. This is just a logical consequence of running a multiplayer game, and is unrelated to particular commands like session_connect. If your level is already synchronized however, I see no reason why you should want to load it again.


Re: No level_load for session_open and session_connect [Re: jcl] #374096
06/15/11 14:05
06/15/11 14:05
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I don't want to, but I'm forced to, because if I don't the level gets cleared out and I get this error:
Quote:
Malfunction W1517
on_client_event - no level!
...whenever I (as a client) connect, or leave.

AFAIK, level_load (which, when I'm getting these errors, only ever happens in the main function before any sessions are opened or connected) and game_load (which I never use) are the only other functions that clear out a level completely.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: No level_load for session_open and session_connect [Re: JibbSmart] #374100
06/15/11 14:21
06/15/11 14:21
Joined: Jul 2000
Posts: 28,077
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,077
Frankfurt
No, a level can not get "cleared out" by itself. You must do this with a command. When you load a level, it stays until you load another one. The error message means not that your level is cleared out, it means that you have no level at all. When you try to remove or create entities without having a level, you'll get this error.

Maybe some sort of misconception about multiplayer or level loading is the problem here.





Re: No level_load for session_open and session_connect [Re: jcl] #374110
06/15/11 15:33
06/15/11 15:33
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Okay, I'm going to try to be as clear as possible.

In the first frame, a level is loaded ("level_load(NULL)"). I can play offline, entities get created all over the place, and I enjoy myself.

Then I go back to the main menu (the level still visible in the background), load up the serverlist, and join a game.

In an instant, the level disappears, the skybox disappears, and I get this error:
Quote:
Malfunction W1517
on_client_event - no level!

Even shorter summary:
1. NULL level is loaded.
2. Create entities and interact with them to verify that there is a level.
3. Connect to online game.
4. Error because there is apparently no level when I try to create entities.

Optional steps:
5. Read the manual -- "After switching from normal to client mode with a loaded level, the level must be loaded anew." (session_connect)
6. Conclude that the manual's description is enforced by session_connect clearing out the level.
7. Work around the error by loading a NULL level again when a connection is made, and when a connection is lost (which was otherwise also causing the same problem).

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: No level_load for session_open and session_connect [Re: JibbSmart] #374122
06/15/11 17:44
06/15/11 17:44
Joined: Jul 2000
Posts: 28,077
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,077
Frankfurt
I understand the problem, but can not confirm it here. When you loaded a level before, you should not get a no level error. This would be a bug. I can connect to a server here without getting this error.

What the manual means is that you must reload the level when you have a single player level and now switch to multi player mode. The reason is simply that a single player level is very different in internal structure to a multi player level. But when you're not in single player mode, it's completely up to you if you reload the level on connection or not. At least that's the theory.

If you can't find a reason of the disappearing level, please contact the Support - they'll look into it.

Re: No level_load for session_open and session_connect [Re: jcl] #374123
06/15/11 18:07
06/15/11 18:07
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Okay, please help me out here. Below is a self-contained script (no assets required), only about 40 lines long.
Code:
// multiplayer test

function startServer() {
	session_open("test");
}

function startClient() {
	session_connect("test", NULL);
}

function disconnectClient() {
	session_close();
}

function createEntity() {
	ent_createlocal(SPHERE_MDL, vector(0, random(64) - 32, random(32) - 16), NULL);
}

function main() {
	screen_size.x = 200;
	screen_size.y = 100;
	level_load(NULL);
	camera.x -= 100;
	ent_createlocal(SPHERE_MDL, nullvector, NULL);
	on_s = startServer;
	on_c = startClient;
	on_d = disconnectClient;
	on_e = createEntity;
	while (1) {
		if (connection & 1) {
			draw_text("server", 10, 10, vector(255, 255, 255));
		} else if (connection & 2) {
			draw_text("client", 10, 10, vector(255, 255, 255));
		} else {
			draw_text("offline", 10, 10, vector(255, 255, 255));
		}
		wait(1);
	}
}


Please run the script, then press "s" to start a server. Leave that running and run the script again, and press "c" to connect to a server on the same machine. Here it goes black and the entity disappears (level cleared). Press "e" to create a local entity on the client, and I get the error. If I press "e" on the server (or in offline mode), another sphere is created in front of the camera.

I'm afraid I don't know why this is going wrong, and any help would be much appreciated.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: No level_load for session_open and session_connect [Re: JibbSmart] #374181
06/16/11 08:29
06/16/11 08:29
Joined: Jul 2000
Posts: 28,077
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,077
Frankfurt
Thanks for the script! The problem here is that you're switching from single player to multi player with a single player level. So I would expect an error as soon as you connect to the server. But you're right that it should be a different error - not the "no level" error. And no error at all when you switch off entity updates completely. So there's indeed something wrong. We'll look into this and will solve the issue for the next update.

Re: No level_load for session_open and session_connect [Re: jcl] #374205
06/16/11 13:04
06/16/11 13:04
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Much appreciated laugh Thanks for your patience.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Page 2 of 3 1 2 3

Moderated by  aztec, Spirit 

Gamestudio download | 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