• 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.

laeuchli

Physics:How accruate?

3 posts in this topic

Hey all, I''m in the process of writing a game, where there are a number of planets floating about, with various ships, and other space debris. I''d like to have the ships attrache to the planets, the planets to go around in a realistic way, and be able to calcuate the amount things should move based on the amount of force applied to them. My question is, how accurate should I be? Should I use the full equations from my physics book, and do the calculus for each object, or will this take to long? I guess my question is, where do I use the real equations, and where do I go for the hacks to save cpu time? Thanks, Jesse www.laeuchli.com/jesse/
0

Share this post


Link to post
Share on other sites
Well, for orbits etc, you could just set the planets going around in a circle, and use trig to find the next position it''s supposed to be etc. The correct way would be to use the gravitaional equation with centripetal acceleration, which would also produce spiralling decents into planets/suns etc if the orbiting objects are not going fast enough aswell as orbits ( all though setting up an orbit would be more differcult ). As for gravitational attraction, I can see no other way other than using the gravitational equation. It''s not complicated, so I can''t see it eating up the many CPU cycles either. You could also optimize it by discounting the gravitational force from bodies that are further than a designated distance away etc.
0

Share this post


Link to post
Share on other sites
For your game, you want a stable dynamical system. If you were to simulate each of your celestial objects and the interactions between them all, it would be extremely difficult to produce a system that did not decay or explode (ie all come crashing together or explode off into space). Escpecially given rounding errors in computers!

So, if you want to simulate a bunch of planets, asteroids and objects, then you''re going to have to cheat.

What you can do is this.

1) Simulate the orbits of objects using Keplar''s laws. These state that: 1) The path of an orbit of one object around another is an ellipse, where the central object is located at a focus of the ellipse; 2) That the straight line joining the two objects sweeps out equal areas in equal length timesteps; and, 3) that the square of the period of the orbit is proportional to the cube of the average radius of orbit. The average radius is equal to the length of the semi-major axis of the ellipse (which is just half the length of the major (longest) axis of the elipse).

You can use these facts to simulate objects orbiting one another where the mass of one object is significantly larger than the other. Works for planets and asteroids orbiting stars, space ships orbiting planets, stars or large asteroids, etc,...

Now, when you want to figure out how the motion of a space ship is perturbed by the gravitational effect of a bunch of planets, then you need to compute the force applied on the ship by each planet. Each planet exerts a force inversely proportional to the square of the distance between it and the space ship. The actual equation is:

F = GM1M2/R2

where:
G is the Universal Gravitational Constant
M1 is the mass of object one
M2 is the mass of object two
R the distance between them.

Project all forces as acting radially outward (in 3-D space) from the space ship and sum them to find the resultant force. Add to this the force generated by the space ships engines and you have the resultant force for the direction of motion of the ship. From this compute the acceleration and use a suitable integration routine to compute the new position of the space ship given its current position.

At each time step of the integration you will need to update the ships position and that of all of the planets. The computational cost of this method will be directly proportional to the number of celestial objects you are simulation.

Cheers,

Timkin
0

Share this post


Link to post
Share on other sites
In order to get an object into a stable orbit around another body, you need to balance two forces, the force of gravity and centripetal force.

As stated earlier, the force of gravity obeys the following equation:

F=(G*m1*m2)/(r*r)

Centripetal force is governed by this equation:

F=m*(v*v)/r

If we say that the m in the centripetal equation is the same as m1, then we can se these equal to one another like so:

(G*m1*m2)/(r*r)=m1*(v*v)/r

Cancel out the m1''s

G*m2/(r*r)=(v*v)/r

Cancel out one of the r''s

G*m2/r=(v*v)

And solve for v

v=sqrt(g*m2/r)

This v is a tangential velocity (i.e. it must be perpendicular to the radius between the objects at all times).

0

Share this post


Link to post
Share on other sites