Humor Random Comments Thread

BruceJohnJennerLawso

Dread Lord of the Idiots
Addon Developer
Joined
Apr 14, 2012
Messages
2,585
Reaction score
0
Points
36
You mean code for collision detection, or code that handles the physics once a collision is detected? The second can come in a rather wide range of complexity, from simple energy and momentum calculations to "oh hell I didn't want to write 100'000 lines"-rag-doll physics...

Both, but the complexity doesnt need to be too extreme, just simple stuff involving rigid boxes, spheres, and other simple shapes in 2D
 

Andy44

owner: Oil Creek Astronautix
Addon Developer
Joined
Nov 22, 2007
Messages
7,620
Reaction score
6
Points
113
Location
In the Mid-Atlantic states
Someone around here was asking what happens when you jump up inside a vehicle with centrifugal artificial gravity. Skip ahead to about 42 min to see a cosmonaut throwing darts on a curved path inside a big centrifuge...and watch the rest of the vid while you're at it, some interesting stuff.

 

Linguofreak

Well-known member
Joined
May 10, 2008
Messages
5,029
Reaction score
1,269
Points
188
Location
Dallas, TX
Just ran across a facepalm inducing article:

Apparently, Steam for Linux includes a shell script that runs "rm -rf $STEAMROOT/*". If the environment variable STEAMROOT does not exist, or has been nulled by some action (like moving the Steam directory), this becomes "rm -rf /*", which, for people who aren't Unix users, means "Delete *ALL* the files!!!". It will literally attempt to delete every file on every device attached to the system, including on backup drives and mounted network drives. In most cases it won't succeed (it will just delete every file that the user running Steam can access), but the worst part is that "rm -rf $STEAMROOT" would still do what was intended in normal circumstances without the apocalyptic bug if $STEAMROOT is null, as "rm -rf" with no argument does nothing.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,862
Reaction score
2,126
Points
203
Location
between the planets
Both, but the complexity doesnt need to be too extreme, just simple stuff involving rigid boxes, spheres, and other simple shapes in 2D

Uhm... there's no boxes and spheres in 2d... :shifty:
You're strictly dealing with rectangles and circles here. Which are rather easy to do collision detection with. rectangles: Check if point is inside rectangle. Circle, check if point is within radius (to save on cycles, define the collision circle as the squared radius and compare a^2 + b^2 directly to that without having to take the root).

Even elipses aren't that much of a problem, if you define the collision area as a non-uniformly scaled circle (usually precise enough for gaming applications) and just scale your input coordinates accordingly instead of trying to mathematically figure out if the point is exactly within the definition of an elipse.

From there it's pretty much pure physics and depends entirely on what level you need. The most primitive one, used in [ame="http://de.wikipedia.org/wiki/Pong"]Pong[/ame]-likes, is to simply invert the appropriate signs of the movement vector, which automatically results in entry angle == exit angle. If both objects involved in the collision have a movement vector, it gets more complicated of course, but nothing you shouldn't be able to handle relatively easy.
 
Last edited:

RisingFury

OBSP developer
Addon Developer
Joined
Aug 15, 2008
Messages
6,427
Reaction score
492
Points
173
Location
Among bits and Bytes...
rigid boxes, spheres, and other simple shapes in 2D

I don't know how you managed to fit a box and a sphere into two dimensions.......................................


If 2D collision detection is what you want, it's VERY VERY simple, with any shape. Take two textures and check pixel-by-pixel if they overlap.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,326
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I don't know how you managed to fit a box and a sphere into two dimensions.......................................


If 2D collision detection is what you want, it's VERY VERY simple, with any shape. Take two textures and check pixel-by-pixel if they overlap.

There are even much simpler and faster algorithms around, if you just use the coordinates. Especially if you are just interested in simple geometric shapes.
 

Athena

Smitty Werbenjagermanjensen
Joined
Feb 23, 2013
Messages
595
Reaction score
0
Points
16
Location
Virgo Supercluster
10917447_422137827939359_7990733315721410575_n.jpg


I feel the struggle...:lol:
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,862
Reaction score
2,126
Points
203
Location
between the planets
And that doesn't mention the changes to the nouns by cases. Still, slavic tongues have it harder. They still got the whole 7 latin cases.

And I asked a friend from Finland once how many cases they actually had, because I heard ridiculous numbers. He told me he wasn't really sure... :blink:
 

RisingFury

OBSP developer
Addon Developer
Joined
Aug 15, 2008
Messages
6,427
Reaction score
492
Points
173
Location
Among bits and Bytes...
There are even much simpler and faster algorithms around, if you just use the coordinates. Especially if you are just interested in simple geometric shapes.

Yes, if you are interested in simple geometric shapes. But I said it'd work with any shape.

Today's graphics cards can do this very quickly, so it's not like it should be a problem. But that's assuming you have access to the graphics card.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,326
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yes, if you are interested in simple geometric shapes. But I said it'd work with any shape.

Today's graphics cards can do this very quickly, so it's not like it should be a problem. But that's assuming you have access to the graphics card.

It still takes longer than for example defining a complex shape from simpler shapes and then just using some smart algorithm (on the GPU or not... a GPU is a great choice for such calculations if you have millions of primitives to check)
 

RisingFury

OBSP developer
Addon Developer
Joined
Aug 15, 2008
Messages
6,427
Reaction score
492
Points
173
Location
Among bits and Bytes...
It still takes longer than for example defining a complex shape from simpler shapes and then just using some smart algorithm (on the GPU or not... a GPU is a great choice for such calculations if you have millions of primitives to check)

Sure it does, but if we're talking about game design - and let's face it, we are - the per-pixel check will allow you to get the algorithm done, then go straight to art. Any shape and any animation will be supported without you putting in extra effort to make sure collision works.

Sure, the algorithm is slower. Sure it is. I agree. But games don't deal with millions of 2D objects, they deal with tens and hundreds. Even a weak computer these days can easily handle that.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,862
Reaction score
2,126
Points
203
Location
between the planets
Sure it does, but if we're talking about game design - and let's face it, we are - the per-pixel check will allow you to get the algorithm done, then go straight to art.

Actually, this is what you do almost anywhere in coding but in game design. Most applications really don't care that much how much cycles they are eating... only games seriously optimise (OSes try to, but I can't quite tell how succesful they are at it :lol:).

Still, it depends on the kind of game. With a simple 2d game you can probably get away with it, but even here you have to watch it real good that the suboptimal algorithms don't pile up. If your rendering isn't optimised, and your collision detection isn't, and maybe some other stuff isn't too, you can end up in a framerate train-wreck without having much to show for it. Been there, done that :lol:
 

kamaz

Unicorn hunter
Addon Developer
Joined
Mar 31, 2012
Messages
2,298
Reaction score
4
Points
0
Top