Orderly Mayhem
May 21, 2012, 01:12:22 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Contact Staff List Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: next stop: Collision Detection  (Read 1823 times)
BS-er
Moderator of Mayhem
Administrator
*****
Offline Offline

Posts: 2150


View Profile
« on: June 15, 2007, 01:20:22 PM »

Collision detection is one of the more difficult aspects of 3D game development.  I prefer to roll my own physics due to my engineering background, but detailed collision detection is complex enough that its best to look for existing solutions.  For now I'm trying to integrate the free Opcode collision library.  Hopefully the result will be acceptable collision handling for units and buildings of all shapes and sizes.  When you're playing a game and you shoot at a random building in the world, you never really appreciate the complex set of operations that lead to the ricochet particles at just the right spot on the building.
Logged
OvermindDL1
Casual Support Developers
*
Offline Offline

Gender: Male
Posts: 278

Programmer


View Profile WWW
« Reply #1 on: June 18, 2007, 02:49:10 AM »

Opcode is quite nice on smaller scales, quite speedy.  For large worlds however it is not so efficient.  It does not do any partitioning at all, thus you will need to do that manually, which is still not too hard, but is an irritant.  If you use a physics library like Newton, you do not need to use the physics part, just the collision detection, and it does and handles proper partitioning in a very efficient mannor (and you would have a nice physics engine to use if you ever wished to use it).  As long as you do proper partitioning though, Opcode works quite well and is easy to use.
Logged

BS-er
Moderator of Mayhem
Administrator
*****
Offline Offline

Posts: 2150


View Profile
« Reply #2 on: June 18, 2007, 05:50:06 PM »

For some reason I thought the Newton system had a fairly costly license for commercial applications.  After just looking I wasn't able to confirm that though.  I have a reasonable partitioning scheme that has served me well but Newton may be worth a look if it's free or inexpensive.
Logged
OvermindDL1
Casual Support Developers
*
Offline Offline

Gender: Male
Posts: 278

Programmer


View Profile WWW
« Reply #3 on: June 18, 2007, 07:25:04 PM »

Newton is free for all purposes with regardes to price, he just will not give out the code because he is does not want to 'give out his secrets for a very fast *accurate* solver the likes that havok and ageia and so forth do not have', which are very fast as well, just not accurate.

He has briefly describes his partitioning scheme though.  He does not use anything similar to a tree or grid or what-not, but his physics worlds are arranged like a grid internally, but are accessed very differently.  For example, if you try to do a raytrace in the Ogre engine, it will return an object, but not a point, and it takes a certain amount of time to perform the calculations, however, to do the same raytrace using the newton world, for anything below about 2000 to 5000 meters, the speed of newton's calculation will be much faster then Ogre's, and it returns the object(s) it hit, the exact position it hit each object, the normal of the polygon you hit, and so forth.  Heck, if you used newton just as a fast raytrace for bullets and so forth then that would be worth it by itself.
« Last Edit: June 18, 2007, 07:29:11 PM by OvermindDL1 » Logged

JonathanS
Administrator
*****
Offline Offline

Gender: Male
Posts: 278



View Profile
« Reply #4 on: July 13, 2007, 11:15:14 AM »

You mentioned costly liscense and made me think of Raknet. You using that for your multiplayer or are you writing your own?
Logged

JonathanS


BS-er
Moderator of Mayhem
Administrator
*****
Offline Offline

Posts: 2150


View Profile
« Reply #5 on: July 13, 2007, 12:23:54 PM »

That's to be determined.  We'll certainly look at Raknet to see what it can offer that we could really use.  I would want to investigate its reliable protocol, and what are its advantages over TCP.

I'll be looking for other multi-platform alternatives to Raknet as well.
Logged
OvermindDL1
Casual Support Developers
*
Offline Offline

Gender: Male
Posts: 278

Programmer


View Profile WWW
« Reply #6 on: July 16, 2007, 05:06:49 AM »

TCP has a rather large amount of overhead (minimum header size of 80 bytes, sometimes more depending on payload), UDP has a max header size of 8 bytes, RakNet adds on I think it was 13 bytes to add reliability.  TCP does quite a bit more then just reliability, hence the monstrous header size, but no one ever uses anything else of it.
Logged

AcneVulgaris
Full Member
***
Offline Offline

Posts: 120


View Profile
« Reply #7 on: July 16, 2007, 11:41:20 AM »

I looked into SDLNet this weekend, and started setting up a class to wrap it up nice and tidy for us.  I think I can figure out how to do relaible UDP with it.
Logged
OvermindDL1
Casual Support Developers
*
Offline Offline

Gender: Male
Posts: 278

Programmer


View Profile WWW
« Reply #8 on: July 16, 2007, 03:01:03 PM »

SDLNet?
Here are reason's not to use it (not even just compared to raknet, but many libraries):
It's reliable layer is TCP (very slow).
It's unreliable layer is UDP (expected).
Building reliabilty on UDP is not something you can do in just a day, or a week, or a month really.  With reliability you have to account for if a packet drops at wierd times, if it takes different paths and you get a resent packet before the original, etc... etc...  There are a whole ton of things you have to account for.There are no channel ordering.  Example:  In RakNet you can have multiple channel's for ordered data, instead of just with TCP or most reliable/ordered UDP patterns, if you plug in data then you have to wait for the sliding window (another thing you *have* to program in for any kind of efficient ordered reliability).  With Raknet you could have one thing on one channel, and another on another channel, if one gets hung up a bit because of lost packets and gets delayed a little, then you have the other channel unaffected working fine.
There is no prioritization.  In RakNet there are three prioritization levels, (well four, but the highest is System and not for program use), higher prioritization's are sent first, but it makes sure that lower ones do not starve too long either if you pack too many things too high.
Coallescing it does not.  Raknet coallesces multiple game 'packets' into real packets (as well as breaking them up among multiple packets if it is too big) since sending out a single packet is not efficient.  For example, in near every networking library like SDLNet (not sure if SDLNet does it this poorly...) then every time you write something off to the network stream then it causes a packet to be created with just that data (horribly inefficient).
Reliability ordered/unordered.  TCP (SDLNet's reliability protocol) has no concept of unordered reliable packets.  RakNet has three ways to send packets, Unreliable, Reliable_unordered, Reliable_ordered.  Unreliable is as it sounds.  Reliable_unordered means that packets sent will be reliable, but may arrive in no set order (nice and fast since if packets get dropped then later packets do not have to wait up for them).  And Reliable_ordered is like TCP, they send and receive in an exact order (and with RakNet they also have multiple channels for different ordering streams).

So no, you will not just 'figure out how to do reliable UDP', there are far more variables then you could really guess, and most will not manifest themselves till you get on slower connections that love to drop packets and not your nice safe and fast dsl/cable or lan connection.  I had to create a reliable layer on UDP a long time ago and I had to deal with such connections, it was heck.  I have an admiration for the level of work Rakkar has done on his library and am amazed at how complete it is with handling even the wierdest of cases.

As they say, do not reinvent the wheel.  RakNet is cheap, and for how cheap it is you will not find anything more complete or powerful.
« Last Edit: July 16, 2007, 03:02:43 PM by OvermindDL1 » Logged

AcneVulgaris
Full Member
***
Offline Offline

Posts: 120


View Profile
« Reply #9 on: July 16, 2007, 03:43:37 PM »

I actually had to do something very similar with unix sockets for a systems programming class, so I have some idea how difficult it can be....and have some ugly, deadline driven code to start from.  I also have  packet delayer/dropper/resequencer code for testing it...so this is doable.

You mentioned other libraries that do this already...I would like to take a look at them.  Can you give me a list.

I was under the impression that rakknet was $5000, which is cheap for a real company, but we are kind of a shoestring operation.  If I can write something in two weeks that makes it worth it to me.  Two months, maybe not, but I honestly cannot see it going that far.
Logged
BS-er
Moderator of Mayhem
Administrator
*****
Offline Offline

Posts: 2150


View Profile
« Reply #10 on: July 16, 2007, 05:43:39 PM »

I believe Raknet offers an online distribution license for around $1000, to more easily accomodate the indie developers, and I think its free to use for development, so its worth evaluating, and it may be best if we build a suitable wrapper interface.
Logged
AcneVulgaris
Full Member
***
Offline Offline

Posts: 120


View Profile
« Reply #11 on: July 16, 2007, 05:57:45 PM »

$1000 is more like it.  I'll wrap it up nice so we can swap it out for another lib later if we need to.
Logged
OvermindDL1
Casual Support Developers
*
Offline Offline

Gender: Male
Posts: 278

Programmer


View Profile WWW
« Reply #12 on: July 16, 2007, 06:40:33 PM »

Raknet has a variable pricing scheme of "You pay what you think it is worth".  The more you pay, the more support you will get, and he will accept a max of $5000, which if you pay all of that they he will even spend some-odd hours (8 I think) programming for you.
If your project will never generate money, then you do not have to pay, closed-source or open-source, does not matter.  If you project will make money then you do have to pay at the latest of when the product first generates income (you do not have to pay earlier, such as during development).  The minimum amount you can pay, as I recall is $100 (do not quote me on that, it was correct as of a year ago and have heard of no changes, but I do not honostly know if that is still current).
The only time you *have* to pay $5000 is if you are making an engine that you will in turn sell to others (think the UEngine).
And yea, wrapping is easy enough, but you lose out on some of RakNet's features like its very nice Bitstream class (can even serialize out individual bits, compressed integers, etc... etc...).

EDIT:  Yep, found pricing, I was right (except it is 8 hours programming he will do for you at every $1000 you give, or additional 'support' at $100 an hour).  It is on its main page:
Quote
Download 3.0 Beta.
By downloading you agree to the Creative Commons Attribution - NonCommercial 2.5 license. Use of RakNet under the terms of a different license requires purchase of said license and agreement to the terms therein.

Buy Single Application License.
View Single Application License.
Single application. Any distribution method.
$100 and up - Pay what you can afford based on what feel RakNet is worth.
No regrets. 90 day Money back guarantee if you decide RakNet isn't working for you.
Free library support included.
Payments of $1000 include 8 hours of personalized support, including phone and programming.
Additional personalized support may be purchased at $100 an hour.

Buy Engine License.
View Engine License (Coming Soon).
Unlimited applications. Any distribution method. Allows resale of engine.
$5000 - Fixed price.
No regrets. 90 day Money back guarantee if you decide RakNet isn't working for you.
Free library support included.
Includes 8 hours of personalized support, including phone and programming.
Additional personalized support may be purchased at $100 an hour.

EDIT2:  Also found this:
Quote
Licensing is only required on your application's commercial release.
All versions include full source.

Non-profit applications or engines.
You can use RakNet for free under the Creative Commons Attribution - NonCommercial 2.5 license*. .

Single application license.
A Single Application license* applies to commercial software sold both online and retail. You may download RakNet immediately and are only required to pay when you ship your product. At that time you choose how much to pay based on what you can afford and how much value you feel RakNet has brought to you.

Site licenses and commercial engine development.
An unlimited application Engine License* applies to commercial software sold using any distribution model and also allows resale of your engine. You may use RakNet as long as you wish during development. When you wish to sell your engine or release your product, you may purchase a license at a fixed fee of $5000.

* Third party libraries are included in the download to facilitate sample code. These libraries are included only for convenience and have their own, separate, licensing agreements. These libraries are not required to use RakNet.

So for your project, minimum of $100 needed by the time you first put it up for sale.  He would of course like more, but it is not required.
And yes, Raknet's main project (the reason it was developed) was for an Action MMO, requires great optimizations, hence how this library is as it currently is.  Rak'kar is one of the main programmers on that Action MMO.
« Last Edit: July 16, 2007, 06:52:22 PM by OvermindDL1 » Logged

BS-er
Moderator of Mayhem
Administrator
*****
Offline Offline

Posts: 2150


View Profile
« Reply #13 on: July 16, 2007, 08:44:09 PM »

Raknet is looking better and better.  Thanks for the details.
Logged
OvermindDL1
Casual Support Developers
*
Offline Offline

Gender: Male
Posts: 278

Programmer


View Profile WWW
« Reply #14 on: July 17, 2007, 03:43:30 AM »

Yick, my grammar/spelling was horrible earlier (that is what I get for posting when I am already asleep)...

I have already gone through just about every library I could find for game use from Sound, Networking, Graphics, Input, Scripting, etc...  Balanced usefulness, price, programming time saved, power, license (closed source commercial must be allowed), etc...  Raknet was what I chose for networking, and of all the categories it was the only library that actually cost money for commercial usage.  I still have my test code from when I was testing all those libraries earlier as well.
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!


Google visited last this page May 18, 2012, 11:39:21 PM