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 - - - - - - · 755 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:
http://www.gamedev.net/topic/656527-how-do-i-simplify-the-symmetry-math/

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


Isometric View

Posted by , 10 May 2014 - - - - - - · 930 views
Raid Aces, Isometric, JavaScript and 1 more...
Isometric View I render more than just the central map piece now ... and it is now an isometric view.

There are still quite a few problems with it:

I do not wait with rendering until all the images have been loaded: I update the map each time one of the 9 images is loaded.
That means it will render the map several times with errors. Not exactly a bug, that is more like an unimplemented feature, right Posted Image ?

I wanted to render without a grid, but the way I do the seams now does not allow that. I draw edges that lead to stripes in the resulting composed image. I would have to know something about the neighbor landscapes (or have access to the full map) in order to deal with that problem.

Pretty happy with the progress ... next on the list:
  • Actually create items in a scene graph and use it to offer a controllable camera
  • MOBA areas placed in a pseudo random way to get playable maps with bases, jungle spawns, special item spawns, lanes with arenas, sneak paths etc.)
Then I might add the menu game state with GUI entities ...

Posted Image


Lamest progress ever ... working on the foundation

Posted by , in Questions And Problems 07 May 2014 - - - - - - · 706 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.
https://github.com/AndyThiel/raidaces/commit/ac5a18a04c93c0a42371b3da153f3c1433f46a30#diff-018fbfb70ceebe1c7ba76bb10f797e7d

Now game specific implementations can use the foundation and add/modify logic.
Especially the method
CreatorMap2D.prototype.forEachPixelToUpdate
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]) {
            currentValueAmount++;
        }
        if (currentValue == neighborTopLeft) {
            currentValueAmount++;
        }
        if (currentValue == neighborTopCenter) {
            currentValueAmount++;
        }
        if (currentValue == neighborTopRight) {
            currentValueAmount++;
        }
        if (currentValue == neighborLeft) {
            currentValueAmount++;
        }
        if (currentValue == neighborRight) {
            currentValueAmount++;
        }
        if (currentValue == neighborBottomLeft) {
            currentValueAmount++;
        }
        if (currentValue == neighborBottomCenter) {
            currentValueAmount++;
        }
        if (currentValue == neighborBottomRight) {
            currentValueAmount++;
        }

        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 ...

http://procgames.com/raidaces2/

...though.


Added Symmetry and "Added Performance"

Posted by , 04 May 2014 - - - - - - · 689 views
JavaScript, Raid Aces, Symmetry and 1 more...
Did some optical changes (different heights are suggested) and the maps are now symmetrical (sometimes point, sometimes axis).

http://procgames.com/raidaces/

The StackExchange question helped and my ego is on the verge of being crushed. Basically I let all the timers (25) start at the same time.
That is something that even my little Java concurrency experience should have told me can not be right.
For some reason I thought I could just set the time I want the CPU to be idle with setTimeout.
After I multiplied that time with the image index (0 to 24) it completes faster and it is more responsive, even if it is still a little bumpy.

I need to get better at thinking about what to change and play with when I struggle with this kind of problem.
Stupid brain ...


Introduced GameState Change, new Problem ...

Posted by , in Questions And Problems 03 May 2014 - - - - - - · 769 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.
https://github.com/AndyThiel/raidaces

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 ...

http://procgames.com/raidaces/

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

EDIT:
I asked the question on StackExchange:
http://programmers.stackexchange.com/questions/237863/how-can-i-fix-blocking-javascript-processes

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)!?