Dev Diary 022: Gravity Balls!

Matt Barton's picture

Fun with gravityFun with gravityHaha! Man, it's such a beautiful thing when stuff comes together. I had a lot of issues getting this to work. Again, I'm suffering from my lack of math skills with this. I guess I should quit whining and just buy some videos from the Teaching Company, but thankfully I was able to find the formulas worked out by somebody else. Some copying, pasting, and tweaking, and viola! Gravity balls! I still have a long ways to go, obviously, but I think there's already enough here for you to give this a spin and see if it's something you'd enjoy.

Before getting into the multiplayer stuff, I thought I might make a little detour and have some target satellites, asteroids, or some such orbiting some other planets so that a solo player will have something to do. I need to add in a power selector. I won't make it too easy--my plan is to make every round complex enough that you won't just be able to shoot at the target directly, but will have to sling around the gravity wells to get your shots to hit.

I'm still wondering what to do about the camera. I haven't worked with it before (other than just setting up the initial scene, of course), so I'm not quite sure what would be the best way to go about it. As a player, I think I'd like to be able to click on a planet or a ship and then use the mouse wheel to zoom in and out. By default, the sun should probably be the center. I'll need to do some research on this part, but since it's such a common functionality I don't expect it to be very difficult to implement.

In the finished game, I want the balls to be little missiles that'll boost for awhile until they run out of fuel. In fact, I'm thinking that instead of having an initial velocity like a cannon, the "power selector" would really be the amount of fuel you put into a missile. As long as it has fuel, it will accelerate.

Maybe I could have a type of ammo that DID have an initial blast...like a cannon shot. You fire it once and it doesn't accelerate except by gravity after that. That could be pretty interesting.

Anyway, thoughts and ideas are of course appreciated.

Click here to see the game so far.

Comments

TripHamer
TripHamer's picture
Offline
Joined: 07/31/2010
Nice.

Shows that you can do nice stuff quickly with Unity. It would take a lot longer starting from scratch.

n/a
Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
The community is big enough

The community is big enough that there's already quite a bit of code out there you can snatch, and chances are that whatever issues YOU have, somebody else has already had--so you can find that solution and work it out. I think this is the kind of thing that really makes Unity shine; other stuff might be more powerful, but if you can't get help, it's worthless.

I've been working on making a procedurally generated solar system. That turned out to be a lot harder than I thought, since I want planets to have different orbiting speeds and each match to be a little different. I still need to add some random moons and then figure out to let players select the planet (or moon??) they want to orbit. In short, tons of work to do.

I did find Fieldkit, which says it makes it a snap to add online matchmaking type gameplay. It's $100, so I want to make sure I have a viable game before springing for that.

It has become pretty obvious that this game will require the full screen to be able to see everything. I don't see an easy way to make it into a browser game with that 640 x 400 resolution. I guess it's not mandatory that it be a browser game, though I know a lot of people will be resistant to downloading even a small client file. Still, having the full screen to work with makes a ton of difference and will let me be a lot more detailed with the graphics.

n/a
TripHamer
TripHamer's picture
Offline
Joined: 07/31/2010
Just thinking off the top of my head
Matt Barton wrote:

I've been working on making a procedurally generated solar system. That turned out to be a lot harder than I thought, since I want planets to have different orbiting speeds and each match to be a little different. I still need to add some random moons and then figure out to let players select the planet (or moon??) they want to orbit. In short, tons of work to do.

Just thinking off the top of my head, it shouldn't be that hard to do once you get one working.

I would think that you can just define the min. and max values for each.

For example:

Each solar system has one sun (I assume) that all the planets revolve around.
There can be a minimum of say 2 planet in the solar system and a max of say 12.
Min and max distance the planet can be away from the planet before it. (or the sun in the case of the first one)
The min and max amount of moon a planet can hold and (if you want) the orbit of each moon can have a min and max distance from the planet.
The starting position of the planet in it's orbit around the sun (0 to 360 degrees) and the min and max speed they revolve around the sun

and so on

And you really only have to do it once and then make instance of that class (which obviously can be a random amount). And every time you make an instance, you can have it automatically define the parameters. I assume you know that a class constructor runs when you make an instance of it.

If you follow what I'm saying. (I know what I mean and hope I made it clear enough for anyone but me to understand) :)

n/a
Rowdy Rob
Rowdy Rob's picture
Offline
Joined: 09/04/2006
It actually looks nice as it is now!

The graphics actually look pretty cool right now. Even with the currently-simple mechanics, the smooth animation and physics are somewhat mesmerizing.

I'm getting a "Space War" vibe from this game. Not that this game is like "Space War," but it almost has that feel of the classic vector-graphic games like Space War, Asteroids, Star Castle, and so forth.

Are you planning a "single-player" option? You may have mentioned it in a previous blog post, but if so, I don't recall off-hand. I can see the current mechanic being used in a single-player "alien invasion" type of game, where you must shoot invading space battleships, missiles, and so forth. It may not be what you had in mind, but it probably wouldn't be that hard (comparitively) to implement.

I noticed that it appears the player can shoot an unlimited amount of bullets! That's pretty cool; I can see myself "raining hell" on an opponent!

Also, it appears that the celestial bodies all exert the same amount of gravitational pull. If so, I'm not sure that's a bad thing. It might be a good thing, player-wise, depending on where you take the gameplay.

Anyhow, the basic mechanics so far look pretty promising! Looking forward to the next updates!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.