Sign in to follow this  
toXic1337

Bouncing Ideas Around!!

Recommended Posts

Hello to Everyone!! I'm starting a new project. Since I've been wanting to gain more experience in game development (specifically in the area of networking), I have decided to create an online version of traditional pong (with -some- modification). Since I want the game to be as "old-schoolish" as possible, I'm probably not going to have the best graphics (i.e. simple paddles and perhaps a square block for the ball :) ) I have completed an initial design template and I've ran into some things that may present problems and I wanted some feedback: 1) I want to make this at least an 8 player game. I was going to have a circular arena (or maybe octagonal). The thing I was wondering is how to handle collision with a ball inside a circle. Like how to tell when its outside the arena. I realize I could use "pixel-perfect" coll., but I wanted to try something else if possible. 2) Since paddles will probably be rotated as the player moves around his designated space (if the arena is a circle), I suppose I will HAVE to use pixel-perfect in this situation. Not sure though. 3) To add difficulty to the game, I was going to use really small paddles (1.5X size of ball perhaps). Should I use the mouse for input (precise) or should I use keyboard (which may introduce a little more difficulty for the player)? I realize this could have been posted under the "Game Design" forum, but I wanted to try it here because of the coding technique involved with rotation and all. There is no need to post code or anything, I'm already researching pixel-perfect and all that jazz. I just want feedback from all you guys and perhaps to know if this has been done before. I think it's a good idea!! :D Thanks in advance all! p.s. Sorry for the long post :P

Share this post


Link to post
Share on other sites
I would do the collision with rather simple geometry/physics. Your paddles are rectangles, your ball is a circle. There is no good reason to do pixel-perfect collision when you can get physically perfect collisions with physically perfect response at no extra charge, just be doing some simple angle calculations and circle-box collisions. You'll have to do your own research on the math portion of it, but i'm just making the suggestion.

Share this post


Link to post
Share on other sites
I know what you're saying BUT

Lets say the ball was traveling at 45 degrees at a slow velocity. The ball is actually a square with transparent corners. Lets also say that there is a paddle at the 45 degree position turned (using rotation, not separate sprites) towards the origin.. or the center of the screen. Given this scenario, if I use the two sprites rectangles to do the collision there will be a visible error. I know that this is negligible but like I said, this is a project for experience.

A square (pong ball) colliding with the rectangle of a rotated image will have visible collision bugs.

Share this post


Link to post
Share on other sites
I think what leiavoia was trying to say is more so: If you store all the objects locations in memory, you can just do something like this;

Play area is a sphere w/ a known radius.
Game ball is another sphere w/ a known radius.
If the game ball's location (+its radius), is measured from the center of the play shere; if that is a greater value than the play sphere radius, then you know the sphere had either reached the edge, or has passed the edge of the play sphere.
Check if a player paddle is in the right spot to 'block' the sphere.

Comes down to, you can check all the collisions with geometry and vectors. Then just draw it where your collision/update code says it should be.

I think.

edit: remembering that this is going to be online, tells me its also going to be client/server. so it would be very difficult (i think) to have any of the collision being done via quad intersections on the screen. shouldnt be too hard to get going. the thing im wondering about is the paddles, only getting 1/nth of the sphere, and having to get the paddles to comply with thoes bounds. maybe you already have that part figured out.

Share this post


Link to post
Share on other sites
That is correct. You would not perform collision detection between two sprites. You perform the collisions between two geometric objects. They are rendered as sprites/textures of course, but the actual graphic information and the collision geometry need not be related. For instance, please check out this screenshot to see my project from a few months ago. It shows the graphics with polyogn overlays. Collision is only performed on the polygon geometry (normally invisible to the player, this is a debug shot), not on the graphics themselves.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this