open the WMB format

Posted By: amy

open the WMB format - 03/13/09 07:03

It would be great if exporters for applications like Blender could export directly to the WMB format.

Could you release the specifications for WMB or do an IO-library for it (but please with a C-API so that other languages than C++ like Python can easily access it)?

Blender 2.5 will have a much more customizable GUI so it will be possible to turn Blender into an easy to use level editor which is much more powerful than WED.
Posted By: Dan Silverman

Re: open the WMB format - 03/13/09 07:38

Thy this, Amy:

http://www.opserver.de/wiki/index.php/WMP

Scroll down to the English section.

EDIT:

Never mind. I had read WMP when I should have seen you were looking at WMB. However, if WMP can be exported from Blender, then it can me directly imported into WED and built as a WMB there. In fact, you would most likely want a WMP file from Blender instead of a WMB, wouldn't you? Because the WMB contains a lot of additional information like shadow map info, etc.
Posted By: amy

Re: open the WMB format - 03/13/09 07:43

I mean the WMB format. There already is a WMP exporter for Blender by ventilator but it would be much nicer if going through the troublesome map compiler could be avoided.

Quote:
In fact, you would most likely want a WMP file from Blender instead of a WMB, wouldn't you? Because the WMB contains a lot of additional information like shadow map info, etc.
I would prefer to bypass all Gamestudio tools. smile Blender can also calculate shadow maps and other things in case anything else is needed.
Posted By: jcl

Re: open the WMB format - 03/13/09 08:07

Ok, I'll do a WMB description when I have some time. Unlike WMP, WMB is a semi-fixed format, so it does not change often and stays backwards compatible. Thus a WMB exporter would make sense.
Posted By: amy

Re: open the WMB format - 03/15/09 07:41

http://www.conitec.net/beta/prog_mdlhmp.html

Hey, you have started already! Thanks! Please continue! smile
Posted By: ventilator

Re: open the WMB format - 03/16/09 06:58

that's nice!

i asked for the wmb format in the beta forum a while ago and you said that it is too complicated and changes often and a wmb read/write library would be needed.

it looks simpler than the wmp format though. only making mistakes in all the offset calculations could be a bit of a pain. smile
Posted By: jcl

Re: open the WMB format - 03/16/09 08:22

Yes, the A7 WMB format is much simpler than the A6 WMB format, and future changes will be upwards compatible, so it's pretty safe to use now.
Posted By: ventilator

Re: open the WMB format - 03/16/09 12:41

how do the path points and triples look like?

do the indices (for example in the skin struct) start with 0? what if a skin doesn't have a lightmap? should the index be -1 then?
Posted By: jcl

Re: open the WMB format - 03/16/09 12:44

I'll add the path description in the next days.

The indices start with 0, and skins without lightmap have their flags parameter at 2.
Posted By: ChrisB

Re: open the WMB format - 03/23/09 14:19

It would be better if the engine outputs the file position in the wmb if the wmb has an incorrect format and not the character itself. Mentioning the type of struct it is trying to parse would be even better.

Quote:

long num_textures; // number of textures
long offset[num_textures]; // list of texture offsets from the start of the list, in bytes
A texture begins at the offset given by the array of texture offsets.

I'm a bit confused right now.
So is it the offset from the beginning of the file or from the long num_textures?
Posted By: amy

Re: open the WMB format - 03/23/09 14:40

Quote:
long path; // attached path index
long entity2; // attached entity index


What about the indices here? Do they start at 0 and what if nothing is attached?



I also have a question about smoothing. Do vertices which are at the same position get welded for gouraud shading? What about the UV-borders? How do you determine the normals? I think the smoothing flag is too inflexible and not enough. Smoothing groups or something like that would be needed. This whole smoothing thing really is a big weakness of Gamestudio.
Posted By: jcl

Re: open the WMB format - 03/23/09 15:52

I've added the answers to the description.

- Vertices don't get welded by themselves. It's up to the level designer to weld them. Gouraud shading is only active for blocks with Smooth flag, and only from version 7.74 on that's currently in beta. When you think the Smooth flag is not enough, just share with us your idea of how else smoothing should work.
Posted By: amy

Re: open the WMB format - 03/23/09 16:07

/\
||
\/

Letīs say you have a shape like this (top view and every character is a polygon) and want hard edges at the tips but smooth shading on the sides. Thatīs not possible with the smooth flag. (This is just one example. I could list more issues.)

With smoothing groups it would be possible. Put the left side into smoothing group 1 and the right side into smoothing group 2. At the borders of the smoothing groups there will be hard edges. Thatīs how smoothing groups work in 3dsmax.

Actually smoothing groups arenīt that nice to work with though. I prefer how it works in Maya where you can set smoothing information directly on the edges. But there is no edge struct in the WMB format so probably it would be simplest to include normals with the vertices. Then the exporter could handle smoothing correctly. The smooth flag would be obsolete then.
Posted By: ventilator

Re: open the WMB format - 03/23/09 16:45

yes, please ignore the smooth flag in WMB and add normals to the vertex struct instead. this would solve the problem.

WED can still use the smooth flag (but better implement something more sophisticated) and the map compiler is responsible for calculating the mesh and its normals.
Posted By: amy

Re: open the WMB format - 03/24/09 13:04

jcl, what do you think about adding the normal to the vertex struct?
Posted By: DavidOC

Re: open the WMB format - 03/27/09 23:18

I'm having problems to display the lightmap. This is the result so far, probably it's the materials list, I'm not including one, or maybe it's the UV coordinates. Any idea will be appreciated.

Best Regards.
Posted By: ventilator

Re: open the WMB format - 03/28/09 02:00

what application do you write your exporter for? just curious...

i didn't really start to work with the wmb7 format yet but maybe at least mat_shaded or mat_flat have to be added to the material list and then used correctly by your geometry?
Posted By: DavidOC

Re: open the WMB format - 03/29/09 16:14

Thanks, I think mat_flat would work, I'll check with this.

Right now I'm focused in Cartography Shop 4.1 (old but I bought a license when started with Dark Basic Pro), after finishing it I'll look for a free editor, I already have a program to load and convert to a MDL the Gile[s] output (DirectX exporter), so my first option is integrating both.
Posted By: DavidOC

Re: open the WMB format - 04/02/09 18:11

The problem was negative UV data, I need to normalize it. Now I'm trying to include terrains, but they are not described in the objects section (maybe type=3?).

So far I have this sample, I tested it with the 18 Lite-C workshop code and runs fine.

Regards
Posted By: jcl

Re: open the WMB format - 04/06/09 07:23

Terrains are normal entities, type=7.
Posted By: DavidOC

Re: open the WMB format - 04/06/09 15:19

Thanks, I'll check with this type.
Posted By: amy

Re: open the WMB format - 06/04/09 13:55

jcl, what do you think about the smoothing issue? Wouldn't adding the normals make sense? Being able to do proper smoothing is important.
Posted By: jcl

Re: open the WMB format - 06/05/09 09:35

Yes, normals would give you more flexibility than the smooth flag. We'll probably implement them when the format is changed the next time. But not in the vertex struct, more likely in an additional list that is normally zero, but contains normals for special blocks consisting of different smoothing groups.
Posted By: amy

Re: open the WMB format - 06/10/09 09:11

char name[20];
char filename[33];
char action[20];

I have problems with those strings in the entity struct. Are you sure the sizes are okay? There also seem to be two different entity types (7 and 3). What is the difference between them?
Posted By: DavidOC

Re: open the WMB format - 07/16/09 21:47

amy is right, I had to write the filename and the action in the position 13 of the char array, and had to set my actions to 7 characters only, and it looks like the entity flags doesn't work (I'm setting 512 for PASSABLE and 256 for INVISIBLE).

Here is my test map:
MAP
and here is the code (I modified the workshop19 code):

Code:
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////////////////////////////////////

VECTOR ball_speed;

action InitBal(){
	set(my, SHADOW);
	phent_settype(my, PH_RIGID, PH_SPHERE); // set the physics entity type
	phent_setmass (my, 3, PH_SPHERE); // and its mass
	phent_setfriction (my, 80); // set the friction
	phent_setdamping (my, 40, 40); // set the damping
	phent_setelasticity (my, 50, 20); // set the elasticity	
	while (1)
	{
		ball_speed.x = 25 * (key_cur - key_cul); // move the ball using the cursor keys
		ball_speed.y = 25 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
		ball_speed.z = 0; // no need to move on the vertical axis
		phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
		camera.x = my.x - 100; // keep the camera 100 quants behind the ball
		camera.y = my.y; // using the same y with the ball
		camera.z = 400; // and place it at z = 400 quants
		camera.tilt = -60; // make it look downwards
		wait (1);
	}
}

function main()
{
	fps_max = 140;
	shadow_stencil = 1;
	level_load("test.wmb"); // load the level
	wait (2); // wait until the level is loaded
	ph_setgravity (vector(0, 0, -386)); // set the gravity
}


Posted By: DJBMASTER

Re: open the WMB format - 07/17/09 03:25

Originally Posted By: amy
char name[20];
char filename[33];
char action[20];

I have problems with those strings in the entity struct. Are you sure the sizes are okay? There also seem to be two different entity types (7 and 3). What is the difference between them?

The sizes are wrong. When i was writing a parser in C# i kept getting the wrong part of the file when using the sizes in the documentation. I opened up a .wmb in a binary editor and found that the data was 33 bytes apart from each other, so i used 33 for each field.

Entity type 3 is one that has no action applied (static). Entity type 7 has an action attached (dynamic). JCL says to use type 7.
Posted By: jcl

Re: open the WMB format - 07/17/09 07:55

That's right - there was a mistake in the format description. The sizes are 33, not 20. Sorry for that. I've uploaded a corrected version.
Posted By: DavidOC

Re: open the WMB format - 08/13/09 16:26

These are other things I've found:

a) The PATH_EDGE lists node1 and node2 as long, but they are float.
b) You need to save at least 20 edges, having less causes the engine to crash (haven't tested with more than 20).
c) For entities I had to set the length of ACTION array to 34 instead of 33, this way I can read the skills and flags without problem.

EDIT: d) In the PATH_EDGE the node numbers start with 1 not 0

Regards


Posted By: jcl

Re: open the WMB format - 08/24/09 11:15

I've uploaded a corrected page - node1 and node2 are indeed float and start with 1.

Your other problems are possibly caused by a wrong data alignment setting in your compiler.
Posted By: DavidOC

Re: open the WMB format - 08/24/09 17:39

thanks for your time in this issue
Posted By: DJBMASTER

Re: open the WMB format - 02/19/10 11:02

Didn't want to start a new topic so posting here...

JCL, DavidOC is right, the field for Action is 34 chars long not 33. This explains why a while ago, when I was using 33, after counting up the bytes there was always 1 byte missing, which I couldn't explain.
If I use 33 bytes for action, and read the following flags/skills I get garbage, but using 34 it works fine.

Can you please update the WMB documentation.
Posted By: mikaldinho

Re: open the WMB format - 02/19/10 11:31

i agree with djbmaster. 34 chars is good, 33 is bad.
Posted By: DJBMASTER

Re: open the WMB format - 02/19/10 11:36

Or at least one of name, filename, action is 34 and not 33.
Posted By: Damocles_

Re: open the WMB format - 02/19/10 17:44

Another note about the levelformat.

Is it possible to remove the palette?
Not shure if anyone uses it, and if, that it is bound
manually. Indexed pictures (if someone want to use them) have their own palette anyhow.

Nowerdays it causes more problems (missing palettefile for example), than beeing helpful.
Posted By: mikaldinho

Re: open the WMB format - 02/19/10 18:34

i agree
Posted By: Nidhogg

Re: open the WMB format - 02/20/10 12:07

Ditto on the palette issue.
© 2024 lite-C Forums