A TURTED based real-time thing that I’m proud of…

I recently finished a nice little example of how to use real-time data for an exciting and equally relaxing view:

Blocker Champ Real Time


http://reloaded.karopapier.de/blocker

What’s that?
It shows a list of players and the number of games where it is their turn.
As soon as they make a move, they are moved to the new position with a nice animation.

Interestingly enough, the hardest part was the JQuery/UI animation stuff.
Since it already is based on the components that are soon to become the TURTED project the real time events were already there to be intercepted and used.

So, if you feel stressed, just sit back, relax and watch the squares move – the ZEN of Karopapier

Planned something new: KaroAPI

Planning, planning, planning…
Last night I read some stuff about RESTful applications… and of course, quickly, the following plan came to my mind: I need it! Somewhere!
And of course, as always, the best baby for testing and applying new techniques is www.karopapier.de
So I decided I need a KaroAPI, using RESTful approaches.

Digging through it, the next question came: Should I use XML or JSON for the output? Or both?

JSON has the advantage to be shorter, I like it better AND: It could be used in a new JavaScript based frontend. Imagine to simply to a AJAX/JSON request for the details of a game and nicely format the data in a Browser.

XML, older, more widely spread, is more commonly used and maybe can be parsed with some clients more easily – and applying XLS/XLST it could also be readable and nicely formatted for humans.

Next thought was: “Well – offer both” – creating an object with PHP and then either apply a json_encode or XML_Serialize should not be a big deal, right?
Well, we would see…

And not enough of all the big plans, I thought I could give symf Symfony2 a try.

Sooooo:
Big plan, draft 0.3:

  • KaroAPI
  • JSON and XML representation of data (for bots, clients and other KaroTools)
  • use Symfony2 for the implementation

Added to the todo list… the big problem – already so much on this list. And I never manage to do it one by one, but get distracted by so many other interesting things…
Like, lately, when I introduced APE into the chat. But, Hey, I did not even blog on that yet…

Nächster Plan: Karo2.0 auf Doctrine

Posted on 2009-09-25

So, der Plan für die nächste Zeit lautet:

Alles, was ich bisher in Karo2.0 gemacht habe, auf Doctrine umzubauen. Warum? Ganz einfach: Ich will ordentliche Unit Tests machen, um mit den ganzen Funktionen (insbesondere denen zum “aufräumen”) sicher zu sein. Und das macht sich am besten, wenn man nicht die “echte” sondern eine Testdatenbank benutzt.

Und da propel das nicht so gut drauf hat, mehrere Datenbanken gleichzeitig zu bedienen… werde ich wohl doch jetzt auf Doctrine umstellen – und somit nochmal “fast from scratch” neu anfanfen – aber diesmal dabei gleich die Tests schreiben.

Krasses Unterfangen, aber wir schon irgendwie gehen.

Von daher: Heut kommt der große Moment, wo ich mit die “original”-DB nochmal runterziehe und mir daraus dann ein schema erstellen lasse. So der Plan – mal schauen, wie weit ich komme, bis ich verzeifle…

Krasse Java Script Kartendarstellung

Posted on 2009-09-16

Seit gestern gibt’s mal wieder was neues bei Karopapier, das zumindest so auch mal sichtbar ist -wenn auch nur als Prototyp.

Unter Zuhilfenahme der sehr hübschen JavaScript Graphics Library wz_jsgraphics (http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm) hab ich die Karokarten bzw. die Züge der User KOMPLETT in JavaScript zeichnen können.

Die Vision, dass man dem User/Client prinzipiell nur die rohen Zugdaten liefert und er sich seine Kartenansicht selber baut, gibt’s schon länger. Denn Karten Zeichnen braucht ja doch ne gewisse Performance auf dem Webserver.

Mit dieser Library scheint es aber zumindest in gewissem Maße möglich zu sein, dies auszulagern. Einen Prototyp davon hab ich schon seit einem Jahr oder länger schimmelnd rumliegen gehabt, ihn aber gestern wieder ausgegraben und mit meinem etwas gewachsenen JS-Wissen der letzten Monate weiter ausgebaut.

Somit war es dann sogar möglich, pro Spieler eine Ebene mit den Zuglinien (Canvas) zu erzeugen, die dann natürlich auch einfach mal schnell ein- oder ausgeblendet werden können. Somit ließe sich auch ganz praktisch ein “Wo war ich schon” schnell auf der gesamten Karte anzeigen lassen.

Evtl. ließe sich damit auch ein JS-basiertes Replay (à la KaroTools, einfach genial, aber wg. SVG halt nur bedingt populär) umsetzen… aber mit dem window.setTimeout bin ich bisher noch nicht ganz warm geworden bzw. es führt mit der Library zu Problemen (this-bind-Problem)

Wie auch immer, ich hab’s mal eingebunden und als Alpha-Version verlinkt, wenn es auch bei manchen Spielen einfach mal kommentarlos abfackelt… aber is ja Alpha, nich mal Beta 😀

Nächste Ziele

Original Date: 2009-09-07

Was mir seit dem Wochenden bzw. dem symfony day in Köln klar geworden ist: Applikationen testen kann man auch einfacher haben, indem man sich halt mal hinsetzt und Unit/Functional tests schreibt.

Das heißt für mich: Bei meinem karopapier 2.0 werde ich jetzt mal ein paar Fälle bzw. Testdaten generieren und mir ein paar ordentliche Tests schreiben. Und wenn die in den verschiedenen Kombinationen das tun, was sie sollen, dann kann ich ja sogar mal die “KaroMAMA” (“Multiple Automatische Müll Aufräumer”) live schalten.

Die tut ja schon seit einiger Zeit, aber ich trau ihr noch nicht so richtig, um sie auf’s Produktivsystem zu lassen. Aber danach vielleicht?

Und das zweite Ziel wird dann evtl. sein, Karo2 von propel auf doctrine umzustellen. Muss ja eh irgendwann…

Ach ja, und den Ajax-Chat für Karo, der unter karo2 schon läuft, müsst ich auch noch fertig machen, so dass man auch mal was eingeben kann. Das Problem, dass mir die RegExp von “Botrix, was verstehst Du” die JSON-Daten zerschießen, werd ich mit ganz viel en- und decoding schon irgendwie hinbekommen *hoff*