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.

3D World Studio / 3D World Studio Loader for DarkGDK

Author
Message
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 11th Mar 2008 01:29 Edited at: 5th May 2008 01:52
The importer is now complete and available for download at the bottom of this post.

This code is released as Open Source and unsupported. As such you are free to use this code for whatever purpose and modify it to suit your needs.

Included in the zip file is the full source code and demo executable along with documentation in html format to accompany the release. I have included the Leadwerks 'Industrial Complex' level as a demonstration. Please note that all rights for this level and the associated content belongs to Leadwerks and as such should not be used in any commercial project without the express permission of the owners!

Special thanks go out to Lost In Thought for his original loader for DBPro and his help and support. Also to Tireswing for his loader classes. Thanks also to Jason for his constant support throughout this project. Full acknowledgements in the included documentation. Last but not least, thanks to the guys at TGC for giving us DarkGDK in the first place!

Have fun


Below are some screen shots from the loader:











Special thanks to James @ Cellbloc Studios for stepping in at the last minute and hosting the files for me.

Source Code + Demo (37.1Mb)
http://www.cellblocstudios.com/pixelperfect/3DWSLoaderRelease1.zip

Source Code Only (30Kb)
http://www.cellblocstudios.com/pixelperfect/3DWSLoaderRelease1CodeOnly.zip

Patch 1 (36Kb) - Adds new Entity, VisGroup and Key Data extraction functionality
http://www.cellblocstudios.com/pixelperfect/3DWSLoaderPatch1.zip

[EDIT] New Patch added

No matter how good your code is, someone will improve on it
jason p sage
10
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Mar 2008 01:54 Edited at: 11th Mar 2008 02:07
AWESOME JOB PIXEL! Thanx CellBloc!!!

[edit]Looks Great!, 3000+ Objects...gosh Frustrum Culling Seems to be in there. (not looked at code yet) Awesome Work![/edit]

Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 11th Mar 2008 02:04
Thanks Jason ... hope you find it useful

No matter how good your code is, someone will improve on it
jason p sage
10
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Mar 2008 02:08
Niels Henriksen
12
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 11th Mar 2008 12:55
*speachless*

I will look in the code... maybe it can be transfered to .NET also...

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine (thanks kBessa): www.tales-of-the-realms.com
FINN MAN
13
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 11th Mar 2008 13:44
Reality Forgotten
11
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Del Rio, Texas
Posted: 11th Mar 2008 14:50
I have a dumb question, I do not know much about DarkGDK so this may sound really retarded.

Is there a way that this can be used with DBPro?

Great work by the way!

Cheers,
Dave


Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 11th Mar 2008 15:08
Thanks for the comments guys!

@Reality Forgotten - it's never dumb to ask questions if your not sure imho

Quote: "Is there a way that this can be used with DBPro? "


This release is for the C++ version of DGDK so unfortunately it wont work with DBPro. However, it was based on Lost In Thoughts loader for DBPro which is available on the following link:

http://forum.thegamecreators.com/?m=forum_view&t=100900&b=13

My version has moved on somewhat from LIT's version and has some enhancements and bug fixes. The main difference being the ability to display the colour pretty much as seen in the 3DWS editor. If I get the time in the future I might update LIT's code to incorporate my additions and fixes and release that, but as I have spent just over two months working on this one I currently need a bit of a break!

No matter how good your code is, someone will improve on it
Reality Forgotten
11
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Del Rio, Texas
Posted: 11th Mar 2008 15:19
Thanks for the fast response mate. I hope you do get around to updating LIT's code. I hate owning a program that I can not really use as efficiently as I should be able to. I had created a tomb walk through 2 years ago but the problem I was running in to was collision. I think that was due to how I had it set up.

Keep up the great work man!

Cheers,
Dave


sigi
13
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 11th Mar 2008 16:12
This is great work, Thank You

AMD Athlon64 X2 4600 / 3 GH Ram / Geforce 8800 GTS-640MB / WinXP Home SP2 / Vista 64bit
peterJBE
9
Years of Service
User Offline
Joined: 11th Mar 2008
Location: Belgium
Posted: 11th Mar 2008 21:02
This looks really great.
Thank you!
Miguel Melo
11
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 12th Mar 2008 00:00
This looks sweet - many thanks!

I have vague plans for World Domination
Usukhuu
9
Years of Service
User Offline
Joined: 10th Jan 2008
Location:
Posted: 12th Mar 2008 13:11
wow !!! Good job
the nameless
9
Years of Service
User Offline
Joined: 7th Mar 2008
Location: Hell
Posted: 14th Mar 2008 17:38
WOW! Thanks a lot! Appreciated!!!
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 14th Mar 2008 21:30
Thanks again for the positive comments guys ... hope you all find the code useful.

I'll be starting to integrate it into my game engine this weekend. Just planning out how it's going to fit in with my existing game engine classes. There's going to be few changes required to accomodate it effectively!

No matter how good your code is, someone will improve on it
JulesD
12
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 15th Mar 2008 20:27
In the loader there are 2 tires near each other and a chair, both tires are floating in the air and the chair is embedded into the ground is that normal? How can I get a screen shot of this?
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 16th Mar 2008 13:01
Hi JulesD. I suggest you load the complex.3dw file into 3D World Studio. When I do that the tire is floating in the air and the chair is embedded in the ground. Not exactly normal but then I didn't design the level!

The only problem I have found with the rendition of the Industrial Complex level in all my testing is that there is a tire that appears in the sheds which is rotated through the shed wall. I have never managed to track this bug down, it appears to be the only mesh object this occurs on. If you feel you could fix this then I'm sure the community would be very grateful.

No matter how good your code is, someone will improve on it
BigMax
13
Years of Service
User Offline
Joined: 12th Sep 2003
Location:
Posted: 18th Mar 2008 19:45
Hello Pixel Perfect,

great work!!!

Only 1 question, for convert sft file to png?

Thanks.
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 19th Mar 2008 00:22
Thanks BigMax

Quote: "Only 1 question, for convert sft file to png?"


I don't currently know of any converter to convert the leadwerks stf files to any other standard file format.

To convert the 'Industrial Complex' textures, for the demo included with the loader, I simply displayed them in Leadwerks own Image Viewer, took a screen shot and then converted them to png format using Adobe Photoshop. Slow but it worked quite well!

No matter how good your code is, someone will improve on it
BigMax
13
Years of Service
User Offline
Joined: 12th Sep 2003
Location:
Posted: 19th Mar 2008 09:27
Thanks Pixel Perfect,

Simple and effective.
Anonymous User
9
Years of Service
User Offline
Joined: 21st Feb 2008
Location:
Posted: 24th Mar 2008 17:21
Pixel Perfect: Whenever I replace the .stf textures with .jpg ones they appear fine in 3DWS but really bright in GDK or DBPro

???
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 24th Mar 2008 19:17
Unless you're using my loader this is off topic for this thread. If you want to start a new thread and give me some more info on how you're exporting your levels from 3DWS / loading them in DBPro etc then I'll quite happily look at it.

No matter how good your code is, someone will improve on it
BatVink
Moderator
14
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Apr 2008 17:32
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 2nd Apr 2008 10:27
Thanks for the Newsletter feature guys.

I would like to remind everyone again of the major contributions made by both 'Lost In Thought' and 'Tireswing' to this project without which it would not have been possible. My thanks to them.

No matter how good your code is, someone will improve on it
bergice
10
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 2nd Apr 2008 15:56
What excactly does this do?
Good looking level btw
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 2nd Apr 2008 20:52
Essentially it's the code to load 3D World Studio native .3DW files directly into DarkGDK (C++ version) without the need to export them to some other format.

Some of the advantages are as follows:

Allows access to all of the 3DWS entity, key and group information allowing you to easily drive your game engine from information and objects embedded in your level.

Supports a mode where all the level items are created as individual objects allowing use of blending modes, which are not available to the multi-limbed DBO exports, resulting in a much brighter rendition of the level closely matching that seen in the 3DWS editor.

This mode also enables the in-built frustum culling in the Dark Basic engine which only appears to work on single limbed objects.

People requiring a single collision object for physics engines etc can simply export the level from 3DWS as a DBO file and use that as the collision object whilst loading the game level from the .3DW file to gain the advantages that provides.
Conversely, you could simply modify the loader code to produce a single multi-limbed object as well, removing the necessity for the additional DBO file. Using this mode you could control via embedded information in your level which objects are enabled for collision and which are not.

Although the code is released as a stand alone loader that's really just to demo it. It is really designed to be integrated into your game engine and tweaked as required to provide the functionality you are looking for.

The loader comes complete with some basic but hopefully informative documentation in HTML format.

No matter how good your code is, someone will improve on it
JulesD
12
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 4th Apr 2008 08:10
I can't seem to load a sphere object and map with texture with this 3DWS loader. The sphere and texture maps work in DarkBasicPro.

Could someone please update the code to show how to use the 3DWS Loader and load a character with animation in front of you. Also have DarkPhysics applied to the terrain with a control box hidden and move your character around.

Please.
Leadwerks
9
Years of Service
User Offline
Joined: 29th Jan 2008
Location:
Posted: 4th Apr 2008 08:45
Awesome!
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 4th Apr 2008 15:01
Thanks Josh

No matter how good your code is, someone will improve on it
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 4th Apr 2008 15:22
@JulesD

Sorry Jules I'm not meaning to sound harsh but the loader is not designed to be a game engine in it's self but to be integrated into existing game engines or act as a starting point for game engine design.

The code is not trivial and you need to be reasonably well versed in C++ and DarkGDK to integrate it successfully and use it to its full potential. I would suggest that if you don't currently know how to do the things you are asking for then you are probably not ready to take that step.

If you need help in simply loading your level using my loader then start a new thread and show me what code your currently using to do so, maybe attach the level too so I can check it loads ok.

With regard to the rest, I doubt someone is going to do that for you. Better to start small with your own code and learn how to get each bit working individually so you really understand how it's all working. If you’re having problems with any individual bit post specific questions in the relevant forums to get help. Most people will gladly help you out here, but they are not going to build your game engine for you!

No matter how good your code is, someone will improve on it
JulesD
12
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 4th Apr 2008 22:43 Edited at: 4th Apr 2008 22:45
Well, I tried, thanks any ways, I might just go back to DarkBasicPro for now since I have most of the plugin's for that and programming in basic is so much easier.
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 5th Apr 2008 01:16
@JulesD

I wouldn't give up on DarkGDK, it takes more work to get into C++ programming initially but it's well worth it in the end.

With regard to getting your level up and running in my loader ...

The following line of code is all you should need to edit in main.cpp file in order to load your level:

+ Code Snippet

substituting the name of your level for 'complex'

Ensure you place your level.3dw file in the same directory you unziped my loader code to (should already have the complex.3dw file in there).

Then place any of the model and texture files used in your level in the 'media' directory. Note: models need to be in DirectX .X format and texture files in either png, tga, bmp or jpg.
Anyone wanting to add additional supported formats can do so by amending the C3DWScene::findMaterial procedure in 3DWScene.cpp

Rebuild the code and run it and your level should load.

No matter how good your code is, someone will improve on it
mouness
9
Years of Service
User Offline
Joined: 21st Mar 2008
Location:
Posted: 18th Apr 2008 06:55 Edited at: 18th Apr 2008 06:58
Thanks Pixel Perfect..
i would like ask u question. how i can access any object in level.3dw for example make tire move or dynamic.i write in darkgdk :
dbLoadObject("objectName",objectID);
dbMoveObject(objectID,5);
i should know object id for tire to access it:
Quote: "Allows access to all of the Entity, Key and VisGroup Information"
:.how??
thanks for helping its great works(3dw loader)
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 18th Apr 2008 12:26
Thanks mouness.

Here are two ways to add animated or dynamic characters or objects to your level.

1.
Use entities as starting placeholders within 3DWS and have your game engine code read these and load and position the objects.
In this case you will already know the object IDs you just need to retrieve the starting position and any other information you might store against them. Most people I think tend to follow this route.

2.
Place these objects directly in your 3DWS scene ready to be manipulated by your game engine. If choosing this route then you need to label your objects in some meaningful way within 3DWS so this information can be used to retrieve the object IDs my loader ties the objects to. This should work fine too, but I would suggest that you don’t load animated objects this way as I don't guarantee my loader will handle them properly.


There is another option if you are applying physics to objects to enable a dynamic environment. That is to simply label (use keys) which objects are to have physics applied and the type (static, dynamic etc) in your 3DWS level and alter the loader code to read these as it loads the objects and apply the physics.

For instance … say you wanted to have the majority of your level as a static collision object. You could simply label each item you don’t wish to have collision on as say ‘NO COLL’ and alter my loader to build a separate additional object for the collision level in which it adds every object which isn’t labelled ‘NO COLL’ as a limb. That way you end up with a single multi-limbed object representing your collision level and you can apply that as your physics static collision object.

As I have stated before, the code I released is designed really as a starting point for people to manipulate and extend it to suit their own requirements.

I haven’t got the time at the moment to detail exactly the function calls you need to make within my code to retrieve entity, key and group information but can assure you the functions to return this information are all there as member functions of the appropriate classes.

I will, however, prepare some advice and examples and post them here as soon as I can. I know this is something that many people would find helpful.

No matter how good your code is, someone will improve on it
mouness
9
Years of Service
User Offline
Joined: 21st Mar 2008
Location:
Posted: 19th Apr 2008 03:58
thanks again pixel prefect
iam wating for advice and examples
mouness
9
Years of Service
User Offline
Joined: 21st Mar 2008
Location:
Posted: 21st Apr 2008 11:26 Edited at: 21st Apr 2008 11:27
Pixel Perfect !!!!1
when i need to make shaper it does not exist and i didnt see it in the world
why
?
dbMakeObjectSphere( 222,20 );
dbColorObject( 222,dbRgb(0,200,0) );
dbPositionObject( 222,0,200,0 );

but when i do this
c3dw.createTerrains();
//c3dw.createBrushes();
//c3dw.createMeshes();
i see th shaper.
please help me
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 21st Apr 2008 20:53
@mouness

Quote: "when i need to make shaper it does not exist and i didnt see it in the world
why"


hmmm ... well this could be down to quite a few things but first and foremost:

What 3DWS level are you loading?

or more to the point:

How many objects are being created in the level you are loading and is it more than 222?

You need to ensure that the object ID you use for your new object does not conflict with IDs already used by the loader or else you'll run into all sorts of problems. You can see the number of objects loaded displayed on the screen as 'Total Objs'.

I tried adding your object code using the 'complex' level that came with the demo and changed the objectID to 5000 which was well out of range of the ones used by the loader as follows:

+ Code Snippet

This worked fine and displayed your green sphere just to the side of the crate next to the starting location.

Ideally, any further objects generated by you need to continue using the same objectID sequence used by the loader. The easiest way to do this is to create a variable, say ObjID, and assign it the last objectID value used by the loader as follows:

+ Code Snippet

Then use this for your objects incrementing the count each time.

Hope this helps.

No matter how good your code is, someone will improve on it
mouness
9
Years of Service
User Offline
Joined: 21st Mar 2008
Location:
Posted: 21st Apr 2008 21:41 Edited at: 21st Apr 2008 21:42
Thanks again Pixel Perfect its work good.nice work but if i want to make Collision work in my world i use this code
for (int i = 1;i<TotalObjs;i++ )
{
//dbShowObjectBounds(i);
dbPhyMakeRigidBodyStaticMesh(i);
//SC_SetupObject(i,3,0);
}
its work good.but i have some problems. so is their another way to access Objects in the my world to applay Collision to it????
thanks..
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 21st Apr 2008 22:50
This thread should really be reserved for questions or comments on the 3DWS Loader but seeing that you asked:

You'll see people throughout these forums refering to sparkys collision. It's the best out there but a little more complex than just applying static meshes in a physics engine. But worth the time investing in learning to use it.

You'll find endless help throughout these forums by searching for sparky

From your code above looks like you might already have it.

If not, or for anyone else who's interested, get sparkys collision here:

http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

ps I'll get some notes written up on accessing Entity, Group and Key data as soon as I've got some spare time .. I've not forgotten!

No matter how good your code is, someone will improve on it
mouness
9
Years of Service
User Offline
Joined: 21st Mar 2008
Location:
Posted: 22nd Apr 2008 00:15
Quote: "ps I'll get some notes written up on accessing Entity, Group and Key data as soon as I've got some spare time .. I've not forgotten!"

ok.thanks i will wait
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 23rd Apr 2008 01:00
Have looked at the support for entity data in the loader tonight and decided it could be improved to make it easier for people to access this infomation.

I'm thinking of providing some new functions to the C3DWScene class as follows:

// Return the number of entities
int getEntityCount(void);

// Return a string containing the data for the Entity entry
string getEntityData(int index);

// Return a pointer to the vector containing the Entity data strings for those wanting to manipulate this directly
vector<string>* getEntityDataVector(void);

The format of each Entity String would be as follows:

"classname:value|keyName1:value|keyName2:value|keyName3|value ...etc"

The functionality behind this would be encapsulated in the C3DWScene class leaving it up to the user to extract the classname and key values from the strings.

I'm also going to review Group info and Key info associated with objects. It might be nice to provide a similar set of functions for linking internally assigned ObjectIDs to Group Names, Class Names and Key Data allowing easy identification of objectIDs from Data embedded in them in 3DWS.

If anyone has any comments regarding this now might be a good time

No matter how good your code is, someone will improve on it
jason p sage
10
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Apr 2008 02:25
"classname:value|keyName1:value|keyName2:value|keyName3|value ...etc"


This looked like you might of typed it quickly. The last Value seems to be itself... all alone and sad LOL... I think you just typed fast and meant to write a clean pipe separated "Name=Value" Pairs.

Otherwise - adding functionality to give meta data information about loaded and instantiated objects, groups of them - whatever (Haven't dug in yet - not ready.. working on that gui...) anyways... This is always a great idea. The more stats the better Good way to self check too.. like maybe there are stats in 3dws.. and being able to verify that the stats match up - means nothing was lost

Good job though! thanx for posting you intent to give us a chance to shout at ya!

Thanx Pixel Perfect.

Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 23rd Apr 2008 10:43
Quote: "I think you just typed fast and meant to write a clean pipe separated "Name=Value" Pairs."


yeah ... well spotted Jason ... it was late lol

Quote: "thanx for posting you intent to give us a chance to shout at ya"


Yeah thanks, it is really just a chance for people to express any preferences or suggestions as to how the data could be presented. It's currently embedded into the relevant classes in various data structures and is accessable but parhaps not as obvious for those not well versed in OOP. I'm trying to think of ways to make the data more accessable for beginners.

Entities are essential data items as they tend to be used as placement markers where users need to extract the positional information and any associated data. Could be anything from lights, particle emitters to placement positions for NPCs etc.

Likewise, people may use key values to embed game related data into their level objects even if its just object labels so they can then retrieve the internal ObjectID my loader assigned them for dynamic manipulation (this is what mouness is looking for in his previous post).

Thanks for the shout anyway Jason ... hope that GUI is coming along nicely ... mine has currently got put on hold whilst exploring dynamic lighting and trying to sort this out!

No matter how good your code is, someone will improve on it
jason p sage
10
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Apr 2008 13:46
Sounds neat. Thanx for the encouragement.

Anyway, I have these homebrew linked lists and dynamic array classes I wrote. They might be useful for stuffing the name value pairs in. I could write a little demo of how to use them so you wouldn't have to give it much thought if you want.

Let me know (Keeps dependancies down)

Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 23rd Apr 2008 15:29
Thanks Jason ... I'll bare that in mind.

The dilema I have at the moment is wanting to provide easy access for people not wanting to jump into the code at the deep end but still keeping it reasonably efficient.

All of the data is currently nicely dis-assembled within the class data members and it seems a retrospective step to re-assemble it just to have people dis-assemble it again!

Might be that returning a two dimensional array containing the paired data might be the way to go. There are quite a few different scenarios depending on what people are looking to do.

For instance ... someone wanting to place a specific NPC or the main characters starting point might want to search for that individual entity by providing the entity name and having the function return a match with the position data.

Others might want to simply return all the light type entities so they can position real lights in the game in which case they are less concerned with individual targeting but more with returning groups of like data.

I think I need to think this out a bit more and play around with some real examples before I make a decision on how the final interface is presented to the user.

Thanks for your input. Anyone else wishing to comment or forward suggestions would be welcome too.

It's hard to predict exactly how people might choose to use this.

No matter how good your code is, someone will improve on it
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 23rd Apr 2008 23:23 Edited at: 23rd Apr 2008 23:29
OK, here's my latest thinking on accessing Entity data:

1. Generic Entity Functions

a). Function to return total number of Entities
b). Function to return the number of data items for a given Entity Number
c). Function to return a vector<string>* containing all of the data for a given Entity Number

The vector<string> object returned for the given Entity Number would consist of a set format. For example:

Entry Number . Content
-------------------------------

0 ..................... Entity ClassName
1 ..................... x Position
2 ..................... y Position
3 ..................... z Position
4 ..................... Key1 Name
5 ..................... Key1 Value
6 ..................... Key2 Name
7 ..................... Key2 Value
.....
.....
n ..................... Keyn Name
n+1 ................. Keyn Value


2. Specific Entity Functions

a). Function to return total number of Entities matching a given Entity Classname
b). Function to return a vector<int>* of Entity Numbers for a given Entity ClassName
c). Function to return total number of Entities matching a given Entity Classname and KeyName Value
d). Function to return a vector<int>* of Entity Numbers for a given Entity ClassName and KeyName Value

The function 1c could then be used to return the targeted Entity data.

I think this would give a good degree of flexability whilst keeping everything reasonably simple.
The vectors cound be accessed using standard index notation making it easy to extract the required data without more complicated string type extraction routines as I was advocating earlier.

I have most of the code written to do this so I'll play around a bit tonight and see if it looks practical.

No matter how good your code is, someone will improve on it
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 25th Apr 2008 20:40 Edited at: 25th Apr 2008 20:41
Seems to work well, here's an example of the code to extract an Entity's data, in this case Entity 0:



As specified in the previous post there will be functions to search for specific target Entities too by Classname and named Key value. Don't think I can really make it any easier!

Anyone wanting to implement faster more efficient extraction of Entity data can of course dive into the code and code their own!

No matter how good your code is, someone will improve on it
jason p sage
10
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Apr 2008 01:31
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 26th Apr 2008 12:02
Cheers Jason.

I'm currently pressing on and coding a similar mechanism for the objects so people can search on Key and VisGroup values and get back the matching internal objectIDs assigned by the loader.

Once I'm happy this is up and working ok I'll post a new release with some additional notes.

No matter how good your code is, someone will improve on it
Pixel Perfect
10
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 29th Apr 2008 01:43
I now have all the functions written and tested and it's looking good.

I did some timing trials for returning objectIDs against against three search criteria (classname, keyName and keyValue). Using the complex level which builds a search list of 6031 entries I conducted two seperate searches which returned 462 and 2031 items respectively. Both return in less than 1 mS which seems quite fast enough for me concidering it's an extremely simple sequential search system with no indecies.

As a result I have only to tidy up the code a little and write some notes on using the new functions before releasing the new code hopefully by the end of the week.

No matter how good your code is, someone will improve on it

Login to post a reply

Server time is: 2017-06-25 09:49:58
Your offset time is: 2017-06-25 09:49:58