Sunday, May 31, 2015

Sunday, 31 May 2015

Only got about 2 hours in today (thanks to X³ Albion Prelude and its terrible interface that makes everything take 100 times longer than it should), but managed to get a couple of stuff done nonetheless.

Grabbed a trianglify background and used it as an alpha mask to blend my own two colours together (since I was too lazy to figure out how to input my own colours), and drew an ugly vector star for the background.


Now, time for today's "Did you know?"!

Did you know, the phenomenon of stars twinkling when viewed through the Earth's atmosphere is known as astronomical scintillation?

So unfortunately, making stars twinkle when you're in a spaceship is as far as I'm aware, unrealstic. As would be the parallax effect due to the sheer distance (unless you're moving at FTL speeds but I digress). And lastly, as pretty as nebulae are, they'd be nowhere as dense as the artistic impressions.

Which leaves me with the decision: what balance between realism and eye-candy do I strive for? I mean I'm not trying to make a 100% accurate space sim now am I, when all the planets have the same radius as each other and even the Sun.

Oh, I also tweaked the planet shader a bit to accept a base colour, and some random values for the bezier curves. Might work for random non-existant planets, but I still prefer my hand drawn sprites for our own solar systems' ones.


So there's the question of scale. Do you make all the celestials the same radius (and size as the player's ship)? The other end of the scale would be everything 1:1 to scale (see Elite:Dangerous) which is pretty much unfeasible for what I'm aiming for. Since, what I'm working on is heavily based on Synthetic Reality's Warpath from 1995 or so:


Decisions decisions...

Saturday, May 30, 2015

Saturday, 30 May 2015

HAHAHA QUARTER ONIONS, WHO IS THE BOSS NOW?!

Ahem.

So, I finally managed to wrangle rotation into submission through the judicious intake of coffee and a liberal application of rolling my face on the keyboard out of sheer frustration.

Now, clicking on a location in space will make the ship turn to face it, and turn towards it. I just need to change the rotation from direction rotating via transform.rotation (naughty!) to using RigidBody's AddTorque. (The movement is already using AddForce).

I also added a spiffy header bar on top that does absolutely nothing (for now), as well as quick and nasty Text Meshes to the planets to display their names. The scaling on their orbit circles is just as suspect, it lies close to but not exactly on their centers which is really annoying me.

I also managed to find whih prefab/script was giving me that damn "the referenced script on this behaviour is misssing unity" error (I forgot to Apply changes to the prefab on my player controlled ship).


I need to make a spiffier course plotter. Maybe something that shows the ship's current vector and the destination one (which would have made implementing rotation easier in the first place but I digress). As well as a nicer off screen bracket pointer. And make the engine trails be dependent on the force (so thrusting gives longer trails than turning). And and and...

Friday, May 29, 2015

Friday, 29 May 2015

Today has been the most frustrating day so far with the programming. I've always said Fridays were the worst day of the week.

First off I tried to draw a cursor on screen that sits on the edge of your screen pointing to off screen objects. After the better part of 2 hours, I decided to give it a break and work on something else.

Managed to get a simple line drawn between two objects (as you can see in the screen shot, between star and ship). Then proceeded to add orbit circles, which worked fine until I realised that as soon as I scale them up to increase the radius, the line width increases because I'm setting the width in local coordinates and not in screen coordinates.



Anyhow, after much fiddling around (i.e. googling answers to similar questsions), I found a solution that kept the orbit circle the same thickness, except now I couldn't increase or decrease it. Oh well.

I then noticed that the anti-aliasing on my amazing Bezier curve planet wasn't resolution independent (related to previous problem), and I managed to fix that up in less than a minute, luckily without any side effects.

Then, back to the off screen cursor. After much cursing I finally got to position it in the right place. I then started to work on rotating the cursor (an arrow), only to discover I can't rotate the built in GUI sprites, I have to muck around with rotating the entire canvas (or something to that effect), drawing a dynamically created texture, and then rotating the canvas back.

In the end, I managed to get it to work close enough. I wanted it to hug the edge of the screen, but it's orbiting the ship at half the screen height so it's okay I guess.

Hopefully I'll have less frustration and more productivity tomorrow.

Edit: Forgot to mention that at some point I implemented the basic built-in engine trails. Need to adapt them to react to the user flying forward, because currently they look really dumb when reversing (wait, why does my spaceship reverse as fast as it flies forward?) and when turning in tight circles.


Thursday, May 28, 2015

Thursday, 28 May 2015

Now with anti-aliasing and cubic bezier curves!



I'm currently using a hardcoded amount of bezier curves and passing the data in via 5x float4's, and also using hardcoded colours. All of which I am not very proud of. But hey, it works!

Wednesday, May 27, 2015

Wednesday, 27 May 2015

Was reading about some interesting things lately. Voronoi diagrams, Delaunay triangulation, NURBS (Non-uniform rational basis splines) diegetic interface. While all this sounds really smart and intellectual I didn't understand a thing about it. :B

Currently busy trying to make a texture/fragment shader for generating planets instead of me manually drawing each one by hand. It's a pity they taught us Fixed Pipeline instead of Shaders when I studied Computer Graphics 2 or 3 years ago.

Today's progress:





Hand drawn sprite on the left, shader generated on the right. Not much, but more than I had initially expected (i.e. nothing due to procrastination).

Still need to implement anti-aliasing, find a better formula to use than simple sin(x) (this is probably where splines come in) and figure out what's up with the alpha channel.

Well the transparency was an easy one to fix, had to add the Queue = Transparent tag, disable Z-buffer and add Blend mode for SrcAlpha.

 

Monday, May 25, 2015

Monday, 25 May 2015

I spent most of last week "programming" a bill of quantites generator in Excel VBA. You feed in a nice hierarchal tree of a few hundred items and it builds a nice tree out of them and spits out a neatly formatted 50 page document with headers, footers, pagination, automatic numbering and sub-totals and totals. And to think people expected me to do it manually, line item by line item.

So, between that, Cosmonautica and X³ Albion Prelude I haven't been up to much on the programming side. After much coercion and bullying by one of my friends (hi Eivind) I finally installed Unity 5 and mucked around a bit.

So far you can fly your ship around without it using engines or leaving magical space dust contrails, and bump around into planets like marbles super-glued to the ground.


Thursday, May 14, 2015

Thursday, 14 May 2015

I think I've finally gotten somewhere on choosing the direction I want the game to go in. I still have an almost insurmountable amount of design choices ahead but I've made SOME progress! So, 1% instead of 0%.

I've also gotten two whiteboards and a thick stack of Post-It notes, so soon I'll upload photos of my amazing GAME DEV IDEA CORNER.

Today I wanted to do several mockups but I only had the energy to do one, so here it is:



Did you know that the phenomena of stars twinkling when viewed through Earth's atmosphere is called stellar scintillation? KNOWLEDGE IS POWER!

Sunday, May 10, 2015

On motivational speakers and weight loss scams

Uninteresting rambling that I just had to get off my chest, proceed at your own risk.

Tuesday, May 5, 2015

Tuesday, 05 May 2015

With the conclusion of April and its plethora of holidays, regular programming resumes and Programming Adventures unfortunately take a back seat (conveniently, as I just got to the point where I need to learn about Quarter Onions and other eldritch secrets of forbidden advanced mathematics).

So I woke up this morning from a dream where I was so tired I couldn't get up, but when I woke up, I wasn't tired in real life. This sort of thing at 1 AM is confusing and tries to make my head hurt. Anyway I went back to sleep, had even more dreams, and woke up 5 minutes later because it was 6 AM and the alarm clock went off. Which makes for a better explanation as to why my new upstairs neighbour was pacing around than 1 AM does.

I wonder if abcesses have lucid dreams as a side effect? (Hah.)

Any how, dreams ranged from train dreams, to work colleague dreams, to sleeping dreams, to minus 15 years and still living with family dreams, to getting a nice long letter from someone you haven't heard from in years dreams, to memory flash backs to the 90s dreams. As much as I miss those years I don't like getting flashbacks, those never bode well.

The only thing that keeps things in check is that with all the "things-were-happier-then" memories, eventually a cringe-worthy "I can't believe I did that" memory crops up that makes both your conscious and subconcious simultaneously shrivel their metaphoric/hypothetical/anthromorphic faces in disgust and revulsion.

One thing I will hang on to though, is that memory of when we were camping in wooden cabins in the forest (well, depending on your definition of camping I suppose, but I then digress). It was night time and the rest of the people in the group I was placed in were making a racket, so I stepped outside for a moment.

As I close the door behind me, the noise fades out to grey. It's dark and still outside, and a slow, lazy rain is falling. I look up at a moon-lit sky, and see every drop of rain falling down, lit by the moon, all between the silhouette of tall trees stretching and reaching up towards the sky.

That memory will always have a special place in my heart. Bonus points if I have Conjure One - Tears From the Moon playing in my head at the same time.

Sunday, May 3, 2015

Spaceship instrument doodles and a lazy space diner

Another day of slow but steady progress (mostly slow though). Did some refactoring of the hodge podge classes I made for managing objects, read up a bit on gimbal locking, quarterions, ecliptic coordinate system and a bunch of other stuff I still do not understand at all.

On the actual programming side, got the mouse/camera to work by switching from a camera orbiting in a sphere to one orbiting in a ribbon/open topped cylinder (spins around the XZ axis, and ascends/descends perpendicularly on the Y. Managed to get the player's object moving, and last but not least (especially not least) managed to load a mesh from an .x file, despite some minor speedbumps along the way.

Next up: choosing a method of representing the bearing of objects. So far I've only been storing their location (x, y, z), but not their orientation (heading, elevation and banking). Then I need to figure out the (probably simple) math to get the ship to move in the direction it's pointing, i.e. if it's pointing 45° up and 15° to the right and the player presses forward, it needs to move in that direction.

Anyway, enough rambling, have some scribbles and "concept" art. I think this particular ship is growing on me (although the cockpit is too high). I'll probably regain my criticalness and hate it in the morning though.







Friday, May 1, 2015

Swift's Programmering Adventures pt II

Quite pleased with the progress I made so far. Sorted out handling multiple objects, derived/base object class, spheres and rings. Wonder what I'll get up to tomorrow? Maybe starfield, fiddle with more lighting, and gradient background? Current mouse/camera code behaviour is still annoying the hell out of me though, feels incredibly anti-intuitive. Need to implement mousewheel for camera distance too I guess...