Tuesday, September 30, 2008

Autopilot: the beginning

I've delayed and delayed it.. pheraps due to some fear :) but now it's the moment to become brave and fight the monster!
I'm talking about the autopilot, pheraps one of the biggest problem to solve. Space are immense, planets and other objects are far away, they move into their orbits, so is VERY difficult travelling from outer space to an object, especially when the inertial phisic is activated. Imagine: the earth is a million km away, so you need a very big speed to reach it in reasonable time. To reach the travelling speed you need an acceleration, and it's impossible to use too much big acceleration otherwise your body will be destroyed. It means that you need a lot of time to reach the speed... and you cannot decelerate only when you're near earth.. for the same reason: you cannot decelerate too fast. So you need time also for deceleration, and you've to begin the deceleration phase when you're still away from earth.
Now try to imagine that the earth is moving around sun: you need to update always your direction if you want to reach our planet.
So it's near impossible to do it manually. You need a computer help, aka the autopilot.
There are very difficult to realize it, i'll try to list the most important:

- An autopilot cannot compute the route before the travel.. there are a lot of variable that can change during the travel, so it should work in real time and react to all the new condition that could happens. For example: a ship appears in front of us, the autopilot has to recompute new route to avoid it.
- Our autopilot should be consider the time compression. If the time is running 1000 faster, the reaction time of the autopilot should be also 1000 time faster.
- If you want to reach an object you've to consider that that object moves also into the space. Now it's at (100,100,100), a minute after it could be at (200,40,-6). So you cannot simply compute a segment from our position to actually target position: the route should be updated every second.
- Planets, Stars, stations, and so on, are solid, and you cannot pass through them. If i'm in A position, and want to reach the B position, and between A and B there is a big giant star, we need to compute a more complex route A-->point C outside star--> B

Ok, i've begin this BIG work.. for now i think that a route is composed from a set of segment joined toghether to build a complex path. So we start with a simplex sub-problem: move your ship from a fixed point A to another fixed point B without obstacles in the middle. For now we assume that our ship is stopped.
The first thing to do is to locate the B point (the destination) and rotate the ship until B is in front of us. Then we start engine and begin our travel.
In the next movie you can see this first step: there's a station into the space and we want to reach it. The autopilot rotate the ship until the nose is aligned to the point. I'ts not easy because the ship could be rotated around all the tree axis... but it works!

---

L'ho rimandato a lungo, probabilmente perche' in fondo avevo paura :) ma ora e' giunto il momento di essere coraggiosi ed affrontare il mostro!
Sto parlando dell'autopilota, uno dei problemi probabilmente piu' grossi da risolvere. Lo spazio e' immenso, i pianeti e gli altri oggetti sono molto distanti, e si muovono lungo le loro orbite, cosi' e' davvero MOLTO difficile viaggiare dallo spazio profondo fino alle prossimita' di un oggetto, specialmente se si considera la fisica inerziale. Provate ad immaginare: la terra a milioni di kilometri di distanza, avete senz'altro bisogno di una gran velocita' per raggiungerla in un tempo ragionevole. Per raggiungere una simile velocita' vi serve un'accelerazione, che non puo' essere eccessiva (altrimenti il pilota finisce spiaccicato al pavimento), e pertanto deve durare a lungo. E non potete decelerare solo quando sarete quasi arrivati, perche' per lo stesso motivo anche la decelerazione non puo' essere eccessiva, e quindi deve iniziare molto prima dell'arrivo. Non solo: durante il viaggio la terra non resta ferma ma orbita attorno al sole, pertanto la rotta va costantemente aggiornata se la vogliamo raggiungere.
Morale: navigare manualmente e' pressoche' impossibile, cosi' e' necessario ricorrere all'aiuto di un autopilota.
Un autopilota e' molto difficile da realizzare, cerchero' di elencarne i motivi principali.
- Un autopilota non puo' calcolare la rotta prima di partire, ci sono troppe variabili che possono cambiare durante il viaggio, pertanto deve eseguire i propri calcoli in tempo reale in modo da reagire prontamente a qualche nuova situazione. Ad esempio: un'astronave appare all'improvviso davanti a voi, l'autopilota deve reagire e cambiare prontamente la rotta per evitare la collisione
- Il nostro autopilota deve anche tener conto della compressione del tempo. Se il tempo va 1000 volte piu' veloce del normale, l'autopilota deve reagire 1000 volte piu' velocemente
- Se si vuole raggiungere un oggetto bisogna tener conto che questi si muove nel frattempo. Ora potrebbe essere nel punto (100,100,100), tra un minuto potrebbe essere nel punto (200,40,-6). Non possiamo percio' semplicemente calcolare il segmento che congiunge noi con la posizione dell'oggetto in questo istante: la rotta va invece aggiornata continuamente.
- I pianeti, le stelle, le stazione sono solide, e non ci passiamo passare attraverso. Se mi trovo nella posizione A, e voglio raggiungere il punto B, e in mezzo vi e' una stella gigante, dobbiamo dividere il viaggio in due tronconi, da A a un punto C fuori dalla stella, e da C a B.

Ad ogni modo ho iniziato questo grosso lavoro. Credo che riusciro' a domare questo grosso impegno solo suddividendoli in problemi piu' piccoli, pertanto per ora ho deciso di risolvere un problema piu' semplice: muovere l'astronave da un punto A ad un punto B, fermo, assumendo che l'astronave sia ferma al momento della partenza. Una rotta piu' complessa potra' quindi essere suddivisa in tante piccole rotte lineari che unite tra loro formeranno il percorso totale (avete presente il gioco della settimana enigmistica "unisci i numeri dall'1 al 50"? ecco).
Per poter raggiungere il punto B bisogna compiere due fasi, la prima che consiste nel ruotare l'astronave fino a quando il nostro "naso" punta esattamente in direzione di B, dopodiche' accelerare, viaggiare, ed iniziare la frenata per tempo.
Con oggi ho completato la prima delle due fasi: attivando l'autopilota, indipentemente dall'ortientamento della nostra nave, questa iniziera' a ruotare fino a quando avremo di fronte la nostra destinazione. Nel filmato che segue ho usato una stazione spaziale come destinazione. E potete notare che per quanto il nostro orientamento possa essere confuso, alla fine punteremo sempre verso l'obiettivo.
Non e' stato facile, l'astronave puo' ruotare lungo tre assi... ma pare funzionare!

Friday, September 26, 2008

Minor changes

Today new customers, new work, little time to spend on Tau Ceti.
However i've made some adjustment:

- Fixed the dimension of the ship: now il large 40 meters, not 4 kilometers :)
- Re-enabled the inertial motion. It's hard now to drive the ship, and with the planets that moves around his own orbits... argh!
- Outside view, now you can rotate around the ship in two direction: left-right and up-down (and combinations of these)
- Some minor tweaks.

---

Oggi nuovi clienti, nuovo lavoro, quindi poco tempo da dedicare a Tau Ceti
Comunque ho compiuto qualche rifiniura:

- Ho sistemato la dimensione dell'astronave. Ora e' larga 40 metri, non piu' 4 kilometri :)
- Ho riabilitato il movimento inerziale. E' difficile da pilotare la nave, e con i pianeti che orbitano.. argh!
- La vista esterna puo' essere ruotata attorno all'astronave in due direzioni, sinistra e destra, ma anche alto e basso (ed e' possibile combinare i movimenti).
- Qualche piccola ottimizzazione.

Wednesday, September 24, 2008

Rotating ship better than yesterday :)

No, is the same, but i've adjusted also the out-of-cockpit camera, so when i rotate the ship i can see the rotation from inside (the world rotate around me), or outside (the world does not move, is the ship that rotates).

You can see it in this little movie

--

Giusto un'aggiunta a quel che vi ho mostrato ieri. Oggi ho sistemato le rotazioni anche per la visuale esterna, cosi' se ruotate con la visuale interna vedrete l'universo girare attorno a voi, mentre se ruotate con la visuale esterna, l'universo ovviamente sara' fermo, mentre ruotera' l'astronave.

Eccovi un filmatino che vi mostra i due comportamenti

Tuesday, September 23, 2008

Rotating Ship

Back again.
Some problem at work (IT in italy is totally crap) so no time and no motivation to work on the game.
Anyway today i've found some energy and i've powered the ship rotation.
In 3D spaces there are 3 ways to move: up, forward and right (down, back and left are specular), and, obviously you can also rotate around these axis.
It's easy to mess when you starts to combine the rotations, so i've worked a little to find a polish way to do it.
In the next video you can see the three rotations. There's not inertial component for now, but i'll add it later.

---

Rieccomi.
Alcuni problemi al lavoro (L'informatica in italia e' uno schifo), e conseguentemente nessun tempo ne' motivazione per lavorare al gioco.
Ad ogni modo oggi son riuscito a rastrellare un po' di energia, e ne ho approfittato per migliorare i comandi di rotazione dell'astronave.
Nello spazio 3D ci sono 3 modi di muoversi: in alto, in avanti e a destra (in basso, indietro e a sinistra sono movimenti speculari). Ovviamente oltre a spostarsi e' anche possibile ruotare attorno a queste tre direzioni.
Sfortunatamente e' facile entrare in confusione, specie quando si iniziano a combinare tra loro diverse rotazioni (tralascio i dettagli per non tediarvi), cosi' ho dovuto sbatterci un po' la testa prima di trovare una soluzione pulita e semplice.
Per ora non e' abilitato il comportamento inerziale, ma lo aggiungero' senz'altro in un secondo momento. Nel video che segue potete vedere una piccola simulazioni delle rotazioni che e' possibile fare attorno ai tre assi dell'astronave.


Friday, September 12, 2008

True Orbits

Ok, finally i've reached the first step: simulate the solar system.
All the planets are added, now the orbits are ellittic, the dimension of each planet are right.
The orbit size are real, and the orbital period is correct (1 year for the earth i.e.)
In this little video you can see a zoom-out sequence, starting from venus.
When the camera zooms, the time speed is increased a lot so you can see the orbits.

---

Finalmente ho completato il primo passo importante: simulare il sistema solare.
Ho aggiunto tutti i pianeti, ho reso le orbite ellittiche, le dimensioni dei pianeti sono corrette, come lo sono le dimensioni delle orbite ed il periodo di rotazione (1 anno per la terra, ad esempio)
Nel video che segue vedete una zoomata che parte da Venere e si allontana progressivamente.
Quando la camera si allontana lo scorrere del tempo e' accelerato di molto, così potete vedere bene le orbite di ciascun pianeta.

Wednesday, September 10, 2008

[OT] Bad weather forecast...

No good news for the week end... (click to enlarge)

---

Brutte previsioni del tempo per il week end... (clicca per ingrandire)


Tuesday, September 9, 2008

August was a good month...

our customer was on vacation, our boss on the beach, and good time for me to work on the game :)
Now customer are back and are angry, boss are back and are angry, so i've no time. For now.
Be patience.. i hope to back in action in few days... if the world still exists after the LHC experiment ;)

---

Agosto e' stato un buon mese per tau ceti, gente in ferie, ambiente rilassato, son riuscito ad andare avanti. Ora il lavoro, come ogni buon settembre che si rispetti, e' ripreso piu' isterico che mai e quindi non ho tempo in questi giorni da dedicare al gioco.
Abbiate pazienza, spero che tra qualche giorno possa tornare sul "pezzo"... sempre che il mondo esista ancora dopo l'esperimento del LHC ;)

Monday, September 1, 2008

The Cobra

I'm in a hurry, so i'll be short:

I've worked a little on the cobra mk3 you've seen on my last video.
Now it's a little better, but i've to work on it.
I don't like the hull texture, but it gives more depth to the mesh.
The engines now are the original engine of Frontier (and not the ugly cylinders i've used before..).
Do you want to comment? You're welcome





Son di corsa, cosi' saro' breve:

Ho lavorato un po' sull'astronave del giocatore, il cobra mk3, cercando di renderlo un po' piu' decente rispetto a quello che vi ho mostrato nel video precedente.
Ora mi sembra un po' meglio.
Non mi piace molto la texture dello scafo, vorrei trovare qualcosa di meno piatto, comunque rispetto alla versione precedente e' gia' un bel passo avanti.
I motori dell'astronave ora sono quelli usati su Frontier e non piu' quegli orribili cilindri che avevo messo in precedenza.

Ogni commento e il benvenuto ovviamente.