Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Contest][Blitz] Cervantes' Slime Volleyball!!
Index -> Programming, Visual Basic and Other Basics -> Other Basics
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Cervantes




PostPosted: Mon Mar 01, 2004 7:10 pm   Post subject: [Contest][Blitz] Cervantes' Slime Volleyball!!

no, I'm sorry, I'm not done it yet Confused

however, I do have a question. Question

keeping in mind that this is a 2D game, what would be the best way to approach collision data (how the circular ball bounces off the circular players)

1.) Homer Simpson style with angle and weight and velocity
2.) Thoughtful style with ballx, bally, ballxspeed, ballyspeed.

Both have their disadvantages.

1.) In homer's style I couldn't get the ball to bounce correctly off the wall. I know that the angle of reflection = the angle it came in at, but I couldn't figure out how to incoporate that into the code.

2.) In thoughtful's style, the ball's didn't bounce very well when I tried to replicate it. Yes, in thoughtful's prog it was flawless. But I think I copied everything right.
When I was running the prog in Turing I once had 2 balls whose y velocity was 0 and that were on a slightly different y axis, though close enough that they would still hit. They kept bouncing straight back and forth, with their y speed not changing, and their x speed simply reversing. That shouldn't happen.

ANYWAYS, Rolling Eyes both ways work, but I need to iron out the bugs of whichever one I use. If anyone can think of how to fix the problem, then plz post!! Also I can show you the code if you want.
Sponsor
Sponsor
Sponsor
sponsor
jonos




PostPosted: Mon Mar 01, 2004 8:53 pm   Post subject: (No subject)

ive seen both and i like homers, and if it works better for you then you should use it. as for the wall bouncing, shorthair could probably help you out with that, just ask him casue he's the blitzer guy.

anyways, some questions

are you using images for your objects or are you drawing spheres and keeping z axis at 0 and the camera angles set so it looks 2d?

anyways, good look with the game, i haven't really done anything with mine yet.
Cervantes




PostPosted: Mon Mar 01, 2004 9:01 pm   Post subject: (No subject)

well I suppose I'm keeping the z at 0 so it looks 2D, but really I just did it like so
code:

Graphics 800, 600


instead of
code:

Graphics3D 800, 600



shorthair might be able to help, but if he can its not cuz of knowledge of blitz. If he can it'd be because of programming knowledge and math knowledge. It's not a syntax problem Smile
shorthair




PostPosted: Mon Mar 01, 2004 9:03 pm   Post subject: (No subject)

just to let you both know , after its done im taking it anad together were going to ( learn and code ) it ito an isometric op down view ,so that you are like behind one of hte players , so it almost becomes like tennis , that way we can move left right up and down , its actually very easy , and i cant wait to upgrade cervantes version of it , By the way about your problem cervantes , you should use homers way , its much more efficiant , the code should not be that hard as there are sin cos and tan and all math functions on blitz , to detect when they hit , you can use the Collision X, Y commands , their very useful , if not you can actually use WHATDOTCOLOR , yeah i know its lame for blitz but it can be done
Cervantes




PostPosted: Mon Mar 01, 2004 9:19 pm   Post subject: (No subject)

yeah I was planning on doing that 3D slime volleyball eventaully shorthair but if you say its easy then I guess I will do it fairly soon afterall Smile

Homer's way it is then!!
Cervantes




PostPosted: Thu Mar 04, 2004 6:00 pm   Post subject: (No subject)

CollisionX, CollisionY, and CollisionZ require the use of entities. AKA its a 3D command.

Should I just go straight to the 3D version of it? Or should I continue trying to make it in 2D first? If I keep going in 2D, how much of the code will be useful in the 3D version? (talking about the basis, not things like scorekeeping or fancy titles)
jonos




PostPosted: Thu Mar 04, 2004 6:52 pm   Post subject: (No subject)

well, you could use all 3d commands and just not use a light (which will make it look 2d) and then to make it 3d just change the camera position/rotation and add some light and voila, an awesome prog in 3d. then you could submit the 3d one and get bonus bits. things get more complicated with the z axis though, it takes getting used to. you also have to set your camera up in the right position to see everything or you think that you create smoething that isn't working but really is, the camera angle is just in the wrong place and does not check it. id say go with 3d and just forget z axis for now.l
Cervantes




PostPosted: Sat Mar 06, 2004 8:20 pm   Post subject: (No subject)

the whole point of me doing it in 2d was cuz i don't know 3d Confused
jonos




PostPosted: Sat Mar 06, 2004 11:05 pm   Post subject: (No subject)

you'll soon learn though. i didn't know anything about working in 3d until i copy and pasted some of the code from the help in blitz and then started modifying it.
Cervantes




PostPosted: Mon Mar 15, 2004 7:06 pm   Post subject: (No subject)

Alright so I've been learning the ways of the dark side er.. 3D aspect to Blitz and I'm wondering about Collisions. Sure, its incredibly simple to detect collisions, just use Collision & EntityCollided. However, How do you determine collision data. In other words, how do I determine the new angle and velocity of the ball when it collides with the player? The last parameter for Collision, the one that controls what will happen (stop, 'full sliding collision', "prevent entities from sliding down slopes") does not seem to do the trick. I took the collision example and modified it so that it was 2 spheres colliding and tried using all 3 flags in the collision command, but none produced the desired effect. Using a flag of 2 or 3 yielded the moving sphere sliding along the other sphere and then continueing on in the same, original, direction.

Try this to see what I mean if you didn't follow my text:
code:

Graphics3D 800,600

Const CUBE_COL=1
Const SPHERE_COL=2

SetBuffer BackBuffer()

camera=CreateCamera()
CameraViewport camera,0,0,800,600
PositionEntity camera,0,0,-5

light=CreateLight()

cube=CreateSphere()
PositionEntity cube,-5,001,5
EntityColor cube,70,80,190
EntityType cube,CUBE_COL

sphere=CreateSphere(12)
PositionEntity sphere,5,0,5
EntityColor sphere,170,80,90
EntityType sphere,SPHERE_COL

Collisions SPHERE_COL,CUBE_COL,1,3

While Not KeyHit(1)
       
        MoveEntity sphere,-0.02,0,0
       
        UpdateWorld
        RenderWorld
       
        If EntityCollided(sphere,CUBE_COL)
        Text 370,80,"Collided !!!"
        EndIf

        Text 335,500,"Collision Detection"
       
        Flip

Wend
End


(I know it says CUBE_COL, too lazy to change it Confused)

So I guess my question is: is there any command or simple combination of commands that will give me the correct collision data? If not, is it difficult to determine the collision data mathematically?


Also, while typing this, I thought about Mazer's comment about, how, in pong, if you move the paddle up or down while the ball hits the paddle, the ball will yield a different y velocity than if the paddle were stationary. This got me thinking about a similarity of that in SV: the player accelerating upwards while the ball hits him (jumping) or accelerating downwards while the ball hits him (falling back to the ground after a jump).
This may not be mathematically correct, but the easiest way I thought of to make it as real as possible would be to add the players y velocity to the ball's new y velocity. Is that how it's done?

(Crying or Very sad wish I was taking physics now Crying or Very sad)
Cervantes




PostPosted: Wed Mar 24, 2004 5:59 pm   Post subject: (No subject)

EARTH TO SHORTHAIR!! (well, maybe compsci to shorthair.. (well, maybe CERVANTES TO SHORTHAIR!!))

need.. help... the physics!!... aaaaaaaaaugh
*dies*
Cervantes




PostPosted: Sun Nov 28, 2004 4:13 pm   Post subject: (No subject)

Shorthair, you really need to read these things. I was just reading through this thread now and I'm once again thinking how cool it would be to make this program. Unfortunately, I need you to be alive and functional to make it.
shorthair




PostPosted: Sun Nov 28, 2004 10:45 pm   Post subject: (No subject)

Lets do her up this weekend coming , get some serious work done on it


we can start from scratch if you want , but lets make a 2d physics engine this weekend


alow it to use gravity angle and weight ............and then build collision detection into that


after that we ca nbase our games around our engine


i built one in about 2 hours last time .......


Later Days
Cervantes




PostPosted: Mon Nov 29, 2004 3:34 pm   Post subject: (No subject)

Deal.
When you say you did it in 2hours, is that 2D or 3D?
shorthair




PostPosted: Mon Nov 29, 2004 5:10 pm   Post subject: (No subject)

2d
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Other Basics
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: