Level texture problems

A miscellaneous catch-all for programming related questions
maxim
Posts: 6
Joined: 2019-03-30 16:43:25

Level texture problems

Post by maxim » 2019-04-01 11:53:49

Hello, Orf and everyone else. I am glad to see that Genesis 3D has yet another revival.
G3D was the first game engine I have used, though I wasn't competent to make anything with it back then as I was a kid and had no experience in programming.

Now to the topic.
- I tried 2 versions of the engine, v120 that can be downloaded directly from this site (released in 1999 I guess), and a newer one from github (development branch).
- I built the newer version lib and driver DLLs with Visual Studio 2017 against Windows 10 SDK and the included modern D3D SDK. I had to link d3d8.lib from DirectX 8a SDK to compile D3D drivers.
- For the old version, I've used the libraries that are packaged with the engine. I couldn't build it myself with VS2017 because of legacy dependencies on old Windows SDK and DirectX 6 SDK.
- I made a simple app that initializes the engine and loads a level (just a textured cube).

The issue:
With the newer version, textures of the bsp level are all jumbled up, no matter what driver I use. The splash screen looks normal, but the level is messed.
Screenshot_1.jpg
Screenshot_1.jpg (194.21 KiB) Viewed 21168 times
This doesn't happen if I link and include the files from the older version (v120).
Screenshot_2.jpg
Screenshot_2.jpg (150.94 KiB) Viewed 21168 times
There are some other issues, but this one is the worst.
It's a shame, because Genesis 3D looks interesting for people interested in retro software and game dev archeology (like me). E.g. it's easier to read and use than the Quake 2 engine.

Can you please help me fix this issue? I am running Windows 10 64 bit and use a pretty old graphic card, Nvidia GT 610 with the latest drivers. I can upload my code and/or compiled libraries, if they matter.

Orf
Site Admin
Posts: 16
Joined: 2019-02-16 18:47:22

Re: Level texture problems

Post by Orf » 2019-04-01 18:22:32

Hi Maxim!

It's just you and me right now; the other 5 or so members are most likely bots that got past captcha! Do you have a link to the newer version lib and driver dlls you mentioned? I'm pretty sure there's like a v1.6 around somewhere, which is probably what you're talking about but I could never find it. I'd love to be able to host it if it works though.

I'm impressed you were able to get it running at all, especially with a good frame rate. I have a pretty crazy setup here with a GTX 1080ti, 16 core Threadripper, 32gb of ram, etc.... and get .5fps in GTest with DirectX but get great framerates using the software driver. I just figured the DX implementation didn't stand the test of time.

On to your issue, it looks like the bsp is working at least; the messed up texture is angled at the top, so that points to just a texture issue.

To me this could be one of two issues.

First: There is a clear repeating pattern to the texture so it looks to me like the texture stride is off for some reason or it's pointing to the wrong spot in memory. If you compiled with a target environment of 64bit instead of 32bit, it's possible that could cause this. Pointers in a 64bit environment are, well, 64 bits, but Genesis wasn't originally coded in 64 bit so it's possible with that target set that you're cramming a 64 bit value into a 32bit hole and half the data is getting lost leading the app to point at the wrong spot in memory. So that's where I'd look first, make sure you're compiling for 32bit.

Second: If you mix and match executable code that was complied with different versions of Visual Studio (exe, lib, dll) this kind of thing could happen as there's no guarantee of binary compatibility. Genesis uses multiple dlls for the engine and its drivers. I would check to make sure all of them were compiled with the same compiler to ensure binary compatibility.

-Orf

maxim
Posts: 6
Joined: 2019-03-30 16:43:25

Re: Level texture problems

Post by maxim » 2019-04-01 19:14:27

Thanks for your reply. It's weird to find someone who uses the engine that is 20 years old.
Orf wrote: 2019-04-01 18:22:32 Do you have a link to the newer version lib and driver dlls you mentioned? I'm pretty sure there's like a v1.6 around somewhere, which is probably what you're talking about but I could never find it. I'd love to be able to host it if it works though.
I mean this one: https://github.com/RealityFactory/Genes ... ee/develop
I thought you are the repo owner, it seems you are not?
Orf wrote: 2019-04-01 18:22:32 I'm impressed you were able to get it running at all, especially with a good frame rate. I have a pretty crazy setup here with a GTX 1080ti, 16 core Threadripper, 32gb of ram, etc.... and get .5fps in GTest with DirectX but get great framerates using the software driver. I just figured the DX implementation didn't stand the test of time.
I guess it works better on older cards. The version hosted on this site runs just fine, but D3D driver is not listed.
Orf wrote: 2019-04-01 18:22:32 On to your issue, it looks like the bsp is working at least; the messed up texture is angled at the top, so that points to just a texture issue.
Yes, bsp are working, some of them. Sometimes it jsut crashes with an error in Bitmap.c file (if I remember correctly) while loading the level into the world.
Orf wrote: 2019-04-01 18:22:32 To me this could be one of two issues.

First: There is a clear repeating pattern to the texture so it looks to me like the texture stride is off for some reason or it's pointing to the wrong spot in memory. If you compiled with a target environment of 64bit instead of 32bit, it's possible that could cause this. Pointers in a 64bit environment are, well, 64 bits, but Genesis wasn't originally coded in 64 bit so it's possible with that target set that you're cramming a 64 bit value into a 32bit hole and half the data is getting lost leading the app to point at the wrong spot in memory. So that's where I'd look first, make sure you're compiling for 32bit.

Second: If you mix and match executable code that was complied with different versions of Visual Studio (exe, lib, dll) this kind of thing could happen as there's no guarantee of binary compatibility. Genesis uses multiple dlls for the engine and its drivers. I would check to make sure all of them were compiled with the same compiler to ensure binary compatibility.
Thanks for your help, but it's none of these two. I compiled the engine lib, the driver DLLs and my app with the same VS2017 compiler for the x86 target.
Moreover, I've booted Windows XP, installed MSVS 6.0 and D3D7 and 8a SDKs and compiled everything as it's still 1999.
I got the same results with the broken textures, except that on Windows XP I am able to run in fullscreen modes (while on the same hardware).

It should be noted that I am talking about the Github version. The "v120" from this site works suprisingly fine, especially under Windows XP. Regarding the binary compatibility, it's definitely not the issue, as the old Genesis 3D lib and dlls (compiled with MSVS 6.0 I guess) work without texture problems when I link them to my MSVS 2017 app in WIndows 10.

I think this has SOMETHING to do with the BSP texture implementation, because actor textures (e.g. Genesis logo) look OK. I am not competent enough to spot the problem.

P.S. that's not the original GTest on the screenshots, I just happened to call my project file like this, just to make clear.

maxim
Posts: 6
Joined: 2019-03-30 16:43:25

Re: Level texture problems

Post by maxim » 2019-04-01 19:18:10

P.P.S.
Browsing RealityFactory repos, I thought that loading the level made with a newer level editor/bsp compiler might do the trick
I'll try to compile it and test when I have time.

UPDATE: Yes, using a newer editor fixed the problem. I used the one packaged with the Reality Factory: https://www.realityfactory.info/cms/ind ... st-release

Orf
Site Admin
Posts: 16
Joined: 2019-02-16 18:47:22

Re: Level texture problems

Post by Orf » 2019-04-02 03:09:10

UPDATE: Yes, using a newer editor fixed the problem. I used the one packaged with the Reality Factory: https://www.realityfactory.info/cms/ind ... st-release
Excellent to hear! They must have changed some texture packing stuff at some point.

Post Reply