• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

MAD_Mask

Basic phisics and colisions

6 posts in this topic

I newbe so... I understand that this is the place to post.. ( for now anyway ) I am writeing a 2D game (like that old Arc-Voley) and it involves a ball that gets up in the air... 1. How do I calculate the ball''s trajectory taking in acount gravitation and ball''s speed . For the movement of the ball I use iBallX and iBallY as coordinates and add or substract 1 to obtain somme offset. But could somme one show me a more good way to calculate the new iBallX and iBallY than ''+1'' and ''-1'' operations? ( sommething like angles, orientation vectors and staff like that ) 2. And second, if you some one can , a litle input on colisions detections in the same context( gravitation and speed ) ? I realy need your help , because I''dd realy like to make this in the right way .... so please "F1" me The Mask
0

Share this post


Link to post
Share on other sites
1) define a constant gravity factor. in real life it''s 9.8 k/s/s or something like that. then give a vector to your ball. each frame if the ball is not acted upon by an outside outject (besides gravity) then you recaulate the vector based the the gravity factor. otherwise you change the vector based on how it is acted upon.
2) bounding sphere would be easiest with a ball. check out some tutorials on Flipcode.com



How many Microsoft employees does it take to screw in a light bulb?
None, they just declare drakness as a new standard.
0

Share this post


Link to post
Share on other sites

You are going to need to give your ball a velocity. Use a struct to hold your ball data:


struct Ball
{
float pos_x;
float pos_y;
float vel_x;
float vel_x;
float radius;
}

Ball ball;


So you have position components (x and y) and velocity components (x and y) and a radius.

To make the ball go a certain direction, just modify it''s velocity. So let''s say you wanted to make it go at a 30 degree angle at 2 pixels per update:


angle = 6.283185 * 30.0 / 360.0;
ball.vel_x = 2.0*cos(angle);
ball.vel_y = 2.0*sin(angle);


To move your ball according to it''s velocity, do this, once per game update:


ball.pos_x += ball.vel_x;
ball.pos_y += ball.val_y;

0

Share this post


Link to post
Share on other sites

Also to make it act like gravity is pulling on it, do this once per update:


#define GRAVITY (0.5)

ball.vel_y += GRAVITY;


You could use a const instead of a define. Also try values other than 0.5.
0

Share this post


Link to post
Share on other sites
First I whant to apologise for that double thread I started.It may internet conection that gives me trouble. Sorry again.

Anon. Poster:
Thanks for the input. I had a similar struct but no radius.
And the number "6.283185" is, in fact 2*pi ? I think so , anyway may math formula is like that.
I''ll make the changes in my code to make rome for a radius.
But today I foud another problem .. "BltFast" wants integers or
long integers for the x, y parameters wich defines where to put my sprite. So? what I am going to do ? for now I converted the
parameteres to int " BltFast( (int) Player.dcurrX,
(int) Player.dcurrY, ...etc. )
Julio:
Thank you for your replay , and flipcode page is good stuff
much , very much to learn from that page....( I added to my favorites )

I am working very hard in this game but is dificult for me because is my second game in DX ( I made a very ugly tetris clone last week ).
So , I caunting on all of you to give me a help when needed
And sorry for my spelling, I am not so great at writeing in english ,( but I am working at that to )


0

Share this post


Link to post
Share on other sites

Ok , so I managed to put some gravity in my game ( I am still adjusting it ) but now I am having problems with the player coliding with the ball .
I made a function that ( tries to ) manages ball vs player colisions and it has many if like
" if( ball.dCurrY + BALL_DIAMETER > player.dCurrY )
if ( ball.dCurrX +.... " well you get the ideea....
Well there are 2 problems :
- the function is not very elegant , ( lots cheks like
if(e < x+4 - and most importantly , the function works randomly. ( ratio 2 from 10 , I know , I know it is not very good )
The reason I post is mainly for the last problem: Can somebody tell me more about this colisions....?
I read what Julio sugested at flipcode.com , but there were more advanced thing (like 3D stuff ) and I didn''t understud much.


0

Share this post


Link to post
Share on other sites