Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411516 Posts in 69380 Topics- by 58436 Members - Latest Member: GlitchyPSI

May 01, 2024, 05:49:29 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Directx 3D Game - Help :'(
Pages: [1]
Print
Author Topic: Directx 3D Game - Help :'(  (Read 1424 times)
Sigma
Level 1
*


View Profile WWW
« on: July 14, 2010, 09:32:35 AM »

Can anyone tell me how to create a basic 3d level editor and how to save and load the info from editor to game and vice versa? All suggestions are highly appreciated.

Thanks in advance
Logged

Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #1 on: July 14, 2010, 09:48:08 AM »

What you are asking for exceeds the scope of a forum post.

However: saving and loading info can be done in many ways - broadly speaking your data format could be binary or human-readable (e.g. XML or similar) (being the choice between speed and small files vs. slowness and easier-to-debug files). Have each object type know how to serialise itself into a save data file (a file stream or whatever), so you can just iterate through all the objects in a level and call e.g. Serialise(mySaveStream) on each one. Then you give each object on the game-side a way to understand that so like when you load in the file, you scan through and read in some kind of header which says oh, it's a ball, so you create a new ball, and call newBall->Deserialise(stream), then the ball loads in the data from the stream, and repeat.

As for the editor, also consider having it work in-game.
Logged

Sigma
Level 1
*


View Profile WWW
« Reply #2 on: July 14, 2010, 11:27:36 AM »

k...Thanks for the reply. And one more regarding Dynamic link libraries i know this is a very basic question but still i couldn't figure out anything about this. Apart from code reusability and hiding function definitions, is there any advantage of using DLL's like increasing speed in executing function calls i mean whether DLL play role in performance of an application? If this question looks stupid kindly forgive.

Thanks in advance
Logged

muku
Level 10
*****


View Profile
« Reply #3 on: July 14, 2010, 11:48:32 AM »

No, DLLs get compiled into machine code just like executables do, there should be no appreciable performance difference. There might be an ever so slight performance hit from the indirection you have to go to to call a DLL function, or from decreased code locality, or from the fact that DLL functions can't be inlined, but in practice you won't notice this as long as you don't call a DLL function in a tight inner loop.
Logged
Sigma
Level 1
*


View Profile WWW
« Reply #4 on: July 14, 2010, 12:11:12 PM »

thanks for the reply guys
Logged

Sigma
Level 1
*


View Profile WWW
« Reply #5 on: July 18, 2010, 09:57:14 AM »

hey can anyone explain how to use addRef() in COM? And what exactly does it do? I found that it will safe release the object but when and how it will do? All helps are highly appreciated.

Thanks in Advance
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW
« Reply #6 on: July 19, 2010, 07:37:11 AM »

In general, you don't ever have to call AddRef() yourself, except for testing, to see how many references you already have to an object.  For instance, here's some code from my renderer -- this is the only place in my code base where I ever call AddRef().

Code:
#ifndef _FINALRELEASE
inline ulong NRenderer::GetRef(LPUNKNOWN obj)
{
ulong retVal = 0x7A31C7; // for sanity
if (obj)
{
obj->AddRef();
retVal = obj->Release();
}
return retVal;
}
#else
inline ulong NRenderer::GetRef(LPUNKNOWN)
{
return 0;
}
#endif

References can be added by a variety of function calls, but in general, anything that creates an object (e.g., IDirect3DDevice9::CreateTexture()) or assigns a reference to an object to another object (e.g., ID3DXBaseEffect::SetTexture()) will increment the reference count by at least one.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic