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 / Feeling anxious about DGDK.NET

Author
Message
thierry st malo
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 19th Feb 2007 15:47
On January 22nd 2007, almost a month ago, in a post named "Next release of DGDK.NET", I was writing:

"So far, I have stumbled on three problem areas in DGDK.NET:
- Object picking,
- 4D vectors and matrices handling,
- Terrain generation.
May I hope that these problems will be fixed in the next release and when?"

I received a reply beginning with "They will be ". So when I heard about 1.0.8, I downloaded it eagerly, uninstalled the previous one, dereferenced my VB Express project, cleaned up the registry with an ad hoc software, installed 1.0.8, rereferenced my project and started to test. To my dismay, it seems that no progress at all has been made in these three problem areas, which in my opinion are major ones for any game-oriented software.

As far as I can see, the situation is still the following:

-The odB3D.PickObject procedure won't work with imported DirectX or .3DS objects; it always returns 0.
-Although I do have the maths to write my own picking routine, I can't, as the management of 4D vectors and matrices appears to be faulty.
-Any attempt to create terrain from a heightmap will immediately crash the application ("trying to access protected memory").

I'm really getting edgy, as my project has now been stopped for nearly a month

Am I missing a point in the DGDK.NET upgrade process? Is there something that I could or should do? Can anybody help?
In the meantime I can only repeat my question: "May I hope that these problems will be fixed in the next release and when?"

Thierry
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Feb 2007 17:23 Edited at: 19th Feb 2007 17:23
I can say that dbPickObject works for .x and .dbo files with the latest DGDK here.

4D maths commands seem to work too with DGDK.

I haven't experimented very much with terrains, and I have seen them crashing, but terrain from the shader water example loads and runs well, so I can't say that they do not work.

Maybe these are specific .net issues.

I agree with you that they are needed to complete many kinds of projects.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 19th Feb 2007 18:05
Quote: "The odB3D.PickObject procedure won't work with imported DirectX or .3DS objects; it always returns 0."


This is not accurate. I have been developing an experimental game engine which makes heavy use of PickObject and have been testing on x files created in AC3D, and native 3ds files created in studio max r3.1 and pick object works fine for both, and Apex even introduced the PickLimb command from Dimitry's DKShop plugin which he was kind enough to let apex port for dgdk.net, and picklimb is fine as well.

I suspect you are not implementing PickObject correctly. Regarding the other issues you mentioned, I cant directly comment on those. I would suspect at this early juncture in dgdk.net's life, possible weird problems may arise, and may not be fixed so quickly. Having said that, Paul is usually very quick with making fixes. Let's see what he says.

Michael Moore needs this film:Aaron Russo's America: Freedom To Fascism
RonPaul'08
thierry st malo
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 19th Feb 2007 18:56
Thanks to you both. It seems that I am missing one or two points, which is reassuring in a way.
Morcilla, can you tell me what version of the .NET framework you are using? As I use VB Express, mine is at least 2.0, soon to be 3.0 when I will upgrade VB Express to SP1.
CattleRustler, I can guarantee that this is accurate for me; besides, PickObject's syntax seems straightforward enough. However, I am quite willing to admit that I am doing something wrong. So, where can I find a sample piece of code using PickObject? I would need the source code and the executable. Whatever the language, I can read it.
Finally, let me be clear: I am not criticizing anybody, I just want to sort out my problems as soon as possible
Thierry
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 19th Feb 2007 19:56 Edited at: 19th Feb 2007 20:08
Quote: "CattleRustler, I can guarantee that this is accurate for me;"

Yes, I believe you I should have said that its working for me. I am using VS 2005 Professional with .NET 2.0 and all windows XPPro/SP2 updates. I cant send my code or exe but here is a sample of how I am calling PickObject

I have a global var iPO as Integer, inside Module Main, then inside of Sub Main, in the main loop I have:



The only thing I can think of is you may not be setting the object range, or the variable passed in as the max obj num value is zero when you dont expect it to be, or is it possible your camera is consumed inside of an object? (even though that shouldnt produce a 0 return), just curious.

Michael Moore needs this film:Aaron Russo's America: Freedom To Fascism
RonPaul'08
Miguel Melo
18
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 19th Feb 2007 20:27
Quote: "Morcilla, can you tell me what version of the .NET framework you are using"


I suspect Manuel (Morcilla), like me, is only using the unmanaged/classic/C++ DGDK, not the .Net version so this doesn't really apply.

I have vague plans for World Domination
Zumwalt
17
Years of Service
User Offline
Joined: 1st Feb 2007
Location: Tampa, FL
Posted: 19th Feb 2007 21:00 Edited at: 19th Feb 2007 22:02
If you are using the VB.Net version of Visual Studio, this does the trick for me, (just added a little to CattleRustler's code for simplicity without posting my huge object code)



I think what you need to understand (which you probably already do know this so ignore me if you do), the return result is the number of the mesh (meshID) as it is stored in the collection.

There is a 'bug' in that you can create a meshObject at 0. Just make sure that when you create your mesh objects, you start at 1 for your collection since 0 is used as an empty object.

I make a call to that function in my game loop and it returns to me the meshObject ID, so then by knowing this number, I can manipulate the object (trigger animation for opening a chest, trigger zoning for buildings, trigger battle sequences, what ever).

Hope this helps.

EDIT:
Some more code with this in action changing from wireframe to non-wireframe mesh using vb.net, mind you, this could probably be more optimized, but it kind of shows you the results.
(I realize I am new around here, so I appologize if this is mundain and noobish code)

(second edit
This is the optimized version of that code which determines if your mouse is down or not, the thing is, typically, you only want a single click returned, not a mess. So this flags whether or not your mouse is being held down or not, well, in essance anyway. I figured I would go ahead and share this because it is handy.
thierry st malo
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 20th Feb 2007 08:03
I can see that there is a difference between your code and mine. You are using the screen coordinates supplied by oDBInput, while I am using the coordinates supplied in the Windows event. They may be different, although I can't see why. I'll work on this, anyway. Thanks for your help.
But I'm still curious to see what Paul will tell us.
Thierry

P.S: I have an idea (it happens to me sometimes):
Suppose that 1 is an object, 2 is a camera (why not?) and 3 is again an object. I click on 3 to pick it and say

N = oDB3D.PickObject(X, Y, 1, 3)

Will PickObject abort its internal loop at 2 and return 0 because 2 is not an object?
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 20th Feb 2007 11:38
Quote: "there is a difference between your code and mine"


Maybe you should post some sample code (not just a line) for each issue and show the way you are using the commands, so there would be no doubt about if they are bugs or not.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Feb 2007 12:01
thierry

the cameras array and the 3d object collection are not part of the same groups, and are in different namespaces, so no, I dont think that would be the case.

Michael Moore needs this film:Aaron Russo's America: Freedom To Fascism
RonPaul'08
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 20th Feb 2007 12:07
thierry st malo, I will get around to answering your questions, so I apologise for not responding sooner. I'm doing some investigations with regards to PickObject because if you're rendering to a window that isn't full screen, the Input mouse co-ordinates are going to be based on Physical screen co-ordinates. This is technically the wrong values to pass into PickObject. Another chap I know has already been over this issue before and resolved it quite nicely with a piece of code, but I'm waiting on reply from him before I can post any further information.

As for the Terrain heightmap issue, can you post me a small piece of code that demonstrates this problem so that I can determine if it's a DGDK.NET terrain init problem. Can you also be sure that you call oDBTerrain.SetupTerrain() BEFORE doing anything else with the terrain functions. Thanks .

Paul.

Zumwalt
17
Years of Service
User Offline
Joined: 1st Feb 2007
Location: Tampa, FL
Posted: 20th Feb 2007 14:51 Edited at: 20th Feb 2007 15:08
Actually, when you use the oDBInput.MouseX and oDBInput.MouseY, the pickobject gets the object based on the mousex and Y in the window, regardless of window position, I have tested this.

Using oDB3D.GetPickDistance you can limit the selection by range from camera.

The code I posted earlier in the thread will allow the pickobject to work in windowed mode, no issue. If you want to limit your return range, thats simple also.

This is what I am using (Method simplified for example):


Since my game works in meters, I want to know if the object is less than 8 meters away, or I don't want to select it (or make it selectable)

If you want to know more about the window, where it is located on the users desktop and its dimensions, you need the following code:
(part taken from MSDN, simply create yourself a new module in your vb.net and give it this information)



rcNormalPosition will contain what you are looking for, if you want to see the results of the capture, modify your game loop with this:




I see no degradation in FPS with a call to this function on every loop. Although I would recommend a timer instead or a thread that has a heartbeat attached to it to monitor your window states.

Hope this helps.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 20th Feb 2007 16:25
Just so that we're clear here, the input values do not work correctly if your window has been overridden, i.e. Not the original window created at startup.

Paul.

Zumwalt
17
Years of Service
User Offline
Joined: 1st Feb 2007
Location: Tampa, FL
Posted: 20th Feb 2007 16:47
That should become a mute point once the overrideHWND is working properly. I thought we were talking about the default window since overrideHWND has known bugs and limitations.

I also took it as the original window based on the thread where he talks about using windows events instead of built in commands. Since the windows events only knows about the 2d space.

Gets confusing translating the problem at times.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 20th Feb 2007 18:59
Quote: "overrideHWND has known bugs and limitations"


I wouldn't call it a limitation, it does exactly what the function is supposed to do, and it isn't a bug, it's just not handling message passing to the initial Window procedure, which can be worked around using an unmanaged call to GetWindowLong passing in GWL_WNDPROC. If this is used on the original window during initialization, you can use this address to forward unmanaged messages etc. Anyway, I've been through all this before in other threads.

Paul.

CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Feb 2007 19:03
Zumwalt, go code a game or something, and stop being such a "Debbie-Downer" wah wah wahhhh.

seriously.

Michael Moore needs this film:Aaron Russo's America: Freedom To Fascism
RonPaul'08
thierry st malo
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 21st Feb 2007 07:43
My, I have started something! Sorry about that.
Anyway, I'll follow Paul's advice: I'll stop my big project for the duration, and code two VB Express projects as short as possible to show what I'm experiencing (perhaps I'll also learn one or two things in the process).
I'll keep you informed. Once again, thanks for your help and the interest you're showing.
Thierry
thierry st malo
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 21st Feb 2007 17:38
I have coded my first test project.
Both in full screen and in "DB Pro windowed" modes, Pick Object works fine; the terrain routines too.
I am ashamed for the commotion, but I ask to be forgiven.
For the terrain routines, I was simply not aware of the existence of oDBTerrain.SetupTerrain (thanks for the advice, Paul) which, as far as I can see, has no equivalent in DB Pro.
For picking, I had assumed (naturally enough, I think) that the events processed in oDBInput and the like were the same chain of events as the standard Windows events managed by VB Express, but they are not! What they are exactly I don't know, but they are not the same.
So, I will now write another piece of code with a PictureBox embedded in a standard window managed by DGDK.NET, and the rest of the application (menus and buttons) managed by VB Express. I'll see if I can sort that out.
Thierry
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 21st Feb 2007 17:50
No worries thierry, glad to hear you got it working finally .

Paul.

Login to post a reply

Server time is: 2024-04-25 02:19:28
Your offset time is: 2024-04-25 02:19:28