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 / Procedural Maps Possible?

Author
Message
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 9th Jan 2012 23:00
Heyo all,

I am looking to start a new project in the near future that would require procedurally generated levels and i have a few questions on if this is possible and any thoughts on the process.

This may not be the best example but DwarfFortress or even Minecraft, randomly generate an area and then save it to a file so it can be used later without having to be generated again thus needing less performance to actually play the game and generating it would be an entirely different process. What i need to produce is that end file but in a manor that is usable in darkgdk games.

At the moment the speed of this process is unimportant. I would have a database of assets that i can use (ie buildings, landmarks, clutter etc.) and my generation algorithm would take these individual pieces (which are just simply textured models) and place them on the world procedurally, that is in a way that makes sense but is different each time i generate a world.

Firstly, let it be known i have never dealt with programming for 3d models or altering levels like this so some of these questions could be pretty rudimentary however to avoid mistakes and silly overlookings i thought it best to ask before i start.

Now i imagine that if i can have some function to attain the dimensions of a particular asset, coupled with my database including what the asset is and other details i could probably make an algorithm to do this however my main problem is making it a level file.

I have no clue what type of file i would have to output, let alone what i would have to do to actually place these assets on this level file. Basically i have to create a level editor for darkgdk but instead of having the developer place things on this level the computer would do this part.

So looking at darkgdk's compatibility i assume i would have to output to .MDL or something however i dont know how i could programatically write one of these files with darkgdk?

Has anyone got any experience with anything like this or a part of this that they can impart some wisdom on? or even if you know of any articles on programming a .MDL file or whatever file i would need to output?

Any and all help is so very much appreciated, Thanks in advance.
Nekroze

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 9th Jan 2012 23:46 Edited at: 9th Jan 2012 23:56
I'm actually in the middle of a project that does generate procedural levels using my own algorithm for creating the level model. Basically I use a set of values and set the random seed and the algorithm will generate the 3D data for the vertices and indices. The 2nd part generates the model, floor, walls and roof and also sets the UV data. The 3rd part also uses a set of data values which places the pre-fab models into the level.

I'll soon have a WIP with were I'm at with that project but in the meantime have a look at the stuff I've got under this tag on my website: http://csnorwood.site40.net/tag/3d-level-generator/

Should give you an idea of where you want to start...

EDIT: The only 3D models that are required are just the prefabs (level decorations, baddies, etc)

You can also go about generating your own textures but in my recent playing around with that I've found that you are better off already having a library of textures on disk instead, it's much faster.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 00:15
Your blog is very interesting, i will be sure to read over more of it after i sleep a bit, especially WL-SGE as its source may touch somewhat on what i wanted, that and your decoration of the V3 generator.

To further clarify what i want to do however. I would like to have an end product that seems to have been made in a level designer. However to actually make that file i will have a large flat plane and a skybox. my procedural generation algorithm will place assets (kind of like the decorations but everything is an asset aka pre-fabs, buildings, people, signs, doors, barrels etc.) in a fashion that makes some sense (as in town planning to a degree) and then save this somehow as a readable file, im guessing at this point a .MDL file.

I will not at this point actually need to create my own 3d objects with my code so i will not need to generate vertices and indices or even textures, so in your example WLGfx, i would only being doing the third part but that would encompass everything in the level.

Considering darkgdk can already load a proper .MDL file as a level i believe, i need to find out how i can make a program to create proper .MDL level files.

But as i said i will look over more of your stuff tomorrow as i am very very tired (24+ hour day) cause there are some real gems there that may help!

oh and thanks for the quick response, night all.

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 01:22
lol I'm shattered at the moment but cannot go bed as I'm in hospital for sleep depraved tests in the morning, still 9 hours to endure. Uggh!!!

The V3 generator is part of the code I'm now working with which I've incorporated perling noise to create slopes now in the levels. The main reason I've built the level that way is the level itself with all the data for the item placements only take up 128 bytes of data. So at the moment I've got 64 levels from small to mega huge only taking up 8192 bytes. And a level is generated in less than a second. If I exported on of the levels as a model it would probably take anything upto a 40Mb file. Just as a bonus, the generated data helps with item placement within the level, whether on the floor or attached to a wall or the roof.

Dark GDK can export .dbo files (native to DBP and GDK and load the fastest) and also .x files (via dbSaveMesh() ). Although you cannot save .x files with textures. If you are going down this route then you are better off using the dbo format.

The WL-SGE is mainly item placement, and each object can be accessed from within DBP/GDK and manually controlled too. The addition of zones is mainly for placement after the level is loaded, ie, player start positions, baddy spawn areas and also collision areas. The saved levels are extremely small too as they only reference the prefabs.

I'll keep an eye out and see how you get on. Good luck!

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 10th Jan 2012 04:55
Hi guys I am finding this a cool read... just tagging in its really motivated me to develop my own system too for upcoming games...

FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 07:42
object placement is my only real concern at least for now in this project.

So then what is the process like or has anyone got any articles on the process of loading multiple textured meshes, placing them on a scene and then somehow exporting that scene to a .dbo file so it does not have to be generated again?

This is the main process i am concerned with really, most likely for caves i will probably use a tiled chunk system kind of like TES3 Morrowind which is just narrow meshes of varied chucks, angles and types of caves that all kind of tile together but in 3d. For external areas i will likely just have all the assets in a level placed on a flat plane as the ground however at some point i may use perlin noise to create a few very small slight hills, maybe just as high as the player is maximum, and then place the assets on that as well.

I figure that if i can place the assets on a flat plane i can place them on a couple little slopes but the part i need to get a theoretical process down for is:

How to load darkgdk (lets be honest not my problem here)

Make a scene that has a skybox and a flat plane (which i may later change to perlin noise generated terrain)

Choose a random asset from my database (this part i am fine with)

Decide a placement for that asset on the ground (all i need for this really is the dimensions, rotation controls and the ability to detect when it is on the ground or hanging off of the ground)

Place that Object (effectively locking it or making it has done)

Repeat till level is made (think i can figure that out)
Magicaly save the scene as a file (from your feedback i am guessing .dbo)

Sorry to reiterate but i am all to aware that i often misrepresent the purpose of what i am trying to say on forums, they are a tad hard for me.

The main part i need help on is the last 3 steps, sorry to hear about your hospital pain btw, long tests suck mate.

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 08:09
The Matrix set of commands make placement onto a terrain easy enough as at any point of the terrain you can dbGetGroundHeight() and use that as your Y value. Also with most terrains you will probably have a certain height for your water level. You can skip the item placement if the dbGetGroundHeight() falls below this height.

There's also some sample code around on these forums that converts a matrix to a mesh once you're done with everything and you're ready to save your level.

Now saving levels is another thing. If you've got lots of assets on your terrain you might consider saving them seperate. You can add objects as limbs to a main object and save the main object out as a dbo. My WL-SGE gets around that problem by keeping all the objects seperate. You will have to think about how you want to do this part as some objects you will not want to add to the collision checking.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 09:26 Edited at: 10th Jan 2012 10:27
Firstly, i am not the 3d programmer on this project, i am working with the world generation and i have a guy that will work more closely with darkgdk itself and it seems that i will have to pass most of this on, maybe get him to make a simple library of functions i can use to work it.

So if i am getting this right, i would create a matrix, load pre-fabs in, place them on the matrix, then somehow save the matrix... is that right?

Your right i would need separate objects as some things will not have collision, like grass or something, so then what would i need to write something to make a text file that has all the co-ordinates and links to the assets locations and some properties like how to handle collision etc. right?

Im sorry but this is kind of out of my field lol, i have never done anything to do with controlling 3d. So is there any good tutorials then on how to use matrix's or some such similar articles?

Please forgive my ignorance with 3d stuff but i am personally bad at texturing and modelling so all my solo games have been 2d, just never got the experience with 3d but hey i got a 3d guy now for this project.

I swear to the programmers bible that I shall not harm the FPS.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 10th Jan 2012 13:08
I have been working on this topic for a while now. I can't seem to come up with a sceme to make dungeons/caves that are: random, look good and go from entrance to exit. I can get the random and the E-E with no problem. I just have issues with it looking good.
It's not just enough to have a bunch of pre-defined blocks mashed together, you need to have them rotated so that (for instance) the door to the block is not pointing into a wall of another block-- this is hard work. There MUST be another way to do this with something like a table or something.

Unless I can get the randomness to work, I will have to make several variations of the same level and just randomly select that variation at game-start.

This is a good discussion. I wonder if Green Gandolf has something. I know he had some kind of dungeon program in DBP, but I don't remember if it was random.....

The fastest code is the code never written.
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 14:00
Thanks Hawk, its good to know others are finding this topic interesting i did not expect as much interest in this as it has gotten so thanks to all of you.

On your work though Hawk, are you saying you have managed to load multiple pre-fab models, have some (if rudamentary) way to place them and then have been able to save it to a file for later use?

If so i would be very interested in hearing how you have accompished this.

On the idea of there being a better way of doing this with a table or something i was thinking maybe we could have a database of information alongside the assets that have all of their statistics. Things such as the width, height, depth and then some way to indicate the rotation or direction of what should be the "face" of an asset (face being the part of a house that has the main door or if the asset is a door what part should be the opening side be facing etc.) and then we could use this information on the assets to choose what assets should be placed where and how before actualy starting to position the real assets on the level. That way the process of placing the assets on a level could just be some translation of the mock level we just made off of the statistics information database.

It may not work and if it would it probably wouldn't work exactly like that but maybe something similar could be implemented to achieve our goals... idk

If you find out anything please echo it here!

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 20:27
Before I started work on that type of level generator I did finish off another algorithm which generates dungeons using just a 2d array.

http://csnorwood.site40.net/dark-basic-pro/pseudo-3d-random-level-generator/

And this one: http://csnorwood.site40.net/dark-gdk/random-3d-level-generator/

It comes complete with the source code which I hope helps explains you. The algorithm using a diggers method to generate the dungeon, a flood fill algorithm to link the dungeon sections and also saves the positions of the diggers positions when they die so you can use those coords for spawning areas.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 22:14
I am very seriously considering getting and using PureGDK for this new project when we start it as it looks amazing and after pouring through its forums i am pretty eager to use it...

Not really related to this topic but thanks WLGfx your mentioning of it piqued my curiosity!

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 23:09 Edited at: 10th Jan 2012 23:12
The beta of Pure GDK is still available for free but I'm not yet sure as to when the beta runs out. Hopefully not soon because I'm in the middle of a project which is in the WIP forums at the mo. Either way I will be getting it when the I can eventually afford it as it's the most comfortable TGC product yet, albeit fiddly when first starting out with. As I compile the PureGDK cpp files into release and debug libraries so my own project compiles in just a few seconds. Just check out the Pure GDK forums for the beta download. Any problems just ask myself or Mistrel. I'm still using MSVC 2008 express because my laptop is an antique...

EDIT: PureGDK also allows you to use the DBP plugins which DarkGDK doesn't.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 23:17
one step ahead mate, already got it installed. going over the examples now, seems nice... although i wish my computer wasn't such a beast so i could see some actual performance numbers that apply in the real world lol.

I am looking forward to being able to finally use VC++ 2010, as i said though for this main project i will not be working so much with the graphical engine myself. Just need to learn enough to display whatever seen i create and well the big question... how to create it to meet our goals (ie save it to a single file for later loading) but so far i like it... mainly for the up datedness and heavy documentation is nice.

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 23:37 Edited at: 10th Jan 2012 23:38
My level so far in the project I'm working on, loads 3 textures (floors, walls and roof), generates my level using the alogorithm mixed with perlin noise to create a sloping cave like dungeon, loads and instances the prefabs onto the level, whether attached to the floors, walls (at different heights) or the roof of the dungeon. For a level that would probably take about 10-15 minutes of play time is generated in approximately half a second. A larger level would take about 1 second or more, and that's on my crappy laptop. The items that are placed on the map are handled later on in the game, ie just for show, collidable, or as a game entity.

The earlier version of the procedural level generator that I did before coming up with this one just uses a 2D array which is much easier to work with (less math).

I guess what you're after is writing one program to generate levels and add entities and then load them into your main program? That's the main reason for me writing the WL-SGE but I never got to use it fully myself as I got sidetracked with procedural stuff.

EDIT: My advice is have DBPro on hand at all times to proto-type some of your algorithms...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 10th Jan 2012 23:58 Edited at: 11th Jan 2012 00:03
I have never used DBpro myself.

But yes you are right is pretty much what i am after, i may actually just have a spawner for entities instead of solidly defining them so that i can spawn different things from the spawn locations based on the players level... or i could choose spawn locations randomly at play time but i would rather not do this so as to keep the performance up (although the overhead for this is probably minimal)

But yeah effectively what i need to make is half of a level editor like WL-SGE in that it needs to be able to handle placement of assets and then save the level as a file to be used later but the part of a level editor that accepts human input as to how things should be placed needs to be replaced with some kind of ai that places things.

The ai part i can figure out myself but its the level editor side of things i cannot. Also because it would not have human input it would need extra functions then a simple level editor would have.

For instance when a human places a building on a map he/she can move the building to the right height so its not sticking out of the ground and then can rotate or move it a little if it is colliding or intersecting with another building, i would need to make detection of these events a function rather then simply the human eye seeing these problems in a 3d view from the level editor.

If i can get that done then handling the actual ai on how to place and move stuff should be fine.

Once again i am very sorry if i am unclear in my goals, i often find it very hard to articulate my meaning especially with programming/game concepts... not the best trait to have as a dev but for the moment i am stuck with it.

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 11th Jan 2012 00:08
I was at the time of writing the wl-sge to add in collision and physics for item placement but never got around to it. As I said earlier and it's true. Easily distracted by other things.

At this stage, you would be better off not thinking about adding all of that into a level editor as it will take up so much time and your main project will suffer.

Unless you want to build a level editor around an engine that you wish to use in your game which is where everyone starts thinking but in practice rarely works.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jan 2012 00:19
I haven't looked at your code yet, but I think someone said "tunneling".... That made my gears turn. If I use blocks of a pre-defined size (which I am using), and had each one with 4 values representing N,S,E,W directions. Each of the directions can have a value of "open","wall", or "door" (use 0,1,2). Then start the "tunneling" with the Entrance block. Make a while loop with a pre-determined "Max" amount so it's not infinite. Each loop check to see if one of the directions has anything but a wall and put another block there. Go to that block and do the same. Each time puting a random block where there's "not a wall" and moving to it. blah blah blah....
I hope you can understand my ramblings-- it's not coded yet, but I'll post something maybe this weekend.

The fastest code is the code never written.
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 11th Jan 2012 00:28 Edited at: 11th Jan 2012 00:34
No what i meant by half of a level editor, what i need is something like the backend of a level editor in that it has the functions to place and move objects and save the level to a file.

The point of my game is that we will never need a conventional level editor as everything is generated using this system i am trying to figure out. Like an automated level editor but less editor like and more automated... yeah im not good at making any sense at all am i?

To me, a level editor has 2 main parts, the backend and the frontend. The frontend being the GUI and 3d preview and all the buttons to move stuff where the dev wants. The backend being what all the buttons and GUI talk to, basicaly a set of functions to place, move, rotate and save.

I need something like this but replace the front end with my own ai which i can work out myself. its just the backend i need.

To be honest i dont understand a lot of what goes into making a level editor which is why i am asking well in advance of trying and probably failing hard and as you said, easily getting distracted.

By collision and physics for item placement in WL-SGE do you mean my example of some kind of function and that tell if an object is intersecting or too close to another or is floating above or halfway through the ground?

Using my previous example of when a human is using a level editor i can see why these things would not be needed, as i said, the human eye can tell when this is happening and fix it. However replacing the human with a computer in this case i need a set of eyes, in keeping with the analogy i guess, for the computer to tell if its placement is off or needs to be changed.

EDIT: Hawk, it can be a very efficient way to make a random "cave-like" level if you do it right. i have used this kind of method before to "carve" out dungeon levels and such, in 2d its much easier to place decorations (entities, items etc.) on the map afterwards and works quite well. doing things like this in the past is most of the experience i am counting on to be able to create something similar for 3d... its just these damn communicating with meshes and stuff to save into one single file... and i just sound like a broken record now, will shut up for a bit.

I swear to the programmers bible that I shall not harm the FPS.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jan 2012 03:03 Edited at: 11th Jan 2012 03:05
Don't worry about saving any meshes unless you are talking about dbTerrain or dbMatrix. If you are going to make a dungeon crawl 3D with "random" levels and you want to make it consistant each time you go in the dungeon, use a random seed and save the seed.

If you are just interested in a level editor without the GUI, then you already have that capability in DGDK. It has dbPositionObject(..) for location and any of the dbRotate...(..) commands to use.

Perhapse you are in need of a way to make complex objects stay together? What I mean by "complex object" is that each block of a dungeon like in a room/multiple rooms there are walls and other objects that are not always part of the floor of all the blocks. So you would have a struct to define this block:
I use a grid pattern to define the location for each block:

These two will make it possible to keep track of your level. It WON'T allow you to save your level. The method I used in the past to save a level requires we change the BLOCK struct and add another one to describe each block "type":

Now that you have made you level into a grid of "types" you can save the LEVEL struct to a file.

The fastest code is the code never written.
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 11th Jan 2012 06:21 Edited at: 11th Jan 2012 07:45
Ok without giving away the major selling point of our game idea, lets just say that we the developers are generating these massive worlds on a server, likely with a lot of detail. then pushing the new worlds periodically to players including updates to assets and the generation system...

yeah still gave away a fair bit really.

If i just needed to generate random levels on the fly that would be fine however i do not need this for the sheer complexity of the game world needs to be generated by our servers.

I am aware that GDK has position object and rotate object commands however i do not if there is a way to save everything currently in the 3d environment as a single file to simply load latter. and if i do find this i am then not sure what other things i have to do that may be special ways to position objects so that it works with this save system and what not.

Then i would only really need to be able to detect the collision of objects in a negative way (ie object is floating in air not on ground, object is intersecting another object etc.) and i would be able to take it from there with those functions and i believe make i can make an ai that uses those functions as a level editor, saving the detailed newly constructed area and then... shipping it for distribution to players.

Although if i did not use this distribution system then i would still need ways to check if the position is valid and not colliding with other stuff it shouldnt be as i say in the previous paragraph.

EDIT:
I am looking through the GDK documentation (puregdk) for things that may help and i spotted this.


Now this is definitely a step in the right direction on detecting if the current object needs to be moved as its position is invalid, however i see this:
Quote: "When a polygon collision is carried out, the secondary object being tested will be treated as a sphere for collision purposes, where the bounds of the object define the radius."


However as speed is not at all an issue in my generator, is there anyway to evaluate collision with the second object more accuratly?
i see this command:

Although this can test collision against two objects the second objects hitbox being a sphere, i can see instances where this will not work for my code.

While this may work for a normal game where you may test collision of objects of the same size, i will be evaluating many different sizes. For example; take a barrel i want to place as object 1 and a large box for building as object 2, the barrel being much shorter then the building whose hitbox is a sphere approximate to the structures dimensions, there will be a radius around the bottom of the structure, where the structure meets the ground (just so happens to be the height the barrel needs to be) where the barrel could be positioned partially (or fully if the building is large enough) within the bottom edge/wall of a building and not register as a collision... and this would be bad.

EDIT2:
I am looking through documentation on 3d objects and limbs, could i not create an object primate plane (maybe add perlin noise to it for slight slopes) and then using this as a main object, for all other assets i place on the level just use:

this would load the current object i am using in the scene. Then i would have to place the object, i need some way to tell what the "face" of the object is... im not sure on how to do this but this would determine its rotation to the path/road that a building is placed on so that it is facing the right way (not everything will use faces there is no need for a barrel to have a face, although maybe a top and or bottom for use in placement).

Im not sure that this function works on limbs?

cause i would need that once i can figure the answer to my previous edit on this function.
Then i would use something like:

using some kind of for loop to check the collision of this limb against all other limbs aswell as the main limb/object (the ground)
and then if a collision is detected move the new limb 1 unit away from the direction that limb is in from the new limb and do the collision loop again until the new object does not collide with any other.

Then presumably once i finish the above steps i can get the main object, that is based on the ground with everything else as limbs, and use this function on it to save it as a single file including textures and can later be loaded into the game simply using the next function:


By this point in my tangent i feel i have likely gotten this all wrong. Also i do not know how i would define spawn locations for the player/npc's/enemies or how i would define entry and exit points? I just thought i might be able to generate these in the generation phase but instead of saving them to the object and thus the file i can maybe make a second level information file that has a list of special objects and where they are placed. This i can understand but i am not sure how to define their position from this second file, Assuming the ground plane is a large square (regardless of its heightmap) then could i maybe use some kind of function to get one corner of the plane (and thus the level) as a reference and have the positions for these special objects defined in relation to that, that way no matter where the entire level object is placed in a 3d environment the special objects file can place the objects correctly cause they are saved in relation to the corner as say:

thus when the level is loaded then all the level loading function has to do is find the x, y, z of the designated corner of the levels and then add that x, y, z value to the one from the second file for the special object?

EDIT3: short one, how come the documentation for:

says that is saves as a dbo format however the docs for:

say this:
Quote: "This command loads a 3D model into the specified object number from any of the supported file formats: .x, .3ds, .mdl, .md2 or .md3."

presumably this means that although GDK can save an object it does not have the support to load that same object? that cannot be right? or is there a different load for dbo formats?

WOW /endwalloftext

I will keep pouring over documentation and asking questions about things i find (sorry if i am getting annoying) as i have now slept and have the cognitive skill required to at least read over a bunch of documentation.

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 11th Jan 2012 12:47
The built in collision system to DBP and GDK works fine but for a major speed update to collisions you would be better off using Sparky's collision which I believe works fine with PureGDK too. The advantage of sparky's, as I used in my wl-sge, is that multiple objects can be set up into groups, so that when you do a collision check, you can check an object against a group of objects. Take a browse through the docs and code that I've put together for the wl-sge. Maybe one day I'll do a complete re-write but at the moment it's still good for storing multiple objects and zones in just one file.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 11th Jan 2012 14:09
I will go over the WL-SGE code then as soon as i feel up to it, not having a good day.

As far as speed on the collisions this really does not matter for this stage of the project. I can use a good performance collision library for the actual game play however for the generation stage because of its distributed nature accuracy is far more important then speed, hell the entire level generation could take an hour and that would still be ok (although i am a sucker for optimizing when possible) our distribution system will work fine with that so long as it is accurate.

We may well end up using a different collision system for the generator but 1: i have never used a collision library or anything like it 2: i don't really know what ones are best for use in GDK (probably pure) 3: i would need it to be able to get the collision of two objects using polygon based collision, not hit boxes or spheres like i mentioned last post.

Does anyone perhaps now of a compatible, very accurate poly based collision system that i can use when placing and moving these limbs?

I swear to the programmers bible that I shall not harm the FPS.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jan 2012 14:41
Quote: "save everything currently in the 3d environment as a single file to simply load latter."

The same method I showed you could accomplish this. If you want a contiuous world or areas, you can make the ground a dbTerrain or use something like Blitz (never used it myself) and keep your other assets in "blocks". You will already have the info needed to save the terrain and saving the assets could be done by putting them in structs and saving them.

The fastest code is the code never written.
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 11th Jan 2012 16:55
wow i must have been real tired Hawk, i remember reading the begining of the post you just mentioned but not the rest of it with the code examples.

I am starting to understand this better now, i like the idea of using blocks to define the position of the larger objects. For the sake of clarity much of my game will be on an open sky environment where there is a ground and a sky, not a cave (although some levels may be) and so i need some way then to place a plane (probably one one that i have modified so it may well be a GDK terrain object) as the base height 0 for the map across all 20x20 blocks (using your example for instance)

similarly to what i said somewhere before, my first instinct on saving the positions of the objects that are placed on top of the ground is; instead of saving the objects x, y, z in the current 3d environment, save the x, y, z relative to the top left corner of the ground object (being 0,0) so that the buildings etc, can move along with the ground in the 3d environment with the buildings and other objects final xyz in the environment being the xyz of the top left corner of the ground + the saved xyz values for that building...

So is there a function that can return the xyz co-ordinates of the top left of a 3d object and have it reliably be the same corner each time? Wouldn't want the corner to change randomly as things would be all above and below the ground because the terrain was supposed to be on a different rotation.

Even i feel i am becoming less and less clear on my goals or even general thoughts as i try to discuss this

I swear to the programmers bible that I shall not harm the FPS.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 11th Jan 2012 17:03
Almost every 3D modelling program has a centre world coordinate (x,y,z at 0,0,0), so if the model is created from using that reference point and used in your program then the position is from that point when placing the object.

The direction the object is facing is also important and varies between modelling programs so that have to be aware of the Left-Handed-System coordinates and Right-Handed-System coordinates. Although some will allow you to convert from one system to another. Don't worry about that as it does become more obvious.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jan 2012 18:10
I don't remember exactly, but I think dbTerrain creates its mesh object with one of the corners at 0,0. I normally prefer to have the center of my map at 0,0 instead of a corner. Small maps don't have a problem with having a corner offset, but If you have a HUGE map, you will get floating point deviation at the edges (this means the coordinates become less reliable). I don't think any of my games will have to worry about this (yet) since I won't have HUGE maps.

The idea of having "blocks" is so that you can have multiple, pre-defined objects in a grouping or block. This block of "stuff" can be positioned in the world without having to position the individual objects one at a time. For instance, you have a house with tables, chairs, beds, and doors. You don't want to place the house, place the tables, place the chairs, place the beds, and the place the doors. Let the house take care of that and when you rotate the house, the objects in the house rotate with it.

If you have a large map with lots of stuff, you may want to break up the map into zones. Each zone has some "stuff" grouped into "block" and contains all the info for them. Doing this can help in collision detection and mesh exclusion functions so your program will run faster. It comes at a small cost-- size. This is aliviated somewhat by using pre-defined blocks like a generic house with all the things that go in the house. You don't have to have an individual house with its multitude of stuff as loaded objects, you can use dbInstanceObject(..) to keep it small.

Another thing about excluding objects. If you have houses with all the stuff that goes inside them, you can do a dbExcludeObjectOn(..) on all the objects inside the houses you are not currently in. This will cut down you render time significantly if we are talking about lots of "stuff".

The fastest code is the code never written.
FlexiCat
14
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 11th Jan 2012 20:46
First, my maps will not be huge, im thinking something comparable to the size of the areas in diablo 2. So i shouldnt need to worry too much about things like long distance rendering and lod or having zones hidden when they are far far away and thus not visible. Also similar to diablo 2 my maps will not have the ability to go into a building, there may be a small roofed area that when entered the roof comes off but if i do have something like this it would be very rare.

Basically i want 3d diablo 2 style maps, well not the graphical style as it wont really be it he same kind of mythic world but i mean pseudo-random, but being 3d and a modern game i will have much more randomness in the levels then diablo and i am aware that diablo is just 2d tile sets but i want 3d as my game will have a choice to play play in 1st person.

For the ground and its xyz stuff i supose i can when loading and displaying the level on the GDK 3d environment just force the ground to have the same global co-ordinates as it did when i generated it (as the generator will be a seperate program) and then just make my generator make sure that the ground adheres to this aswell on generation. I dont see why that wouldnt work.

Back to the accurate polygon based collision of 2 objects/limbs, anyone know anything that can accomplish this? and if so can i get a link or an example on how to do it would be awesome. The more of this i can learn to do myself the more time our 3d guy can just spend on the actual game play part of the game and not the generator... sorry but i am afraid that means i am lumped on your guys

Thanks for all the help by the way guys, you have been so supportive considering my clear limitations and shortcomings in this field.

I swear to the programmers bible that I shall not harm the FPS.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 12th Jan 2012 14:59
Sounds like our projects are very similar....

For collisions, you may want to look at sparky's.
http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-19 04:28:26
Your offset time is: 2024-11-19 04:28:26