domingo, 3 de mayo de 2015

Understanding CaboTrafalgar Physics 1 - Tidal forces in shipModelZ

Index:

(To come)


This is the first entry of a series to explain where we are now with physics in the game, and where we want to be.

Most of the entries will refer this "dinghy", ShipModelZ, in regards of movement and commands.

This post is actually an easy win, and that's the best way to start a path, with a victory in an apparently difficult topic as "Tidal movement".

During the hundredths of seconds a frame lasts, several calculations are made to try to simulate movement realistically, considering real or apparent wind, boat position, sail position, rudder position and weight location. In this calculation, tide is not considered, as we're calculating movement OVER the tide (same way, we don't consider the movement of the earth around the Sun for highway speed calculation).

Once we know what's the tri-dimensional distance we want to move over the sea, we need to add the absolute movement of the water, giving as the final distance we have moved.

Code explanation:

private void updatePosition(float tpf) {
        Vector3f shipOrientation3f = this.getGlobalDirection();
        this.move(shipOrientation3f.x * localSpeed * tpf, 0, shipOrientation3f.z * localSpeed * tpf);
        this.move(getContext().getWater().getMovement(this.getGlobalDirection()).mult(-30 * tpf));
        shipDirection.setValue(shipOrientation3f);
    }

For this model, all movement is calculated in the direction of the keel, no lateral movement has been modelled yet. Direction of the keel is "this.getGlobalDirection()"

Local speed is the speed "ahead", direction defined by the keel, it acts as the modulus of a vector, while the keel is the direction of the vector.

As we're just interested in horizontal movement, we take first and third elements in the vector, times the speed, times tpf (time per frame) to get the final distance we've moved over the sea.
On top of this, we apply the movement of the tide for that particular location (this is a bug, we should be passing position, not orientation, but it doesn't matter, the implementation of water context is not as complex yet for it to matter), times some handy constant times time per framework.

So magic is done, on top of the ship movement, we have tide speed complicating everything.

That's it for today.. :)

jueves, 2 de abril de 2015

domingo, 25 de enero de 2015

LazyLogin 1.4, what's coming


Maybe because I'm a software engineer, maybe because I'm not good with words, this is my preferred way of explaining what's coming with next version of LazyLogin.

I'm quite happy with current status of 1.3, simple protocol and execution, simple service, and it was enough for the main public release so far for Cabo Trafalgar (0.9).

Now it's time for preparing it for the upcoming developments, and finishing the original ideas that were just half done, promising myself I'd finish them when I saw the concept working.

First, I need to decouple the embedded AMQ, and maybe replacing it with another MQ system. Once done this, LL will publish user information (properly protected, but bearing in mind that this system is meant to be closed and some information can be shared among systems). By all means, I'll try to keep email absolutely enclosed to LL, but I'll need some replacement for private key in the meantime for unverified users.

To these changes, we need to add a proper way to measure performance, securing endpoints with some SSL protection, a better coverage of test across component, integration, sanity and unit, and adding performance testing for first time.

Finally, a notification service integrated in LL would allow our services to send notification emails to users without knowing their address, keeping it safe forever.

I plan to spend some months with this, then, much more to come..

martes, 13 de enero de 2015

Cabo Trafalgar v0.9 Released!

Big one!

Changes:
Connected with LazyLogin and RecordServer services to provide online services.
Profile manager screen.
Control selection to be ready for more than keyboard, and key selection screens.
New Ship introduced, with weight balance control apart from MainSail and Rudder.
Map selection screen now with descriptions and graphic maps for a better understanding.
Introduced tidal sea movement (sea currents) as a possible element in the maps.
Win installer.
Enhanced dynamics, more realistic.
A thousand bugs and aesthetical details fixed. Probably another two thousands created.
And an exit button!!

Tickets:
https://github.com/albertonavarro/cabotrafalgar/issues?q=milestone%3A0.9+

Windows users: Download caboTrafalgar.exe
Linux users: Download JMonkeyClient-0.9.jar and execute it with java -jar JMonkeyClient-0.9.jar

Required: Oracle Java 1.7, Openjdk 1.7 or Oracle Java 1.8, as well as a good graphic card.

Download from: https://github.com/albertonavarro/cabotrafalgar/releases/tag/v0.9

martes, 9 de septiembre de 2014

Not far from Cabo Trafalgar 0.8

It's been long time since I announced version 0.4. That version was a simple game made in a simple way. I can't say it has evolved much as a game, but now it's in position of growing way more way faster.

Version 0.6, one year ago, I introduced Maven for easier configuration and compilation, also I tried to build up a Continuous Integration based on Jenkins. I didn't do bad, and I improved the realism of the movement of my only boat by a lot.
I've recently completed a couple of RYA sailing courses and validated that actually almost all my models and dynamics are about right :) About this time, I moved to git as well.

For Version 0.8, I bought an HP microserver (N54L) and 16GB of RAM, and took it really seriously.

  • Architecture:
    • Lots of vms for having my own infrastructure at home, based on Chef-Server, Xen and OpenSuse.
    • Dev environments, Jenkins, Artifactory, Ssh, Apache and Zabbix.
    • At the end, after some months of setting up, I'm really happy with the infrastructure that's helping me to develop independently, and all I've learned.
  • Continuous Integration / Continuous Delivery
    • You can take a look in ci.cabotrafalgar.mooo.com, it's not always up, I need to save energy and money!
    • All code is still open source and freely available, included the recipes, so Chef-Server is the responsible of carrying credentials.
    • Pipeline in place so the time between pushing of code and it's in production sanity tested is about 10 mins.
      • Build, component-test, deploy to dev, integration test, deploy to prod, sanity test. I'm quite proud of this.
      • All deployed by chef-server in local (hp microserver) and remote (rented remote vms).
    • Uniqueness of compilations and production versions.
    • Binaries and source in artifactory.
  • Product
    • LazyLogin
      • My own implementation for an easy and confortable autentication protocol, passwordless and without need of keeping sensitive information.
      • Made on Maven, Java, Spring, MySQL, Jetty, WSDL, CXF, Logback and another bunch of technologies I've learned recently.
    • RecordServer
      • With the intention of storing and sharing boat counterclock games, I've created this server that uses LazyLogin to authenticate users and provides ranking services.
      • Made on the previous plus WADL (WSDL for Rest), Couchdb, Ektorp... among others.
    • Cabo trafalgar
      • Now improved with Spring, modularized, implementation of screen flows and now using RecordServer and LazyLogin for more interactivity. Not ready for multiplayer games though.
I hope you like these changes, I've enjoyed getting this knowledge

Soon I'll have more news :)

Alberto

viernes, 11 de enero de 2013

Cabo Trafalgar 0.4.0 Released!!!

Cabo Trafalgar 0.4.0 Released!!!

After another two months from the last updated, I managed to finish all I had in mind for this release:

  • Complete internal refactoring, now it's easier to make it grow, yet learning, and almost ready for full modularity. 
  • Now maps are selectable, only two now. No collisions yet, sorry, so no islands or things like that.
  • Now ships are selectable, only two now, but it's been a good research for providing something a bit closer to reality than a surface of wood. It doesn't move, but the polar curve is a bit closer to reality.
    • As a consequence, ShipModelOne is more difficult to use, but gives better results. 
  • WindTunnel, for me, for making the ship development easier, for you, maybe you want to learn a bit more about how your ship behaves.
  • Ghost ship (default enabled). The game is recording your positions, and playing it back when playing again, so you can compete with yourself.
  • Local ranking for every map.
  • Red arrow for wind (is it supposed to improve?)
  • All in a jar, directly executable with java -jar jarname.jar
  • Lots of bugs introduced.
  • Lots of bugs fixed.
  • Mavenized
  • Professional build environment: Jenkins, Artifactory, Sonar.

And thousands of ideas for next releases :)