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.

DarkBASIC Discussion / Importing limbs and positions from x file

Author
Message
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Jul 2009 19:15 Edited at: 27th Jul 2009 20:36
Hello!

I need some code to import limb numbers and positions in 3D space from an X file. I have no knowledge about X files, and I couldn't find a lot of help on the web.

Chunks Chunks is on board with my waypoint project to program the DLL in C++ to boost the speed a bit (or a lot). But he said it will be very hard for him to load the object, get the limb number and position of each limb and delete the object after storing the data. Does anyone have some code to open the X file, read in the information, get each limb number and position and close the file without having to load anything 3 dimensional?

Help from anyone is greatly appreciated!

TheComet


Make the path of your enemies easier with Waypoint Pro!
Brick Break
User Banned
Posted: 27th Jul 2009 20:22
So you're asking for the DarkBASIC code, while this guy is making the DLL in C++? Oh I get it, you want the data passed onto the DLL! Well, you can export a model from Blender and try to figure out the format. It's all plain text, with brackets and indentation. It should be no problem. However, there are multiple types of X files. Different programs export them in different ways. It would take a bit of skill.

WINNER list:
Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Jul 2009 20:40 Edited at: 27th Jul 2009 20:40
Quote: "So you're asking for the DarkBASIC code, while this guy is making the DLL in C++?"


Chunks is known to make DLL's out of DBP code. He is very good at it and said that he could manage to do it with DBC, since they are not that different.

Quote: "However, there are multiple types of X files. Different programs export them in different ways. It would take a bit of skill."


I didn't know there were different types. If there are different types, will some not work with DBC, or did Lee just program code for importing all kinds of X files?

I'll try your suggestion, although I think I may not manage it in a short time... Did you learn it that way?

TheComet


Make the path of your enemies easier with Waypoint Pro!
Brick Break
User Banned
Posted: 27th Jul 2009 20:48
DarkBASIC has support for all different types of X files. Lee was a busy man. If you want to get limb data, you will have to write a smart loader that looks for keywords, and you won't be able to import the binary X models.

WINNER list:
Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Jul 2009 23:08
@TheComet
Quote: "I need some code to import limb numbers and positions in 3D space from an X file. I have no knowledge about X files, and I couldn't find a lot of help on the web."


Why not

Load Object

and

perform checklist for object limbs

and
dim lmb(numberofobjs,maxnumberoflimbs,pos)

lmb(obj,lmb,x)=limb position x(obj,lmb)
lmb(obj,lmb,y)=limb position y(obj,lmb)
lmb(obj,lmb,z)=limb position z(obj,lmb)

If you have to do it from the X file, then you have to use old school techniques. File parsing - read/write text or binary and based on the DirectX templates in the file, output to separate files or read and calculate the information you need from the vertex/transform matrix templates inside the file.

As far as there being multiple types of X files, there are 2 as far as I know: Text and Tokenized (binary).

However, there are several templates or modules that can make up an X file. There are only a few templates that DBC can respond to.

Enjoy your day.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Jul 2009 23:22
What you suggested with loading the object will work (that is the way I did it in the DBC functions), but chunks can not use that in C++ when making the DLL.

I'll have to look into the file. Where is that website of yours with the X file exporter for Blender? Will that help me understand it a bit?

TheComet


Make the path of your enemies easier with Waypoint Pro!
Brick Break
User Banned
Posted: 27th Jul 2009 23:26
Blender comes with a DirectX exporter. Just download Blender and export a model.

WINNER list:
Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Jul 2009 23:44
@TheComet
Quote: "What you suggested with loading the object will work (that is the way I did it in the DBC functions), but chunks can not use that in C++ when making the DLL."

What is the DLL supposed to do? Would there be a benefit of moving the DBC functionality in this case to a DLL? Will your program no longer be in DarkBASIC, but in C++? Will it be a DirectX application written in C++? DBPro lends itself to access the pointers and such to objects so it's easy to get object information directly out of DBPro using C++. DBC doesn't. While the pointer information does exist, I've been scouring these forums trying to find out how to access it for DBC and have never gotten an answer or found a method. This might be the hurdle Chunks Chunks is talking about. The true benefit of a DLL call is in the speed it can perform a loop. Like manipulating graphics, or calculating multiple vertex positions or collision detection. I can't imagine that duplicating built in functionality of a single DBC command will gain much from a DLL call. So depending on your goals, it may be of no benefit to turn the finding of the limbs count and position over to a DLL.

Quote: "I'll have to look into the file. Where is that website of yours with the X file exporter for Blender? Will that help me understand it a bit?"

You'd have to decipher python then you'd have to figure out the approach for blender, then you might get how the xfile is being built.

It would be better to lookup a file type explanation:

X file format

Enjoy your day.
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 28th Jul 2009 00:00
It can`t be done in dbc because you can`t get at the data like you can in dbpro or no ones saying how .

I think this plugin could be easily made for dbpro , but very difficult for dbc , couldn`t you just provide an include file for dbc and i will make the dll for dbpro ?

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Jul 2009 00:05 Edited at: 28th Jul 2009 00:09
@ Chunks

Are you sure it is hard to do in DBC? I thought you can just call the functions in the DLL and get the return values in DBC, and that is basically it. Or am I wrong? Could you describe how the DLL works different in DBP than in DBC?

Also, the reason I don't want to #include the functions for DBC is because they are really slow. 10 enemies is the maximum you can add before the whole game slows down. There is too much processing to do.

Quote: "So depending on your goals, it may be of no benefit to turn the finding of the limbs count and position over to a DLL."


True, there may be no benefit in speed in this specific function, but this is going to be a major plug-in for DBC and DBP. The DLL is specifically designed for anyone to set up complex waypoint systems with an easy-to-use editor and functions. The loading function in the DLL compared to DBC will not be any faster, but the calculations, track tracing, blocking and forcing selections, and angle calculations will be extremely fast compared to DBC. Maybe up to 10000 times faster. Right now, I have 13 different functions finished or in progress, and that is just the start:



Anyway, it will be a pain, mainly for DBP users, to have to check where the limbs are using native commands. That's why I want it all in the DLL so it keeps it's "easy-to-use" personality.

There is one decision I have to make, and it is bugging me. The object I want to import is only to load in where each waypoint is. This is an option you can set in the file. If you don't want it, the editor will save the positions of the waypoints to the file directly, and you won't need the object. This means that I don't really need the X object part of the function anymore, except in very rare occasions. And it is these rare occasions where I will be needing it, and that is why I'm not going to dump it... But maybe I should... I really don't know...

Anyway, thanks for the link, Latch! I'll have a good look at it!

TheComet


Make the path of your enemies easier with Waypoint Pro!
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 28th Jul 2009 00:44
In a dbpro dll you can call the dbpro dlls to use the commands you want from dbpro eg: if i wanted to load an x object inside a dll i would load dbpro`s basic3d dll and use the load object command out of that , i don`t think you are able to do this in classic hence why i said it would all have to be c++ and because of this it`s a great deal of work.

also in a dbpro dll you can use the globstruct header to access all the object data , screen data , you can make it interact with directx and allsorts .

to make it work i would have to design my own memory system + my own file reading/writing and try to return all the info/data to use in classic and as latch says it prolly wouldn`t be worth it.

Don`t worry i will work something out , mabey have to change the system to not using memblocks , and use c++ classes or structs to organize the data .
chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.

Login to post a reply

Server time is: 2024-05-20 08:11:54
Your offset time is: 2024-05-20 08:11:54