RE: Flash Q&A Thread 4 (Full Version)

All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy



Message


somebody621 -> RE: Flash Q&A Thread 4 (8/30/2007 18:02:05)

Hey, Eragon, can you describe your system to me?




flsg -> RE: Flash Q&A Thread 4 (8/30/2007 18:58:19)

somebody621: did you received my PM? lol
I think it works like that:
he gets the x and y limits of the mc(so a rectangle collision). by calculating the x and y positions, he gets the direction. Then he does the same thing to another mc. Then he calculates to see if the x and y coordinates(of the limits) are bigger/smaller than the other mc's. If they do, there's a collision.




EragonZZZZ -> RE: Flash Q&A Thread 4 (8/30/2007 21:31:28)

Nopes. Not even close :P
My system took a lot of mathy stuff and a bit of eyeballing to see if it would work. Thus far, it's pretty damn sweet.
However, it's made for an art-based game, so it's based on doing accurate collision detection on VERY irregular shapes.

Take Object1 and Object2
(suppose both are longer than they are wide..works both ways, but this is easier to explain)

Define 3 coordinates for each: one is the center of the MC, one is the center of the top half, and one is the center of the bottom half.

Define 2 radii for each: one is the average of the MC height and width. This number corresponds to the center point, forming a large imaginary circle.
The other is: ((obj1.Width + obj1.Height) / 4) * (obj1.Width / obj1.Height). This corresponds to all three points, forming three smaller imaginary circles.

Since testing between circles is so easy, all the code proceeds to do is check if the circles are intersecting.
I *think* I'll refer to a collision as when four..maybe three...or more little circles (in total) register a 'hit' with a bit circle.

Here's a nice little diagram of this in action:
Here ya go.
I'm aware that this *may* hit trouble with:
-Large objects vs small objects
-Lag? So far, no stress tests have been run..but early demos show no change in framerate. At all.
-Objects that barely fill their alloted volume (dimensions)..think a giant L...ton of blank space :P

No stealy my method!
jk..but credit if you use it, please?

NOTE: So the game doesn't explode, I'm going to use several 'cheats' to make sure EVERY object isn't tested against EVERY object in-game...if you're 1000 feet away, i KNOW you aren't touching me.




somebody621 -> RE: Flash Q&A Thread 4 (8/30/2007 21:55:13)

If you want I can explain my rectangle-rectangle SAT. It's actually extremely simple. It's probably a little more accurate, but it will require predefining. However, there are many more advantages.

-The ability to correctly resolve a collision.
-Your method has the work increase by a whole ton when you add more and more objects. Mine also has the work increase exponentially, but by not as much.




EragonZZZZ -> RE: Flash Q&A Thread 4 (8/30/2007 22:22:11)

Nah, thanks man, but I prefer to keep all my code my own...tis how I learn?
I've looked at rectangle-rectangle SAT. I've read the metanet tutorial on it, too ^_^

See, they needed to resolve collisions correctly. My game will have some physics in it, but it won't need to worry about resolving a collision with what I have in mind :P
Also, I failed to mention that mine does show various degrees of overlap...all I gotta do is interpret them :D

Yeah, I can see why yours would require a bit less work. I'm still a fan of mine though lol.
Although I wouldn't mine you explaining what yours checks. :P




Burning Raven -> RE: Flash Q&A Thread 4 (8/31/2007 7:39:51)

hmm you guys do know your stuff! I might need to ask for some help with scripting with my games but in the mean time add my name to the list!
~Raeven




flsg -> RE: Flash Q&A Thread 4 (8/31/2007 15:42:50)

eragon: don't you think the bitmap-level collision code I gave you was more accurate and less laggy? lol
anyway your method is very original
burning raven: why do most people today hire someone to do their job? lol if it's your game, code it yourself[;)]




EragonZZZZ -> RE: Flash Q&A Thread 4 (8/31/2007 17:40:52)

Oh yeah, I'm using that concept for the terrain :P
However, for what I wanted to happen with object/object collision, it didn't work. Just wasn't practical :P
But I've recently tested mine out.

-No optimization...every object is involved.
-30+ objects on stage.
-Objects are complex vector art. No primitives.
-Every object tests against every other object (well..I lied...small optimization, if obj1 tests on obj2, obj2 doesn't test on obj1. But very simple optimization).
-465 collisions checked per frame.
-No lag; remained at a constant 18 fps.

Albeit...each added object increases the load drastically...framerate dipped below 9 with 50 objects D:<

Thanks...I suppose original is a sort of compliment x_x






Burning Raven -> RE: Flash Q&A Thread 4 (8/31/2007 23:01:30)

Flsg: well I didn't say I was hiring you to code the game I said I may need some help in the codding of the game as the biggest thing I have codded myself without a tutorial is something moving with the WASD keys and thats not what I kneeded :P so if I get stuck on a line of script for a inventory or elemental resistances I will come to you guys for help not say DO IT! DO MY SCRIPT NOW!!
~Raven




flsg -> RE: Flash Q&A Thread 4 (8/31/2007 23:21:40)

Burning Raven: ok sorry if I misunderstood your meaning. Lots of people today hire some guys to do ALL the works for them...they don't even try to do something...




Burning Raven -> RE: Flash Q&A Thread 4 (8/31/2007 23:52:16)

Flsg: not your fault by the sounds of things a lot of people just come here ask for written scripts and leave so its understandable!
~Raven




EragonZZZZ -> RE: Flash Q&A Thread 4 (9/1/2007 1:19:43)

What is it about flash that encourages people to ask for code straight up?
(not you raven, this is musing)

Here, Newgrounds...my gosh, everywhere people are like
"If you give me script that would be great ^.^"

And I'm like
"If you stopped asking and learned for yourself that would be great ^.^"




The Illusive Man -> RE: Flash Q&A Thread 4 (9/1/2007 13:47:32)

Eragon - so true. Tutorials that give you copy and paste code is not great, because people are limited to what's on the internet. I learnt partly through tutorials, but instead of copying and pasting it, i copied it by typing it. That gave a better grounding. I also tried to understand it as i did it. I think that is how to use a tutorial properly.

Any comments on that?




somebody621 -> RE: Flash Q&A Thread 4 (9/1/2007 14:05:41)

d(^_^) Great way. Meh. Eragon, you should find a way to stop your collision system from behing O(n^2). In other words, you need some kind of broad phase collision detection. Some good ones are sweep and prune, a quadtree, and a grid.




flsg -> RE: Flash Q&A Thread 4 (9/1/2007 17:51:05)

somebody621: sorry for being annying but do you think the help I need from you is possible?
althorne: lol great way to learn and remember at the same time. At least you know what you're writing when you do that




EragonZZZZ -> RE: Flash Q&A Thread 4 (9/1/2007 18:31:45)

Althorne wins a cookie.

And somebody...I AM implementing that, dur. I'd be shamed as a programmer if I didn't D:

O(n^2) is on the list of "big things not to perform at runtime"

I'm probably using a variant of grid. What I'm doing is saying that if object two is inside an invisible rectangle around object one, then do a collision test.
Either that or getting the distance from object1 to object2 using Pythagorean theorem. Which do ya think is going to give me less lag? I'm guessing the invisible rectangle one.




somebody621 -> RE: Flash Q&A Thread 4 (9/1/2007 19:10:24)

Actually, if you implement it correctly, bounding circles are more efficient than bounding rectangles. What you do is test the square of the sum of radii against the squared distance of the two circles.




EragonZZZZ -> RE: Flash Q&A Thread 4 (9/1/2007 19:36:32)

Hahaha...how do you think the main method works? Thats exactly how :D




flsg -> RE: Flash Q&A Thread 4 (9/1/2007 21:31:55)

wow it seems that we're the only one here now...XD




The Illusive Man -> RE: Flash Q&A Thread 4 (9/2/2007 3:06:18)

I took a day of computering yesterday for most of the day lol.

And eragon - your code is way over my head. That's why i'm not saying anything :) Yours too flsg




EragonZZZZ -> RE: Flash Q&A Thread 4 (9/2/2007 11:15:16)

Wait, day OF or day OFF?

They actually mean totally different things.
(day of, all day...day off, not all day)

And lol, you'll catch on quickly if I know you. No worries.
flsg, where IS your code? I haven't seen any recently.

(wow, the population of this thread has dwindled to about 3-4 members...cool...its like our dev thread ^_^)




The Illusive Man -> RE: Flash Q&A Thread 4 (9/2/2007 12:50:26)

grrr - these forums pick up every typo (i usually do to...) - I mean off. I was on the internet a grand total of 5 minutes in the morning, and 5 minutes in the evening.




flsg -> RE: Flash Q&A Thread 4 (9/2/2007 13:06:40)

eragon: why should I show it? lol
I'm not going to paste all my project's code on the forum >_<




EragonZZZZ -> RE: Flash Q&A Thread 4 (9/2/2007 16:43:23)

I mean I haven't seen/heard of any code. I'm not asking you to post

code


I'm talking about the fact that you've not mentioned hide nor hair of what your project is actually for or about or whatnot :D




flsg -> RE: Flash Q&A Thread 4 (9/2/2007 18:12:33)

I'm not some other guys, who'd make a thread for a certain project that they didn't even start yet XD
you'll know what it is once I think it's good enough to get released




Page: <<   < prev  4 5 [6] 7 8   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition
0.125