Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Can you help with 3DS loader or Resource issues (Coding)

Author
Message
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 15:07 Edited at: 18th Jun 2011 15:49
Hi.

I have reached a cross-roads with my simulator development. On the one hand I have Irrlicht, which has a number of better features than the Dark Basic Pro and GDK products.

But, Irrlicht does not have any good Nvidia PhysX implementation (Dark Physics is superb!) and it lacks the ease of Dark GDK and all of the associated other add-ons.

***
On the other hand, Dark GDK:

1. crashes when I alt/tab away and come back again

2. Simply does not handle 3ds meshes (despite the claims that are still showing on the sales pages!)

3. cannot natively handle pak or zip files (including password-protected files)

So, is there anyone out there who can help me with any of these three issues? I am willing to pay for this help. Really!

The issues above are shown in order of importance to me (issues 1 and 2 are really joint first place).

I have a good track record in the games simulator field, so this may also be a good way for any bright people to break into the industry.

Alternatively, if you can help with teh Irrlicht Nvidia PhysX issues, I'd be happy to go down that route, although sad not to use the Dark GDK libraries.

Amazing Simulation
www.amazing-forum.com
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Jun 2011 15:33
2. Have you tried the panda exporter? I have not myself, I would be interested to know if it works.

http://www.andytather.co.uk/Panda/directxmax_downloads.aspx


There are PhysX and physics solutions for Irrlicht, have you found that none of them are as good as Dark Physics?

I have considered creating a PhysX wrapper for DBPro/Irrlicht/Ogre but I'm not sure I would see a good return for the amount of time it would take to write.

Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Jun 2011 15:43 Edited at: 18th Jun 2011 15:49
Can DBP load the .3ds files? Or is it just a problem with DarkGDK?

Also, your password-zip request has nothing to do with DBP/DarkGDK as it's beyond the scope of the original product.

A few minutes of googling and I found this:

http://codeproject.com/KB/files/zip_utils.aspx

You can compile that library in and use it for password zip files. You can also use the 7zip SDK which includes superior lzma compression and also supports password protection for zip files, I think:

http://www.7-zip.org/sdk.html

Or instead of password protection you can just use a bitshift on the data or something. There are lots of solutions.

Additionally, you really REAllY shouldn't be importing a .3ds file unless you absolutely have to. The format is archaic. Use .x instead which is very well supported.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 15:48 Edited at: 18th Jun 2011 15:49
Hi Matty.

I've got 3DS Max, and I guess I can load the exporters (although I haven't done so yet) but it isn't so much the exports as the need to be able to import 3DS modles as I need to. We have purchased and created many thousands of 3ds modles over the years for our simulations (using engines such as Quest and so on).

I just haven't had time to try to set up any customer media loaders for Dark GDK. I'm sure I could, but I already work about 39.75 hours every day!

All of the Irrlicht PhysX implementations are for very old versions of Irrlicht and seem to have been abandoned in acrimony some years ago. I'd tried working on them, but they are so far away from where PhysX and Irrlicht are nowadays, that the only solution seems to be a complete rebuild.

I did release a small "water worlds" demo on my Simulator Forum a few weeks ago, that used Dark Physics and was superb. We only had positive feedback about it.

From the programmer's point of view it went like a dream. I had to fix a few odds and ends in Dark GDK first so that the Dark Physics commands worked properly but they only took a few hours over a few days. I recompiled it all, and wow!

So bottom line is Dark Physics = 8.5 out of 10. Irrlicht = 2 out of 10, if I'm generous.

I'd love to build one perfect set of libraries out of Irrlicht and Dark GDK. (dreaming..)

Amazing Simulation
www.amazing-forum.com
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Jun 2011 15:52
You're using 3dsmax? Excellent. Download the Pandasoft .x exporter:

http://andytather.co.uk/Panda/directxmax_downloads.aspx

Import your .3ds mesh into 3dsmax and export as .x.

It should import just fine now. You should also make a little program to save out the file to DBP's native .dbo format. Every 3d file loaded is converted to this so if you load it in as that format your program will start faster.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 16:02 Edited at: 18th Jun 2011 16:03
Hi Mistrel.

Thanks. I do know how to do the various exports from 3DS Studio, but I would far rather make a custom media loader that can handle things natively. Given the vast number of models we have and the formats that our graphics artists (staff and agency) create, it will be much simpler in the long run.

Also, this will let me see if there are people out there that we can give other work to. I have a score sheet full of tasks to be done!

I guess that I'm also a bit compulsive in that the specs for Dark say that it imports 3ds format, and I am unsettled that this statement is not correct. If I can arrange for it to work, I shall sleep easier.

But I don't want to come off the track here. This only one aspect of three that are very important to me, if we are to continue to go down the Dark GDK route (my preferred option, still).

Amazing Simulation
www.amazing-forum.com
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Jun 2011 16:07 Edited at: 18th Jun 2011 16:08
Did you ever see if DBP would load the .3ds file? Or is it just a DarkGDK issue? It's also possible that there is an issue with your export settings.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 16:28 Edited at: 18th Jun 2011 16:30
It's a fairly well-known issue with GDK. I believe it also affects DBPro

http://forum.thegamecreators.com/?m=forum_view&t=177162&b=22
http://forum.thegamecreators.com/?m=forum_view&t=167326&b=22

and many others.

In the first of those two links, IanM did say it was on his to-do list to fix it, but that was many months ago, and I fear that it may never get fixed.

But before we get too deep into this, I do need all three of those problems to be fixed. And I will pay people to be involved.

I am perfectly at home in the DB code, having made quite a lot of changes to the versions we use here. So integrating someone's code is not a worry. I just need someone to write the code.

Amazing Simulation
www.amazing-forum.com
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Jun 2011 16:36 Edited at: 19th Jun 2011 02:43
E-mail me a .3ds file that is crashing DarkGDK and I will have a look at it.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 16:44 Edited at: 18th Jun 2011 16:47
Hi Mistrel.

OK, thanks.

I'll have to drag it off my servers at work and make sure it's one I can allow out, so it may take a short while.

But to be honest, even if there is some problem with the file, I really do want to get the Dark GDK to import 3ds files without all of the ahassle. Every thread I've come across (and there seem to be dozens), ends up with "You need to modify it to .x or dbo".

That I can do, But it skirts around the problem which is (as acknowledged by IanM) that the DB products don't do what they are supposed to.

PS embedded in the DirectX files is a microsoft 3ds to x converter, that works fairly well, but as with with all conversions, sometimes things get lost or get mistranslated.

Amazing Simulation
www.amazing-forum.com
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Jun 2011 16:54
Quote: "embedded in the DirectX files is a microsoft 3ds to x converter"


I've just been looking for this, although the word on the web is that the panda one works better.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 17:35 Edited at: 18th Jun 2011 22:32
Hi Matty.

Isn't the Panda one "just" an exporter for 3DS Max/Studio? If so, unless you've paid the several thousands for it, you're stuck.

But, the MS one does do a good job in my experience. It can take quite a while, though, so let it run all the way.

You need the August 2007 or earlier DirectX sdk installed.

Open a command prompt (DOS Box) and navigate to
C:\Program Files\Microsoft DirectX SDK (August 2007)\Utilities\Bin\x86

Then type "meshconvert" and you'll get a list of options. You can change between a number of formats. One of the useful ones is to change from the X binary format to Text. And back again. But also 3ds and obj formats are supported.

Obviously it won't understand more recent formats, though.

I've used this as a test of the 3ds meshes I've tried to load into Dark GDK and DBPro. Also, I've imported them into Carrera, 3ds Max, 3ds Studio and Questviewer and Irrlicht. It's only DBPro and GDK that let me down.

Mistrel Sorry for the delay. I tested a 3ds file using Dark GDK and it did what it always does. It took forever, during which tme I couldn't switch away and eventually it crashed. I then had to reboot the PC. After that, my graphics had to be reset, and....

[update] I've just sent a zip file to you, with a 3ds model (the original) that loads very slowly and sometimes carshes Dark GDK. The other model in the zip is an X version, which loads just fine. It was converted by the Microsoft program (or it might have been Carrera).

Amazing Simulation
www.amazing-forum.com
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Jun 2011 22:12
@TerryRussel - Thanks for the info, I will check that out.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jun 2011 22:37 Edited at: 18th Jun 2011 22:38
This afternoon and evening, I've got really stuck into the old Irrlicht Physx stuff. I've managed to compile the libraries now and I am just working on a couple of test runs using those libraries.

I think that if I do get them working, then Irrlicht will win over the Dark products. Shame, because I love their ease of use, and I have spent so much time fixing memory leaks and missing functions and mising overloaded functions, making various add-ons work and so on.

But If I can't get anyone interested in fixing/creating the 3ds import, resource restoration and password zip file functions, I'll have to move across.

Amazing Simulation
www.amazing-forum.com
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Jun 2011 22:59
This resource restoration issue, is this when you go full screen exclusive and the user navigates away somehow?

If so then I think you may need to setup a system of loading your resources back in, in the event of that happening. I first heard of this from the appup developers group in the DBPro section so they know more than me.

If that is the solution then it is a major hassle, but I think it's a DirectX thing, not GDK.

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 18th Jun 2011 23:58 Edited at: 19th Jun 2011 00:01
http://www.zlib.net/ is one I've just started to work with now after starting with a rar lib. The rar lib worked with passworded archive fine but I've just started now with zlib so I've not tested it yet... I know there's lots of C++ libs for zip archive but zlib is free...

EDIT: Looking quickly through the manual, it doesn't look like it does passwords... I'll check out the GNU libs...

Warning! May contain Nuts!
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 00:04
Matty, yes, that's the case. Irlicht handles it wonderfully. It can carry on, unseen or can pause, but it doesn't loose the resources nor have to re-acquire them.

WLGfx, you may be a saviour here!

Amazing Simulation
www.amazing-forum.com
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 19th Jun 2011 00:41
No probs. I've had the 3ds issues myself...

I've just also come across http://www.wischik.com/lu/programmer/zip_utils.html which does handle zip passwords and it's just .h and .cpp files at the moment. (I'm suss I might need the zlib cos it might be a wrapper though).

My solution with the 3ds format at the time were to drop them and convert to another format. Objects were taking too long to load and some had holes in the faces.

The resource unloading issue I've not found a solution (or more like not looked into), If I was to fix it I would track every resource loaded and , "IF" it could be detected then allow a resource 'reload' to happen.

In windowed mode resources aren't affected. Fine for testing but not for overall benchmarking. Once fullscreen is in play you would need to track everything loaded. Although I don't know yet what gets 'un-loaded'...

Warning! May contain Nuts!
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 19th Jun 2011 02:45 Edited at: 19th Jun 2011 10:10
Import for the .3ds format has been fixed for the next version of PureGDK.

It will now solves not only your crashes from alt-tabbing but also your import problem.


Quote: "1. crashes when I alt/tab away and come back again"


Fixed for beta 7.

Quote: "2. Simply does not handle 3ds meshes (despite the claims that are still showing on the sales pages!)"


Fixed for beta 7 as well.

Quote: "3. cannot natively handle pak or zip files (including password-protected files)"


Several third-party libraries have been proposed.

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 19th Jun 2011 04:08
Out of 1, 2 and 3 it is really 1 that needs looking into.

Warning! May contain Nuts!
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 19th Jun 2011 04:20
Quote: "Out of 1, 2 and 3 it is really 1 that needs looking into."


This is fixed through D3D callbacks in PureGDK.

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 09:17 Edited at: 19th Jun 2011 10:13
Quote: "This is fixed through D3D callbacks in PureGDK"


It should be possible to replicate that in Dark GDK, then. (Sorry Mistrel, I know you're pushing Pure GDK quite justifiably, but until V5 comes out, I can't use it).

******

I had a thought (rare event) about the resources issue. If I have time today, I'll try it out.

Thought is this: I think it is possible to run it in windowed mode, where the window is the same size as the acreen resolution, and the window has no menu bar or borders. That is possible, isn't it? That might be good enough.

Perhaps...

I'm also thinking that this function would be the one to monitor and that would indicate that the resources then need to be reclaimed:

dbScreenInvalid
This command will return a one if the application has been switched out and back in.

And perhaps this one would be involved as well:
dbRestoreWindow
This command will restore the window to the original size and position.

Amazing Simulation
www.amazing-forum.com
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 19th Jun 2011 10:05 Edited at: 19th Jun 2011 10:27
Quote: "I had a thought (rare event) about the resources issue. If I have time today, I'll try it out.

Thought is this: I think it is possible to run it in windowed mode, where the window is the same size as the acreen resolution, and the window has no menu bar or borders. That is possible, isn't it? That might be good enough."


The link I posted in the other thread describes how to do just that:

http://forum.thegamecreators.com/?m=forum_view&t=177817&b=38&msg=2201413#m2201413

Quote: "
Here is an example on how to make a full screen application matching the desktop resolution:

"


You cannot capture the immediate state of the device with dbScreenInvalid. It is misleading and should be removed entirely as it serves no purpose.

See here:

http://forum.thegamecreators.com/?m=forum_view&t=185459&b=15

Quote: "Your very small test example probably isn't crashing because it's not doing anything. But add any amount of code that expects to interact with the object that no longer exists. You are guaranteed to crash if the device invalidates in the wrong place.

This type of behavior is not supported by DBP. It is not a bug.

"


If you plan on using PureGDK then I can send you the next beta but without the documentation update. There are sweeping changes to some 140 commands, primarily to add support for optional parameters.

For example, this command:

void dbLoadObject(int objectID, string fileName)

will become:

int dbLoadObject(string fileName, int objectID = -1)

So you can do something like this:

int objectID = dbLoadObject("model.x")

There are a lot of changes to core commands like this one that will require you to keep the header files open as a constant reference. Hence why I held off on these changes until the documentation release.

I don't want to scare anyone off with sweeping changes and no documentation to back it up!

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 10:20 Edited at: 19th Jun 2011 10:22
Hi Mistrel.

I'll hang on until you've done the documentation. One of the things that drives me up the wall, both with Dark Basic products and with Irrlicht is the poor and long-obsolete state of a lot of the documentation.

I've just done the "full-screen window", but I am trying to get rid of the title bar. The descriptions say that setting the style flag to zero should do that, but it doesn't! (Not on my XP machine, anyway).

Using dbSetWindowLayout(0,0,0);

I'm just poking around in the declarations to see if I am doing something wrong or if there is an error in the shared libraries or something similar.

Amazing Simulation
www.amazing-forum.com
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 19th Jun 2011 10:24 Edited at: 19th Jun 2011 10:25
Try using something like Spy++ or Winspector to identify which style flags are being used on the window then call SetWindowLongPtr to change it:

http://msdn.microsoft.com/en-us/library/ms644898(v=vs.85).aspx

TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 11:00 Edited at: 19th Jun 2011 11:02
The best style flag of the 0-4 that you can use with dbSetWindowLayout seems to be 3. But that still has the caption bar at the top.

What I've done is to dig into CGfxC.cpp, where the function is defined.

I think I can see what is happening. When Lee modified that section to add the extra layout codes, all of them set the caption bar to on. I'm going to change that (perhaps an option 5 in the style flag) that does not do that.

I'll have to recompile the Dark GDK libraries and then test it, so I may be gone some while. (opens tent flap and exits into the snow)

Amazing Simulation
www.amazing-forum.com
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 11:24 Edited at: 19th Jun 2011 11:30
Yay! Fixed it!

What I did was to modify CGfxC.cpp, to include a new style flag:

I then recompiled the display.lib and dropped it into the
C:\Program Files\The Game Creators\Dark GDK\Lib\vs9
folder. Success!

Now when I run the program, it appears to be running in full screen.

My method of calling it is here:


I think that this issue is now resolved sufficiently for my purposes.

That leaves (in order of importance to me):

a) 3DS meshes (a BIG concern for me)

b) using Zip Files as folders, and with password protection. I can actually live without this one if I have to. It's a serious "would be nice" though.

I've attached the recompiled library file, but please,please take a backup of your existing one before you overwrite it. You're on your own if anything goes wrong for you!

Amazing Simulation
www.amazing-forum.com

Attachments

Login to view attachments
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 19th Jun 2011 11:29
Quote: "You cannot capture the immediate state of the device with dbScreenInvalid. It is misleading and should be removed entirely as it serves no purpose."


What Dark Coder suggested instead, is to keep a small test cube in memory and at the end of each loop, test if the cube still exists, with dbObjectExist. If it doesn't exist, then you need to reload resources.

Quote: "I am trying to get rid of the title bar"


dbSetWindowLayout(0, 0, 0); does remove the title bar completely on my machine. Windows 7 but I remember that it behaved correctly on XP too. I don't know why it doesn't work for you.
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 11:31 Edited at: 19th Jun 2011 13:38
Hi Mireben.

See my edited post above yours. I've fixed it all now. It was a bug apparently created by Lee some while ago.

For dbScreenInvalid, I think I'd actually rather modify the function so that it works. I've found that by doing that each time I have a problem, things get much easier, rather than having to resort to lots of workarounds (good though those workarounds may be).

I think that this issue is now resolved sufficiently for my purposes.

That leaves (in order of importance to me):

a) 3DS meshes (a BIG concern for me)

b) using Zip Files as folders, and with password protection. I can actually live without this one if I have to. It's a serious "would be nice" though.

Amazing Simulation
www.amazing-forum.com
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 19th Jun 2011 12:42 Edited at: 19th Jun 2011 12:43
Quote: "What Dark Coder suggested instead, is to keep a small test cube in memory and at the end of each loop, test if the cube still exists, with dbObjectExist. If it doesn't exist, then you need to reload resources."


I don't see how this is a solution. Consider this example:



TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 19th Jun 2011 13:37 Edited at: 19th Jun 2011 16:33
Hi chaps.

It's all rather irrelevant to the solution I have created. I don't have to restore resources, since they are never lost. (Th eWindow has all the appearance of being full screen, although it isn't. An almost perfect solution!)

The only thing I need to do now is to create/use a function that detects if the window is inactive and/or minimised. (Or can return the state of each as a flag). That's pretty simple to do whether in Dark GDK or via Windows itself.

Then as part of the Game Loop, if the flags are not indicating that it is both active and maximised, the game will suspend itself until the user switches back. That means that the dbScreenInvalid function is truly irrelevant and no replacement is needed for my purposes.

And now, 3DS meshes and zip files

Amazing Simulation
www.amazing-forum.com
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 20th Jun 2011 10:10 Edited at: 20th Jun 2011 19:16
Matty H Said:
Quote: "
I have considered creating a PhysX wrapper for DBPro/Irrlicht/Ogre but I'm not sure I would see a good return for the amount of time it would take to write.
"

Matty, do you want to email me directly?

As I said above, I am willing to pay for what I need. If you can produce a set of Irrlicht/PhysX functions for me, that would solve a lot of problems.

Amazing Simulation
www.amazing-forum.com

Login to post a reply

Server time is: 2024-11-19 09:28:23
Your offset time is: 2024-11-19 09:28:23