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.

Work in Progress / pdEngine

Author
Message
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 13:22 Edited at: 16th Apr 2010 17:23
EDIT: If anyone comes to this thread through the link in my sig, know that pdEngine is now on SourceForge: http://sourceforge.net/projects/pdengine/ and you can follow it's development in my blog: http://whileboredblog.blogspot.com/



For the six months or so I have been working on this little project. It has now got to s stage where it is stable enough for others to make use of it, so I am posting it here. By no means is it finished, but it's usable.

What is pdEngine?
pdEngine is a wrapper combining DirectX and NVidia's physX into one easy to use system for C++. In ways it can be seen as similar to DarkGDK, but it is completely object oriented and has native physics.
It started as a way for me to learn DirectX. I got bits of code off tutorial websites and fitted them together. I integrated physX, and several months on I have a working game engine with several nice features. Credits go to: chillypacman from the NVidia Developer forums, directxtutorial.com and all the guys who write bits for gamedev.net. Most of the code I copied has now been rewritten because I understand it fully.

Features
Rigid body physics.
Forces
Per pixel phong rendering with normal and specualr texture support.
Z-Fail Stencil Shadows/Shadow Volumes for sharp edged shadows.
Console with printf, cin and cout support
Custom .x mesh loading for terrains
Multiple windows from same WinMain program
2D sprites for HUDs etc
Onscreen text
Particles with physics
3D audio

Planned Features
Advanced object manipulation functions (currently physX functions have to be used directly)
Raycasting for bullets etc.
Cloth with physics
Limbs and skeletal animation
Character and vehicle controllers
And when I get really bored during the summer holidays, I plan to get working Realtime Radiosity and Soft Shadows using Imperfect Shadow Maps - paper: http://www.uni-koblenz.de/~ritschel/dokumente/ISM.pdf

What does the code look like?
Here's a very simple program, using the release downlaodable below. The next version will be slightly different, using descriptors to intialise objects.


What does it cost?
Nothing! But for now, no commerical uses whatsoever and I keep the source for myself.

pdEngine by Jeremy Parker is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.0 UK: England & Wales License.

What do I need
It was written using Visual C++ Express 2008 and DirectX SDK November 2008. You will need the physX SDK installed, version 2.8.1. I'm not sure what else will work, but I'm keen to find out.
You will need a Shader Model 3 Graphics card to use the shaders.

Screenies?
Here is a shot of my game BlockTower 3D. Bear in mind I am not an artist. Notice the specular highlights and normal map on the crate.


Where's the documentation?
For next release, I will write a good one, but for now you'll have to read the examples and the header files and experiment. I'll be happy to give support.

Where do I download it?
All the files below are zipped. They are built on pdEngine 0.3. To run the .exe files either move them to the project directory or edit the included shortcut so the startup directory is the project directory.
BlockTower 3D: contains media, .exe and source. http://www.mediafire.com/download.php?jvhmvmnnzwv 8.96MB
Basic Program: The code above made into a solution, with a compiled .exe http://www.mediafire.com/download.php?20iktyu0mnt 4.63MB
pdEngine: The library itself. Contains .lib, .h and default media files. http://www.mediafire.com/download.php?y2w1mztjw4i 3.46MB

How do I set it up?
Extract the pdEngine.zip to a suitable location, such as Program Files. Open up visual studio, and go to tools>options>Projects and solutions>VC++ Directories.
From here choose "Library files" in the top right drop down, and add to this list the location where you extracted pdEngine + lib
Take the same steps for "Include files" but use include instead.
When creating a new project, you must put into your active directory nxcooking.dll and all of the media directory that come with either BlockTower or the example program.
To run a successful debug build, #define PD_USE_DEBUG must be decalred before including pdengine.h.
It is also likely that in the project settings you need to add /NODEFAULTLIB:libcmt.lib at the linker command line, otherwise clashes may occur.

SECONDS RELEASE - [href=http://www.mediafire.com/file/fmingolkfah/pdEngine.7z
]http://www.mediafire.com/file/fmingolkfah/pdEngine.7z[/href]
You can now safely ignore most of the above, just follow the readme.txt it come with.

EDIT: this post has been changed to rectify my stupid mistakes so that these should actually run on other computers.

Feel free to email me at the link below.

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 10th May 2009 13:57
Quote: "Raytracing for bulelts"

Raytracing? Really?

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 13:59
D'oh meant raycasting
zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 10th May 2009 14:00
Downloading and trying it right now jezza!
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 18:00 Edited at: 10th May 2009 18:30
Nice new function ready for the next release:
bool PD_INPUT::MouseOver(PD_SPRITE *sprite);
Allows use of sprites as buttons. If one had a bitmap with two states one above the other, say each 80 by 20 pixels (so 80 by 40 pixels in total), one could in the next release do the following:

Creating a nice button that changes on mouse hover. The PD_INPUT::Click function needs some explaining. That is already in the released version:
returns true if a mouse button is
pressed. button depends on the int:
0 - left
1 - right
2 - middle
3 - back
4 - forward
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 10th May 2009 18:54 Edited at: 10th May 2009 18:55
When I run your Block Tower 3D demo I get an error saying I need d3dx9d_40.dll, however this is a debug DLL so it looks like you're linking with debug libraries when you should be linking with the release versions.

i like orange
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 18:57
DirectX Control Panel is grayed out for some reason, and I cannot choose whether to use Debug or Retail to build, although retail is chosen (but grayed out).
Does installing this redist help?
http://www.microsoft.com/DOWNLOADS/details.aspx?displaylang=en&FamilyID=886acb56-c91a-4a8e-8bb8-9f20f1244a8e
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 10th May 2009 19:01
Nope, because it doesn't come with d3dx9d_40.dll, because that's a debug DLL, as I said above. What's your 'Additional Depndencies' look like when you're in release mode?

i like orange
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 19:37
You were right. A while back I changed from dependencies to #pragmas to include the libraries, but forgot to remove the dependencies from Blocktower. I just deleted them all. Now it uses these:
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment (lib, "dinput8.lib")
#pragma comment (lib, "dxguid.lib")

#pragma comment (lib, "NxCooking.lib")
#pragma comment (lib, "PhysXLoader.lib")

#pragma comment (lib, "pdEngine.lib")

Which AFAIK should be fine. The same thing did not occur for the other sample, so that should run fine for you...
Here is the new BlockTower exe. For the source use the link at the top, but please remove all additional dependencies from project properties.
http://www.mediafire.com/download.php?5ngmzzjw2ig
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 10th May 2009 21:43
I'm no longer getting any missing DLL error, however now it just crashes immediately with the typical "BlockTower3d.exe has stopped working." message.

i like orange
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 21:51
Can you just try installing to redist please? Do you have Vista or XP? You say that error is typical but I can't remember having it before and I've had lots of errors. I've never developed for Vista so I really have no idea...

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 10th May 2009 21:59 Edited at: 10th May 2009 21:59
Quote: "You say that error is typical but I can't remember having it before and I've had lots of errors."


I'm running Vista, and it's a Vista-specific error. Whenever something crashes in Vista it just about always crashes with a message that says "[App name].exe has stopped working."

Quote: "Can you just try installing to redist please?"


I would except a) that's not the latest version, March 2009 is and b) I just downloaded the latest version yesterday.

Anyways I don't think it's a problem with my DX version. What resolution is it set to run at?

i like orange
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 22:01
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 10th May 2009 22:12
Oh. Then TBH I have no idea what the problem could be.

i like orange
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 10th May 2009 22:26
Try on an xp machine for me? Or anyone else for that matter? zapakitul?

Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 11th May 2009 07:22 Edited at: 11th May 2009 07:54
I'm running Vista x64, and it crashes for me as well:

Unhandled exception at 0x003b374c in BlockTower3D.exe: 0xC0000005: Access violation reading location 0x00000000.

The exception occurs in:
'msize.c'

In the method:
'size_t __cdecl _msize_base (void * pblock)'

At this part:
else /* __active_heap == __SYSTEM_HEAP */
#endif /* _WIN64 */
{
retval = (size_t)HeapSize(_crtheap, 0, pblock);
<-- here
}


[EDIT]
msize.c for me is located at
C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/crt/src/

the msize method:
http://msdn.microsoft.com/en-us/library/z2s077bc.aspx

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 11th May 2009 19:58 Edited at: 11th May 2009 20:18
1)Make sure you are compiling in release - the library is and there fore subsequent builds must be. I will make two versions of the lib - for debug and release in future.
2)callstack - there are several similar errors i have found on the interenet which seem to claim it is a VS bug.
3)I've realized how much of an idiot I am. The projects will not work without pdEngine installed and setup properly and then rebuilding them yourself. This is because of the media files which are included at run time and yet I have not supplied. I will rethink how to load these - explains AndrewT's error I suppose. I'd be glad if Andrew downloaded them all, set them up and tried to build the examples himself.

EDIT: I've realized even that won't work unless you installed pdEngine at H:\\Documents and Settings\\Jezza.JEREMY\\MyDocuments\\Programming\\C\\pdEngine
which you won't have, and you probably don't have an H drive. I will try and get a release that will actually work by this evening for all the files. Sorry guys.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 11th May 2009 22:16
First posted has been edited with new links to working (hopefully) files. I'm not sure this will fix Jeff's problem.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 14th May 2009 04:18
Quote: "mySystem.Init(NULL, hInstance, nCmdShow, true, false, 800, 600, 200, 200, "pdEngine Example Program", true, true);"

You don't need to pass in the hInstance -- you can get the HINSTANCE like so: GetModuleHandleA(0)

Also, if you're passing in THAT many parameters, use a structure.

Ex:


Good luck.


Cheers,

-naota

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 14th May 2009 15:38
You should have simple init where you pass only few parameters and initEx where you can pass with struct. Or only struct, because IMO struct makes things cleaner.



jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 14th May 2009 19:20 Edited at: 14th May 2009 20:29
Thanks for the suggestions guys. I shall go through the whole lot making it more consistent, using descriptor structs for functions. I was going to do this but I wanted it to be easy and obvious, but this seems better.
I am also working on particle fluids at the moment, buttons have been finished and work well, and then I shall try my hand at the sound using XACT.

edit: is this a good idea for a way to write functions:


edit agains:
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.languages.vc/2006-09/msg00301.html says I cannot use GetModuleHandle for HWND, since it returns an HMODULE.

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 14th May 2009 21:35
You don't use GetModuleHandle() for HWND, you use it for HINSTANCE as Aaron said:



i like orange
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 14th May 2009 21:50
Dang i feel so stupid now... You forget how to read after you've programmed for ages. I write semicolons at the end of maths equations now.
Works good, thanks.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 19th May 2009 20:23
Updates:
Screenshot of the new particle fluid system working.

Attachments

Login to view attachments
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 21st May 2009 22:52
This engine is starting to look really good! Especially the spec/bump and shadowing!
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 26th May 2009 19:47
I'm still working on it. I broke shadows when trying to implement fluids, and thus ensued a complete rewrite of the renderer, which runs much faster than before. The shadow volumes are now extruded on the GPU. I still have one strange problem when using point lights, which I am trying to fix. I have also started writing a proper documentation.

One question, which is better:
void pdMakeObject(PD_SYSTEM *sys, PD_OBJECT *out, PD_OBJECT_DESC desc);
or
PD_OBJECT::Init(PD_SYSTEM *sys, PD_OBJECT_DESC desc);
or
PD_SYSTEM::MakeObject(PD_OBJECT *out, PD_OBJECT_DESC desc);
where PD_OBJECT_DESC contains all the info for creating the object.

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 27th May 2009 00:29
What kind of shadows are you using? Hope not stencil shadows.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 27th May 2009 20:27
Quote: "Z-Fail Stencil Shadows/Shadow Volumes for sharp edged shadows."

Yes, I am. I don't want to have a big debate stencil shadows vs shadow mapping, but for hard edged shadows (In the future when I integrate soft shadows, this will all change):
1) Can have omni-directional lights without using cube maps.
2) fast and work well on older hardware
3) have no resolution artifacts when shadows are a long way away.

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 28th May 2009 14:01
Well, i admit its good to have them aswell. The old hardware support its good thing to have.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 31st May 2009 13:02
.wav sound files can now be loaded and played, using the functions
PD_SOUND::SetPosition(float seconds)
float PD_SOUND::GetPosition()
PD_SOUND:lay()
PD_SOUND::Stop()
bool PD_SOUND::IsPlaying()
I don't do much sound work, the next thing to do will be to calculate 3D sounds, but are there any other sound formats that should be supported other than wav?
On a side note, the renderer is now working properly, and I solved a long running bug so now it is fairly robust. The next thing in this area will be either soft shadows or soft particles.

You can follow my progress on my new blog at:
www.qliveuk.net/whileboredblog

zzz
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: Sweden
Posted: 31st May 2009 14:37 Edited at: 31st May 2009 14:41
This looks interesting since I'm working on something similar myself in order to learn DirectX.
I have a tiny question for you; did you sign up for the premium membership at directxtutorial.com? If you did, was it worth the money or do you recommend any other tutorial-sites?
I've managed to create a basic wrapper with camera control, scene management and teapots! But I'm having a hard time finding good animation tutorials...

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 31st May 2009 16:39
No, I didn't. I did consider it, but the extras you get for the money are particles and effects. The effects I learnt from using FX composer and codesampler.com. From codesampler I also learnt particles. My advice to you is read as many artciles on DirectX on gamedev.net as you can, and look through all the well commented source code you can get your hands on.

zzz
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: Sweden
Posted: 31st May 2009 20:32
Ok, thank you very much!

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 4th Jul 2009 19:49
I made this video:
http://www.youtube.com/watch?v=rtTWr78uIao
Not much work has been done on this lately because my processor was in holland :S.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 11th Jul 2009 16:06
And another (I post my blog link as it has a more detailed explanation than on youtube):
http://www.qliveuk.net/whileboredblog/?p=41

Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 13th Jul 2009 20:11
is this for 3d or 3d and 2d?

New Site! Check it out \/
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 17th Jul 2009 01:27
Looking good mate, i will give this a go saturday when i am in portugal, currently in holland.

I like the features very much, keep this up.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th Jul 2009 18:49
Back from Wales
This is a 3D engine: it has 2D capabilities but I wouldn't make a game with them, just use them for HUD.
Also, the version I uploaded is very old. I need to fix the 3D sound using XACT (was previously using XAudio2, which I found too low level for my purposes), and then I will upload a new version, with sound, buttons, sprites etc.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 30th Aug 2009 19:06
OK, I am not going to be working on pdEngine for ages, so i want to release it. It is much better documented, and I hope it can be used for real.
It is rather different from the old version. The included examples should show how to use it. The basic thing to get your head round is that nearly all the classes are used like this:


The features have not changed considerably since the top post (which I think I editted, because they weren't all there in teh first release).

Here is a download link, in 7-zip format. It contains the library, examples and documentation (in the /doc/html folder, open index.html)
http://www.mediafire.com/file/fmingolkfah/pdEngine.7z

Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 30th Aug 2009 21:02
How difficult is it to learn native DirectX 9? I'm studying OpenGL, but I was told DirectX 9 was more powerful then OpenGL. Whats your thoughts on DX9?

There are 2 ways to develop for the N64:
1. Develop C code with PsyQ SDK and illegal Nintendo libs
2. Develop C code with legal kits, such as the Ground Zero devkit (g0dev.zip)
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 31st Aug 2009 19:24 Edited at: 31st Aug 2009 19:26
Hi i was gonna try you engine out lastnight , but the compilation failed due to missing sound headers eg(xact) , do they come with the directx sdk 2007 or do i have the wrong one for this engine .

edit: sorry i looked at the top you used the 2008 sdk .
can you use them both together or does it mess the gdk up ?


chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 31st Aug 2009 21:16
@chunks
There are posts on the GDK forum about how to use the newer SDKs with GDK. it involves making dummy libs. but you could always use both SDKs if you are careful about include and library directories with each project.
Please read the readme included with the library - I am using March 2009 SDK

@potassium
DirectX is not really more powerful than OpenGL. DirectX9 is rather out of date now compared with OGL or DirectX 10 or 11. The benefits of DirectX are that it already ships with audio libraries etc.
I find DirectX easier, but I have been using it longer. OpenGL has GLUT for simpel programs making it easy for beginners, but DirectX also has DXUT, that many people don't know about.
Mainstream developers tend to towards DirectX, but Linux users need OpenGL, so you will find good support for both at places like GameDev.net

chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 1st Sep 2009 16:37
I certainly will read it lol , i`m always too eager to try stuff out .

Looks like i`ll have to download the March 2009 SDK and put it in a different directory , i will let you know how it goes , nice work well done .

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
Colonel_Klink
17
Years of Service
User Offline
Joined: 20th Dec 2006
Location: Within the dark recesses of my mind
Posted: 4th Sep 2009 02:48
Looking good. You've put a lot of hard work into this.

Oh my gosh! He's wearing Full Metal Pyjamas!
--------------------------------------------
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 4th Sep 2009 10:49
I made a special forum to discuss it, since I don't really think it's fair using up TGC bandwidth with something barely related:
http://qliveuk.net/pdEngine/
I'd love to hear about people's experiences.

Login to post a reply

Server time is: 2024-11-24 11:55:21
Your offset time is: 2024-11-24 11:55:21