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.

Newcomers DBPro Corner / Saving to a file.

Author
Message
hinged shinobi
16
Years of Service
User Offline
Joined: 3rd Apr 2008
Location:
Posted: 10th Apr 2008 13:30
I've just finished my basic map editor thing but I need some way to save all the objects and their positions to a file that I can then open and add to etc.

I am completely stumped on how to do this, I don't even know what file type would be best to use (although I've read about people using .dbo files).

Anyone able to help me?
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 10th Apr 2008 17:20 Edited at: 10th Apr 2008 17:20
your save file routine should do this:

- if you have for example 10 objects, the file which will be written, has to contain 10 different structures
- now for each structure have this (pseudocode):



So basically, here's how it would look for 2 objects:



.... please note that in the above example, you have 2 objects: the first one is positioned at 0,0,0 and the second is at 100,100,100, while both have rotations set to 0,0,0.

Could you help me treat my injured Dino-Fly ?
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 10th Apr 2008 17:31 Edited at: 10th Apr 2008 19:04
Personally i'd use a Single Object Load/Save Function, You can then loop this for however many objects you have, (To save all Objects)



I've not tested this code, but it should work

Everyone Be Cool, You, Be Cool.
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 10th Apr 2008 18:39
yes, of course he'll use a subroutine or something which will be called for every object in particular cause it's stupid to re=code the same thing for each object ... my code was just to help him get the global idea

Could you help me treat my injured Dino-Fly ?
hinged shinobi
16
Years of Service
User Offline
Joined: 3rd Apr 2008
Location:
Posted: 10th Apr 2008 18:55
Thanks for that guys. I didn't understand how to use the code Twinsen posted, so I went with yours MSon. But it doesn't quite work, here's what I've got:



It creates an empty file, any ideas how to fix it?

Login to post a reply

Server time is: 2024-11-25 06:46:15
Your offset time is: 2024-11-25 06:46:15