Jump to content

  • Log In with Google      Sign In   
  • Create Account

DareDeveloper's Journal

Working on symmetry math issues

Posted by , in Questions And Problems 11 May 2014 - - - - - - · 774 views
javascript, Raid Aces, symmetry and 2 more...
Working on symmetry math issues I am struggling with symmetry math, because I noticed that something was broken (axis symmetry did not work any more, and fixing that broke something else ... or rather revealed that something never actually worked).

The details can be found in a thread:

I make slow but steady progress on that battlefield.

Since the last screenshot I also changed the height between layers from tile size to 3/4 * the tile size.
The maps are more radable that way, I think, because parts of some covered tiles are exposed.

Posted Image

Lamest progress ever ... working on the foundation

Posted by , in Questions And Problems 07 May 2014 - - - - - - · 726 views
Raid Aces, bugfixing, OOP
Made some changes in the 2D Map creator. I modified the implementation that I had into something that can be used as a superclass.

Now game specific implementations can use the foundation and add/modify logic.
Especially the method
comes in handy now. Iterating over one half of the array depending on the mirroring mode ... being able to reuse that with functions like this one is sweet:
CreatorMap2D.prototype.heightCellularAutomationAction = function(streamSource,
        map, indexX, indexY, mirrorIndexX, mirrorIndexY, neighborTopLeft,
        neighborTopCenter, neighborTopRight, neighborLeft, neighborRight,
        neighborBottomLeft, neighborBottomCenter, neighborBottomRight) {

    var newValueAmount = -1;
    var newValue = -1;

    var currentValueAmount;
    var currentValue;
    for (currentValue = 0; currentValue < 5; currentValue++) {

        currentValueAmount = 0;

        if (currentValue == map.mapArray[indexY][indexX]) {
        if (currentValue == neighborTopLeft) {
        if (currentValue == neighborTopCenter) {
        if (currentValue == neighborTopRight) {
        if (currentValue == neighborLeft) {
        if (currentValue == neighborRight) {
        if (currentValue == neighborBottomLeft) {
        if (currentValue == neighborBottomCenter) {
        if (currentValue == neighborBottomRight) {

        if (newValueAmount < currentValueAmount) {
            newValueAmount = currentValueAmount;
            newValue = currentValue;
        } else if (newValueAmount == currentValueAmount) {
            if (streamSource.consumeBoolean()) {
                newValue = currentValue;

    map.mapArray[indexY][indexX] = newValue;
    map.mapArray[mirrorIndexY][mirrorIndexX] = newValue;

    // if ((map.mapArray.length / 2) == indexY) {
    // log("New height chosen: " + newValue);
    // }
I was struggling with yet another bug. The maps were very biased. 0 was used almost exclusively, only at the edges other values had a decent probability. Counting the value of the current tile as well (not just the neighbors) brought the first improvement, dealing with the equal amount of tiles compared with the current maximum count in a pseudo-random way fixed the problem completely. That happens in the following code, taken from the function above:
        } else if (newValueAmount == currentValueAmount) {
            if (streamSource.consumeBoolean()) {
                newValue = currentValue;
I will write a different algorithm (which creates different levels without steep cliffs) soon and update the rendering.

The current state is pretty lame. It can be seen at ...



Introduced GameState Change, new Problem ...

Posted by , in Questions And Problems 03 May 2014 - - - - - - · 776 views
Raid Aces, JavaScript, HTML5 and 4 more...
Created a repository at Github, guess that means I'll stick with the working title for a while.

I decided to commit a lot more in this case and try to really finish and polish it. So far the project was only supposed to be a playground for WebGL experimentation.

There is now a Java project which will at some point offer server side functionality. So far the project can not be built, though ... I just wanted to have a rough structure in place.
It will take some time until I figure out how to bring the technologies together (Ivy, Spring ... probably Jenkins and connections to a database for file storage - maybe CouchDB).

Currently I am working on the client side, though and that probably will not change for quite some time.
The latest big change was trying to move the map / image creation into a gamestate object in order to handle the process asynchronously.
Unfortunately I do not know enough about the lifecycle of those processes and have yet to really think the mechanism through.

What I have right now works mostly in Chrome and sometimes in Firefox (again!) ... but I am not even sure if it works correctly at all.
The loading information is shown, the mouse pointer does not say "busy", but the text can not be selected, so I guess something is still blocking.
Pretty often Firefox blocks everything for almost the entire loading process ...


Maybe looking into Closures can help with figuring out what I am doing and what I should be doing.

I asked the question on StackExchange:

A feeling tells me that the process is called asynchronously but still blocks everything, because the CPU works on the new process exclusively.
Maybe I have to use several setTimeout calls in order to free CPU resources (so that the tab / browser is never blocked)!?

Found the drawImage problem ...

Posted by , in Questions And Problems 22 April 2014 - - - - - - · 979 views
drawImage, HTML5, canvas, Firefox and 1 more...
Found the bug I wrote about in the last post: drawImage worked in Chrome, but Firefox showed a white image.

I was completely on the wrong track when I noticed that it sometimes works in Firefox when I call the update function after waiting 5 seconds.

What surprised me was that every time it worked it rendered images with only brown tiles, so I abandoned that track (well, also because waiting 20seconds did not improve the odds at all).
Because I am really ... and I mean REALLY bad at google searches I suspected color profiles (hey, they were mentioned in a canvas related stackexchange discussion ... Posted Image along with green pixels ... can that be a coincidence?).

When I ruled those out I suspected caching ... that it somehow managed to render the all brown tiles images because one of them was cached at some point.
I confirmed that caches did play a role by using the reproducible way to generate maps. After a refresh, drawImage always worked and sometimes it even showed an old version of an image (not from the current map).

Of course it turned out to be the obvious thing. I need to wait for the load event of the image before I draw it to the canvas.
It is not that this thought had not crossed my mind right away when the error occurred ... for some reason I thought that was not relevant ... probably because I expected images to be transferred from canvas to img elements immediately - and in this case synchronously.

In hindsight it makes sense that the normal rules apply. After all, the image data is read using a dataURL. Posted Image

GWT Troubles

Posted by , in Questions And Problems 19 March 2014 - - - - - - · 695 views
project, gwt, ivy, gin, guice and 1 more...
I really wanted a very plain GWT website online asap, but I guess it is not that easy because of the path I have chosen.
I can run the web application in DEV-Mode, but I can not use the GWT compiler to create a deployable client version.

It complains because it can not find a file from the GIN-Module ... so it seems as if the way Ivy currently handles the library management is fine for the Eclipse build process but not for the GWT compile process.

My ant-based compilation script is hopelessly work in progress. If I try to finish those things first I will never get anything online - because I die from boredom.
Why does everything have to be so complicated? Sigh ...

Guess I will either try to port what I have so far to Maven ... or ask a colleague for help and actually invest the time in setting up Eclipse, Ant and Ivy properly.