UnityGadgets BloggerGadget

Monday, September 28, 2015

72: plans, tweaks

I got stuck trying to make the asteroid field have density waves that would correspond to rings like what Saturn has. Spent 8 hours noobing around last weekend trying to figure out an algorithm. I managed to make a wave, but only while going in one direction. Basically the box that puts down the asteroids outside the screen would check for the Y coordinate and oscillate the density of asteroids between 2 values as Y increased. So as the ship was going up it would travel through denser and less dense regions.

I was stuck because I wanted to generate a whole ring system based on some equations. I hoped I would be able to figure something out eventually. Luckily I realized today that I only need a map with regions that would correspond to the rings and even interesting artifacts caused by gravitational interactions between moonlets and the particles of the ring. Then just need my "asteroid generator" to pop stuff into the game based on where it is on that map. So it could vary the density of asteroids based on location and create the illusion of traveling through a detailed ring system. :)

I do want to have gravity and basic orbital mechanics but I will have to cheat because no computer today would be able to handle a ring system actually made of billions of objects and realistically interacting with the planet they orbit.

The plan is to have a planet and gravity, and have the player in orbit. Then have the ring marked out as regions, and as the player orbits it generates and destroys the asteroids based on what region it is in. The asteroids are spawned with correct orbital velocity so when they enter the simulation and while they are in, they interact with the planet and it's gravity properly. Once they are offscreen they are popped out. I will use pooling so I won't have to constantly create and destroy objects, and I bought an asset that seems to be a way better gravity implementation than what I cooked up. Faster, and seems to be able to handle a lot more objects.

I want to make the ring system BIG. The dream is to have the same scale as Saturn's actual rings which would mean that with the relative velocities achievable within the game it would probably take months to traverse it to either get to the planet, or to get to the edge and try reach some larger moons. Being a 2D game it is a bit hard to avoid the rocks. :)

 still need to tweak the engine and the health of other objects and I want to make the asteroids breakable. I will continue to work on the "environment" a bit longer. Now that I have figured out a way to make it less boring and more structured I am quite excited. :) I might even add a moonlet with weak gravity so we can have some landing action happening. :) I love lander type games. :)

Thursday, September 24, 2015

71: SpaceVR, game update

Pledge 50 bucks to SpaceVR and you get a cool vr frame for your phone, and access to all future SpaceVR content. Which might be not much, but potentially could get big and then it would be a freaking bargain. :)


Now GameDevTalk:

I don't know why yet, but the shitty graphics we had, are now even worse. Oh well.

The upside is that I have figured out how to make the ships modular. At the moment you can only grab other objects with the left grab, but it is the same system that will enable building ships from parts by attaching them together.

If you have a middle mouse button, then if you touch an object with left arm while holding down the middle button, you will grab the object. Positioning isn't perfect yet, but at least the physics isn't messed up like it was by some other implementations I tried.

If you click the middle button while holding something you can release the object. Try throwing stuff by spinning the craft and then letting go of the object. I had to "manually" apply the correct force to the object when you release otherwise it would just stay right where it was released.

What we don't have yet is proper recalculation of center of mass when holding onto stuff. Also when releasing objects the ship's angular momentum isn't affected yet but I think it should be. I need to update my physics understanding first, then I can put in the appropriate calculations and force application to make object interactions more real. I am not sure if it will be playable yet. If it isn't, I might have to leave it the way it is.

Also Nathan pointed out that the thrust needs tuning because ship isn't responsive enough. And I also know that damage and "health" or "object integrity" needs tweaking.

Anyway, off to scripting some basic AI, improving the responsiveness of the ship, and fixing the damage/health issue, and then we will have something playable.

Wednesday, September 16, 2015

70: PID controller schmontroller

So controls were crappy with all the button mash. Asked my local consultant and he suggested the usual mouse + wasd controls. So had to come up with a way to make ship face towards the mouse pointer while still using the physics system. Done a version where the facing is "forced" by simply rotating the object, but because it isn't by applying force to the attached "rigidbody", it caused all sorts of bugs when the ship bumped into other objects.

That's why I ended up learning about PID controllers, and that is why I am talking about them now.

So what does the current controller do?
It takes the angle between where the ship is facing, and the vector that points from the ship towards the mouse and tries to "drive" it to 0 by applying torque to the ship. It also takes how fast the ship is spinning and tries to "drive" that to 0 by applying torque.So the ship turns towards the mouse, and gradually slows down and stops when it faces it.

 I borrowed the algorithm from another script that was written for 3d objects, then watched some videos on PID controllers and it was a piece of cake.

Going to be extremely useful when I start building and using other scripts to enable the enemies whoop your ass. :)

Thanks Nathan for the sprites and the tips. I am looking forward to bug you more.

Hopefully soon I get to blow people up with my awesome enemy AI's. /probably also borrowed, or bought on unity asset store/

Saturday, September 12, 2015

69: new old game rip off fail

So just a little help:
W and S will accelerate probe forward and backward
A and D will accelerate ship left or right
Q and E will rotate ship left or right 
R will kill rotation
Left mouse button or left Ctrl will shoot bullet

Yes controls are annoying. :) Need to figure out.

Ship is invincible at the moment cause of development reasons. The asteroids aren't, they just have a lot of "hp".

Why doesn't the ship stop spinning after force is applied to turn it? Cause of Newton. Argue with him, then settle for using the R button. Probably later on will have "stabilizer" on ship that would slow down and stop rotation to help with control, but also that can be knocked out by enemies to make control harder. Fun.

Why does ship keep moving if no buttons are touched and so no engines /notice no animation for engines yet/ are on? Cause of Newton. Argue with him, then settle for turning ship around and apply force the opposite direction to slow down, or wait till you hit something. You probably will hit something.

Why does ship start moving backwards when it shoots? Cause of Newton. I thought to be internally consistent the guns would have to apply the same force they apply to the projectile to the ship itself. The bright side is that the gun is basically an engine in itself, and probably I will end up making the engines also usable as weapons at short range.

Though the parameters of mass of bodies, projectiles, and force strengths will obviously need some tuning. At the moment for instance the mass of the projectile is one tenth of the ship, so it is clear why the recoil is so strong.

Yes the damage to objects is also based on the force of collision. I am planning to base the "hp" of an object on its mass, so more heavy stuff will be harder to destroy, and also harder to move around. Lighter things should brake easier, but also should be more agile.

I want to add grabbing and holding capability, and also harpoons on tethers. They should add some fun elements. Also add some "force" fields of sorts for shields or other interesting purposes. I might also try gravity to some extent but if you thought controlling this ship is hard, orbital maneuvers even in 2D are quite hard. Especially if you want to move between "planets" or "moons".

Anyway, working towards a "minimum viable product" to get people play test. If that goes well, then would continue with developing a plethora of content in terms of AI, scenes, proper sprites, and proper animation.

Wednesday, August 19, 2015

Sixty Eight: shitty human nature!

Nearly one year since last useless post. Time flies without giving any crap about the amount of fun any of us is having.

Anyway it seems at least my name will get off this planet. That's a start. :)

If your name want's to come along to colonize Mars, get tickets here:

Sunday, August 24, 2014

SIXTy-7eVEN: it's been a while

Yep I am lazy. Haven't been doing much for the past couple of months. If I were in space, I'd be dead by now.

I just added three more links to my list. One is a kickstarter for a Canadian rocket company to do small satellite launches. The other two are also rocket companies that are developing rockets for the small satellite market. All attempting to use carbon composites, and Firefly is planning to use aerospike engines. They want to enable smaller companies that have 5 or so million dollars to spend to fly their own hardware to LEO as primary payload.

Overall it seems I am consistently being visited by bots, which is a good sign. At least the servers and search engines are paying attention to my ramblings.

I have stalled on my game dev project,  but I started messing with Unity again. So fingers crossed I might have that game up and running by the end of this decade.

Oh, and enjoy the new failed haiku of the month.

Friday, April 18, 2014

Sixty-SIX: crowd-doing


I found this in my facebook feed. This is exactly what I would like to do but with the addition of crowd funding, and an addictive game to get ourselves spending money on technology that we need to get off this rock.