Warzone 2100 port

sebt3

homebrew player (P. & C.)
Joined
Sep 9, 2008
Messages
4,747
Age
39
Location
France
Website
sebt3.openpandora.org
Hi there,


I've put some effort into getting this game up and running on pandora. I did most of the GL -> GLES conversion.


(beside the control that have to be pandora adapted) There is 2 issues left :


- No textures applied ingame, so the game is in black & white shade (because of the lighting ; shouldnt be too hard to fix)


- no text :


The game is using QuesoGLC to render font. So I tried to port that lib and failed miserably (tons of glCallList).


My next step was to port warzone to FTGL as I knew this lib working on pandora (used in zaz and chromiumBSU). The change work rather well on desktop (text is a little misplaced), but still no dice on pandora


So I tried font-stash ( on some IRC suggestion) I'm guetting text upside-down on desktop and a hard freeze on pandora.


At this point I have just no idea left to get this game working.


Anyone to finish that job ?


current PND : http://sebt3.openpan.../pnd/wz2100.pnd


sources : http://sebt3.openpan...-pandora.tar.gz


use --enable-gles to enable GLES and --enable-ftgles to enable FTGL(ES) support. (there is a --enable-fontstash in my current sources but not yet in this source dump, I'll need to reup these later today)
 
Last edited by a moderator:

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,456
Location
Detroit, Michigan
Website
Visit site
- No textures applied ingame, so the game is in black & white shade (because of the lighting ; shouldnt be too hard to fix)
Why do you think lighting would effect textures? Getting white usually means the texture wasnt loaded properly and with black and white a lightmap is applied.


Edit:


I had a brief look and i found this code in tex.c could have a mismatch in texture formats. If iV_getPixelFormat(s) is 3 then GL_RGB will be returned, which is given to gluBuild2DMipmaps which expects GL_RGBA as internal format.


Maybe this is the problem.



Code:
	/* Find texture compression extension */

	if (GLEE_ARB_texture_compression)

	{

		debug(LOG_TEXTURE, "Texture compression: Yes");

		wz_texture_compression = GL_COMPRESSED_RGBA_ARB;

	}

	else

	{

		debug(LOG_TEXTURE, "Texture compression: No");

		wz_texture_compression = GL_RGBA;

	}


   	 if (maxTextureSize)

		{

			// this is a 3D texture, use texture compression

			gluBuild2DMipmaps(GL_TEXTURE_2D, wz_texture_compression, width, height, iV_getPixelFormat(s), GL_UNSIGNED_BYTE, bmp);

		}

		else

		{

			// this is an interface texture, do not use compression

			gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, width, height, iV_getPixelFormat(s), GL_UNSIGNED_BYTE, bmp);

		}


unsigned int iV_getPixelFormat(const iV_Image *image)

{

	switch (image->depth)

	{

		case 3:

			return GL_RGB;

		case 4:

			return GL_RGBA;

		default:

			debug(LOG_ERROR, "iV_getPixelFormat: Unsupported image depth: %u", image->depth);

			return GL_INVALID_ENUM;

	}

}
 
Last edited by a moderator:

Garrett

Advanced Member
Joined
Aug 24, 2011
Messages
1,255
Location
Workington, Cumbria, UK
Never heard of this before, but the videos of it look very impressive indeed (especially for something released in 1999) is there any hope that we could get this full speed, looking & sounding as good as it does in the many Youtube videos..?
 

sebt3

homebrew player (P. & C.)
Joined
Sep 9, 2008
Messages
4,747
Age
39
Location
France
Website
sebt3.openpandora.org
Why do you think lighting would effect textures? Getting white usually means the texture wasnt loaded properly and with black and white a lightmap is applied.
I explained it wrong. I was meaning the grey shading is because the lighting is working (else it would be plain color). I know lighting have nothing to do with the texture.


What you found in your EDIT is the probable cause of the texturing problem.


In the end I just not look for this problem : i'm more focused on the no-text rendered problem.
 

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,456
Location
Detroit, Michigan
Website
Visit site
Why do you think lighting would effect textures? Getting white usually means the texture wasnt loaded properly and with black and white a lightmap is applied.
I explained it wrong. I was meaning the grey shading is because the lighting is working (else it would be plain color). I know lighting have nothing to do with the texture.


What you found in your EDIT is the probable cause of the texturing problem.


In the end I just not look for this problem : i'm more focused on the no-text rendered problem.
Ok understood ;-) Im interested if hardcoding to GL_RGBA works if you have the time to test it at some point.
 

Loonie

Active Member
Joined
Apr 1, 2003
Messages
753
Oh, I was so hoping someone would start looking into porting this. Kudos to you and those who sail with you, sebt3.
 

sebt3

homebrew player (P. & C.)
Joined
Sep 9, 2008
Messages
4,747
Age
39
Location
France
Website
sebt3.openpandora.org
Uploaded a new version of the source using a modified fontstash (--enable-fontinternal to use it) It work perfectly on desktop but crash the 3d driver on pandora.


I give up :(
 

paeryn

Reclusive maniac
Joined
Nov 28, 2005
Messages
432
Age
46
Location
Sheffield, England
Website
paeryn.myby.co.uk
Hello Sebt3, sorry I've not been coding for ages, didn't help that virtualbox corrupted my dev image ages ago. This is just what I need to get back into it ;-)


Hmm, I've built it with fontstash, there's definitely something going wrong drawing the fonts as the words "Main Menu" is being drawn horizontally.


Edit: Ahh, the rotation is commented out so that's not the problem...


It seems to lock up at the first Flip as the text shows up when killing the process. It doesn't lock up if there are no fonts though, that looks to be the first area to investigate.


It's taken so long to get it compiled I've not had much time to debug, will look into it later when my pandora has charged up (cable is not long enough to have it next to my pc when charging).


Edit 2:


I've just upgraded to SuperZaxxon Beta 5 and the freezing when drawing text is no longer happening!


Now to look into why the terrain textures are missing.
 
Last edited by a moderator:

EvilDragon

Administrator
Staff member
Joined
Mar 4, 2003
Messages
29,281
Age
42
Location
Ingolstadt
Yes, Beta 5 got an updated 3D driver that should be a lot more stable.


Seems like that did the trick :)
 

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,456
Location
Detroit, Michigan
Website
Visit site
Edit 2:


I've just upgraded to SuperZaxxon Beta 5 and the freezing when drawing text is no longer happening!


Now to look into why the terrain textures are missing.
I think it still texture format, i think i gave slightly incorrect info. I would try this:



Code:
gluBuild2DMipmaps(GL_TEXTURE_2D, iV_getPixelFormat(s), width, height, iV_getPixelFormat(s), GL_UNSIGNED_BYTE, bmp);
 

paeryn

Reclusive maniac
Joined
Nov 28, 2005
Messages
432
Age
46
Location
Sheffield, England
Website
paeryn.myby.co.uk
I've solved the terrain texture problem (sort of).


It's down to how it handles mipmaps for the terrain, for all other textures it uses gluBuildMipmaps to generate them but for the terrain it loads upto 4 different levels itself. This works on normal GL as you can choose how many levels you want, but with GLES you have to have the full pyramid (all levels down to 1x1) or the texture won't show.


My current workaround is to disable mipmapping for the terrain. What it really needs is auto generation of the missing mipmap levels, I'll code that later, this was just to test if that was all that was causing it.


In display3d.c: line 956



Code:
    // Draw all the normal tiles

    pie_SetAlphaTest(false);

    pie_SetFogStatus(true);

    pie_SetTexturePage(terrainPage);

    pie_SetRendMode(REND_ALPHA_TEX);

#ifdef HAVE_GLES

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

#endif
line 1073:

Code:
    pie_SetDepthOffset(0.0f);

#ifdef HAVE_GLES

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

#endif

    pie_SetRendMode(REND_GOURAUD_TEX);

    pie_SetAlphaTest(true);

    pie_TranslateTextureEnd();


And don't load the mipmap levels in texture.c: line 196

Code:
    /* Now load the actual tiles */


    i = mipmap_max; // i is used to keep track of the tile dimensions

#ifndef HAVE_GLES

    for (j = 0; j < mipmap_levels; j++)

#else

    j = 0;

#endif
 
Last edited by a moderator:

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,456
Location
Detroit, Michigan
Website
Visit site
My current workaround is to disable mipmapping for the terrain. What it really needs is auto generation of the missing mipmap levels, I'll code that later, this was just to test if that was all that was causing it.
Why not generate them all automatically then:



Code:
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE );
 

paeryn

Reclusive maniac
Joined
Nov 28, 2005
Messages
432
Age
46
Location
Sheffield, England
Website
paeryn.myby.co.uk
Why not generate them all automatically then:



Code:
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE );
<slaps forehead with hand>


Because it was 4am and I was tired. -_- We just need to set this when loading the lowest level of provided mipmaps (when j == mipmap_levels-1).


Shadows are next on the list as they appear in the wrong place (looks like a scaling issue).


Update:


Finally figured out the shadow problem, the depth buffer wasn't set to be used at the start of each frame, which was causing objects to be overdrawing each other too. I wonder if Sebt3 accidentally deleted a line that sets it somewhere.


It's still too slow to play. Between 6 and 14 fps with the Pandora clocked at 800MHz.


I can't upload the whole source tree or pnd as my ISP doesn't give me enough space, but here are the lib/ and src/ directories, copy them over the ones from Sebt3's warzone2100-2.3.9-pandora.tar.gz (link in first post) and you should be able to compile. http://paeryn.myby.co.uk/pandora/wz2100src.tar.bz2
 
Last edited by a moderator:

sebt3

homebrew player (P. & C.)
Joined
Sep 9, 2008
Messages
4,747
Age
39
Location
France
Website
sebt3.openpandora.org
Update:


Finally figured out the shadow problem, the depth buffer wasn't set to be used at the start of each frame, which was causing objects to be overdrawing each other too. I wonder if Sebt3 accidentally deleted a line that sets it somewhere.


It's still too slow to play. Between 6 and 14 fps with the Pandora clocked at 800MHz.


I can't upload the whole source tree or pnd as my ISP doesn't give me enough space, but here are the lib/ and src/ directories, copy them over the ones from Sebt3's warzone2100-2.3.9-pandora.tar.gz (link in first post) and you should be able to compile. http://paeryn.myby.c...2100src.tar.bz2
Awesome news man !


I just build a PND out of your works !


http://repo.openpandora.org/?page=detail&app=wz2100
 

bzar

A Commando
Joined
Sep 22, 2008
Messages
4,448
Location
Finland
Website
Visit site
Downloaded :) . Testing now.


EDIT: Commented from latest PNDManager beta :p
 
Last edited by a moderator:
Top