• 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.
Sign in to follow this  
Followers 0
Durakken

Stellar RTS planets

13 posts in this topic

Here's the problem that I'm seeing with that...

 

Hypothetically I can just have a start point, calc the length of the orbit and how many ticks it takes to reach 100% then when load up by a player divide by that...

 

firstly i don't know how to calculate when it would intersect... for example the distance to mars from earth today is different than the distance to mars in a year. Assuming that planet 1 has an orbital radius of 500 and planet 2 has an orbital radius of 499. it could take between 1/1000 of 4 minutes to get there or 4 minutes to get there. Depending on when it intersects. So the only way to figure that out would be to calculate forward changing various angles...wouldn't that just end up being more processing? Especially since it would have to be calculated by all the various ships... though i guess not all at the same time.

 

secondly... i know the origin and destination, so i can predict that, but other planets would then be a problems... that is unless i run the simulation at that point and there again i'd run into the same problem... i think. not sure...

 

 

Also I should point out I think that I'm using C# and unity 3d... if that matters to anyone ^.^ in their thoughts on the subject... and I'm using the function that is built into unity that does the orbit calcs for me since I could find the math to do it myself...

2

Share this post


Link to post
Share on other sites

firstly i don't know how to calculate when it would intersect.

 

secondly... i know the origin and destination, so i can predict that, but other planets would then be a problems... that is unless i run the simulation at that point and there again i'd run into the same problem... i think. not sure...

 

I also do not understand what you mean here, please elaborate.

0

Share this post


Link to post
Share on other sites

The whole problem is that the ship trying to get to the planet. if I don't know where the planet is I can't calculate how to long it takes to get there. Likewise, if I don't know how long to get there i don't know where it is. The planet is moving and because the planet is moving the time it takes to get there changes and because the time it takes to get there changes where the planet is changes which again changes the time it takes to get there.

 

So basically what happens is I have to get the position.vector3 of the planet at the time of departure, get the length which will give me the time to get there. Then jump ahead however many ticks it would take to get there and find where the planet is then which could be any position on a 360 degree orbit...which is likely not the vector3 we originally took. This moving then has to be accounted for somehow, which i don't know how, to get the shortest time possible rather than an get there and then correct for it... with most ships it wouldn't really be an issue, but with some, especially in the early game what would happen is that the ship would continuously chase after the planet and take a really long time to reach it.

 

 

The other problem is a matter of whether or not i calculate the entire solar system and if that is taken into account... which again is another thing i don't quite no how to do as i'd need to detect that i'd run into a planet, plot a course around it, and then recalc to the planet which would then change the time... which means i have to run the calcs for the whole solar system rather than just the planet in question... or i could pretend that prob doesn't exist >.> Not sure if it really even matter considering how big space is...

0

Share this post


Link to post
Share on other sites


The whole problem is that the ship trying to get to the planet. if I don't know where the planet is I can't calculate how to long it takes to get there. Likewise, if I don't know how long to get there i don't know where it is. The planet is moving and because the planet is moving the time it takes to get there changes and because the time it takes to get there changes where the planet is changes which again changes the time it takes to get there.



So basically what happens is I have to get the position.vector3 of the planet at the time of departure, get the length which will give me the time to get there. Then jump ahead however many ticks it would take to get there and find where the planet is then which could be any position on a 360 degree orbit...which is likely not the vector3 we originally took. This moving then has to be accounted for somehow, which i don't know how, to get the shortest time possible rather than an get there and then correct for it... with most ships it wouldn't really be an issue, but with some, especially in the early game what would happen is that the ship would continuously chase after the planet and take a really long time to reach it.

 

Google is your friend. Equations exist for this sort of thing.

0

Share this post


Link to post
Share on other sites

Isn't that the only reason to include planetary movement in a game?

The idea is that that depending on the current position of the planets the length of time it takes to travel from earth to mars varies wildly.

 

You would need to an algorithm that determines the point where the ship and mars will intersect and the time to reach that point. To be honest its rather complicated but if you want to take a look at how it calculated you can look at http://www.bogan.ca/orbits/transfer/Earth2Mars.html

 

Unless the game is  going to take place across a small area where travel time is really important then I wouldn't bother doing it.  

2

Share this post


Link to post
Share on other sites

Well see the thing is I just am assuming a relative straight line rather than orbital transfer. 

I was also thinking in terms of everything moving all the time rather than calculating one section at a time to predict out... in which case the ship would just correct itself as it got closer if i set the planet as the target,

 

These ships would be fast enough to at least do that but not fast enough to make it so the planet moving would make no difference.

 

There's no place that really covers what I need. It tells you how NASA does it with our current technology but that's fairly useless if you aren't traveling in a circle or the orbit shape is almost a straight line.

0

Share this post


Link to post
Share on other sites

Well see the thing is I just am assuming a relative straight line rather than orbital transfer. 

I was also thinking in terms of everything moving all the time rather than calculating one section at a time to predict out... in which case the ship would just correct itself as it got closer if i set the planet as the target,

 

These ships would be fast enough to at least do that but not fast enough to make it so the planet moving would make no difference.

 

There's no place that really covers what I need. It tells you how NASA does it with our current technology but that's fairly useless if you aren't traveling in a circle or the orbit shape is almost a straight line.

 

Well, if you want to brute force it this should get you pretty darn close. Figure out how long it will take to get to the destination planet, based on the current desitination and origin. Then figure out how long it would take, and then calculate where the destination will be. Make this your course. Then, after some time, could be a percentage of course traveled, a tick, a certain amount of time, recalculate it. Figure out how long it will take to get to the planet from the current location of ship and planet and figure out where the planet will be at that time and make that the course. It won't be a straight line but it will get to you to your destination.

Edited by Azaral
2

Share this post


Link to post
Share on other sites

well if you arent simulating the entire galaxy rotation and galaxies moving away from each other and stuff, then you could cut corners on more things, because calculating everything sounds like a lot of math.

 

planet 1 is a position X, planet 2 at B now, depending on the situation you would want to WAIT for your launch because another date will provide an EARLIER arrival, for example, if you go all simulator-ish. Also imagine the planets orbits moving them in a way that the sun (or another planet) is on the way, your ship will go through it.

 

I assume you have orbits a a mathematical function?, for in-system travel I'd suggest you calculate the distance to travel at launch, set that as a the travel distance no matter what (even if the planets are accelerating away from each other at the time), and update the travel % each tick if you must (you don't need to know the planets current position for this btw, and no you dont need to update the % every tick either).

 

Then when you need to display the ship on screen, just make a nice spline curve that follows the possible orbit (or counter orbit) between the current position of both planets and set the ship at the correct % of the way, regardless of the actual current distance seen vs traveled, doubt anyone will notice you are off a few light years, or care, even if they do notice. Doing this you could solve the "planet in between" issue by detecting if your ship is inside a planet, and adding an "slingshot" curve around that planet, then draw the ship using it as a slingshot.

0

Share this post


Link to post
Share on other sites

Are you sure you need more then 20 000 planets in the game? For what will they all be used?

 

If they are not an important game mechanics (and i dont see how any player can deal with that amount of objects in a meaningful and fun way) you are just wasting resources imho.

 

Are you planning some sort of mega eve online? Might be hard to pull of:)

0

Share this post


Link to post
Share on other sites

I think I understand your issue. Plotting trajectories including gravity from multiple objects can lead to complex differential equations, especially if you need to skip large amounts of time. Skipping any large chunk of time in physics can lead to different results.

 

My first question is whether you can have fixed planet orbits, rather than calculating them at run-time. If so, then gravity becomes a one-way thing, e.g. planets emit it, ships are acted on by it. That would ease things considerably.

 

I'm not sure about 20,000 planets... yikes! For a much smaller number of planets you could fix the time skipping issue by fudging with precalculated values. e.g. for each pair of planets precalculate some trajectories for various points in the orbits, and use those when the player isn't watching.

0

Share this post


Link to post
Share on other sites

It's impossible to calculate all the positions of all the planets/moons/etc every second (as far as i know) so it seems that I'm at an impasse with what to do as far as the planets (at least not on my PC I can only calc up to around 20,000 orbits at once without noticeable bad slow down)

 

Make objects relative to one another and layer your architecture.

 

What I did was base my map around the position of stars. All planets orbiting a star only have a position that is relative to that star so its easier to update. And all moons have a position that is relative to their parent planet.

 

Makes it much easier, and you can enable/disable updating star children if there is no current visibility (do keep a counter to keep track of time so that when you update everything is in sync).

 

Note: Plotting intercept course for ships might be a bitch when you have to factor movement however. The ETA will not be accurate unless you factor the expected movement of the planet.

Edited by Orymus3
0

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  
Followers 0