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 / Vanilla Collision for DGDK .NET by Karsten Pedersen

Author
Message
Karsten
17
Years of Service
User Offline
Joined: 24th Jan 2007
Location: N/A
Posted: 21st Aug 2007 13:43 Edited at: 23rd Aug 2007 14:22


Download, Demo, Demo Source, VanillaLib, VanillaLib Source
(Right click, save as)

About

A solution for those who require sliding collision. Though obviously slower than Sparky's / NGC plugins, this is released as a class (C#) for easy integration with your current project. This was just a test but then I decided to release the code to help any other beginners. Have a look at the demo and decide for yourself if it is usable. (Mouse to freelook around player, arrow keys to move)

How to use with your own projects

After including the class with your project and setting up object collision of two objects such as...

(1 is the integer of the bridge, 2 is the integer of the player model)

oDB3D.SetObjectCollisionToPolygons(1);
oDB3D.SetObjectCollisionToSpheres(2);


... then in order to use vanilla collision call this from anywhere in the game loop...

VanillaCollision.clsVanillaCollision.VanillaCollision(<move speed>, <max step up>, <static object>, <dynamic object> ) ;

VanillaCollision = Namespace
clsVanillaCollision = Class
<move speed> = The speed in which the objects will collide
<max step up> = The maximum height in which the player can jump seemlessly, such as climing stairs
<static object> = The object which will not move i.e them .x map
<dynamic object> = The object which will move i.e the player model

e.g.

clsVanillaCollision.VanillaCollision(Program.fltMoveSpeed, 50f, 1, 2);

Gravity usage

Vanilla Collision also supports the handling of gravity by using...

clsVanillaCollision.VanillaGravity(9.8f, 1, 2);

9.8f = The speed at which the object will fall. (no acceleration until version 0.9)
1, 2 = The objects involved (1 = Static object, 2 = dynamic object)

Misc

Unlike the demo above, if you used an invisible block to do the collision testing and then move the actual player model to that, the whole thing would look a lot smoother. Perhaps in the final version I will implement this if I decide to keep with this solution of sliding collision. Although its like a slide made out of lego, it is very easy to work with.

Let me know what you think!

regards,

Karsten
kpedersen@hotmail.co.uk

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2007 17:33 Edited at: 21st Aug 2007 17:34
your links are broken, they say freewebs but when clicked this page loads in a new window

Edit: never mind... (right click, save as)

My DBP plugins page is now hosted [href]here[/href]
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2007 17:43
I ran the demo, seems ok, but the sliding collision is jittery and the models load on their sides instead of upright.

You should continue working on this as it seems like it could be very good for the dgdk.net community.

Can it wrap collision around complex objects like inside of tubes and along curves like rails? That would be very useful for some stuff I want to do.

My DBP plugins page is now hosted [href]here[/href]
Karsten
17
Years of Service
User Offline
Joined: 24th Jan 2007
Location: N/A
Posted: 21st Aug 2007 18:09 Edited at: 21st Aug 2007 23:21
Yes, the sliding collision is jittery because the player model is trying out all the different positions and such whilst also updating the screen. If I was to use an invisible model first to try out the movement and then update the actual one after my collision subroutine is finished, then it would be smoother. I think it is also partly due to the fact that my camera code updates every time the model moves.. If I set that to smooth, it would look a lot nicer

As for loading models on their side, its odd but that room.x file that I nicked from somewhere seems to be made on its side, I then spun it round more (270) so that I could test out the collision on the complex shaped wall cloths and the statues.

Yes, it does work with tubes and rails etc... I originally had the test level being Apex's bridge (but I didn't think he would be alright with me distributing it.) and the collision prevented the player from being able to walk through the round poles.

I'll work on it some more then and see if I can make it slightly smoother.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2007 18:21
ah, I see about the hidden test model, etc - cool
well if this will work on rails and tubes and such then I would definitely use it! I have been wanting something like this for a while now so this is great news indeed.

I will be busy the next few days working on an app that converts XSI 6 .x exported models to the correct Z orientation expected by DirectX and the DB_ engines. Once that is done I can begin messing around with this collision system - thanks for your work.

Quick question, can you provide a compiled dll version in future releases, so us using vb.net can just drop the dll into our projects? I am sure you can easily pull your class into a dll project, then hook that project in with your dgdk test project and build it that way (reffing the dll). It would make life better for us vb.net users. Thanks for your consideration

My DBP plugins page is now hosted [href]here[/href]
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 21st Aug 2007 19:13
Wow.... nice work Karsten

Thats something I can use in my game

I will translate it to vb.net so I can compile it in my code...

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine
http://noggs.netopcom.dk/forum/default.asp - Forum for the game
Karsten
17
Years of Service
User Offline
Joined: 24th Jan 2007
Location: N/A
Posted: 21st Aug 2007 19:42 Edited at: 21st Aug 2007 23:23
CattleRustler - Yeah, sure I'll get that done tonight, I havn't actually done a .dll in .NET before but it can't be that hard :p

Niels - Lol, I seem to be the only person in the world who uses C#, yer it should be straight forward to convert. Lucky i didn't put any try, catch statements in there

(I found a small error in my code, instead of referring to the perameter in my sub for forwards and backwards, it was using the direct object integer. Thats all fixed now and uploaded so if you just download again it is the updated version)
jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 21st Aug 2007 19:55
Karsten,

In previous experience, it's just a case of creating a class library project and adding the existing classes. Should hopefully be pretty simple and painless.

Outside of here everyone uses C#, you'll be hard presses to see VB examples of most things. But for me it's usually just a case of Copy.

Paste into http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx

and then Click convert.

Also VB.net also supports Try Catch so no worries

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 21st Aug 2007 20:23
Good one Karsten. I'm waiting to see more progress on this one!

No, you're not the only one coding in C# around here, as I also use it. Actually, LightEngine (my OOP DGDK.NET Plugin, do you know it?) is completely written in C#, something like 10000 C# LOC.

Cheers!

Thiago
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2007 20:30
no conversion to VB.NET is necessary regarding this dll, he just needs to make a dll project, slap his code class in there and build the dll in the C# DLL Project.

VB.NET can use any C# dll as is, and vica versa - its all in IL at that point. VB.NET and C# code, when compiled to IL is exactly the same, the only difference is the IDE syntax used to write the source code. The IL is then compiled at runtime by the .NET framework

Thanks Karsten

My DBP plugins page is now hosted [href]here[/href]
Karsten
17
Years of Service
User Offline
Joined: 24th Jan 2007
Location: N/A
Posted: 21st Aug 2007 22:17 Edited at: 21st Aug 2007 23:16
OK, I have finished the new VanillaLib.dll, you can download it at the top of this post.

In order to use VanillaLib.dll with your projects...

Add the reference to your project.

Add the VanillaLib usage directive i.e using VanillaLib;

anywhere in the main game loop use...

VanillaLib.clsVanillaCollision.VanillaGravity(<parameters> );
VanillaLib.clsVanillaCollision.VanillaCollision(<parameters> );

(Although probably better if you assign it to a global static variable)

I included the VanillaLib source too even though it was just as CattleRustler and Jasuk70 said; a case of putting the class inside of a class library project. (I guess Bill Gates wasn't lying when he said that .NET was easier to use :p)

Jasuk70 - Wow, do you know if they do one of those for ASM or ADA, that would benefit my Uni work

kBessa - Yes, I know of your project, I PM'd you about it when I chanced upon its SVN back in the days when it was called DarkEngine. Wow, thats quite a lot of code, would be fun to put that into the mentioned C# -> ASM converter :p
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2007 23:17
cool beans Karsten, Ill try out when I have time

My DBP plugins page is now hosted [href]here[/href]
genex
17
Years of Service
User Offline
Joined: 6th May 2007
Location:
Posted: 27th Aug 2007 19:37
looks good karsten!!

When you back from holiday so we can carry on with the game and have that meeting?!

[url]www.SuperMoto-Masters.com[/url]

Login to post a reply

Server time is: 2024-11-19 15:37:17
Your offset time is: 2024-11-19 15:37:17