Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Jun 2013
Offline Last Active Oct 19 2016 04:22 PM

Posts I've Made

In Topic: Clash of the Daemons

11 September 2016 - 11:54 AM

Hi everyone!

Here are some news about my little project which can be tested here: Clash of the Daemons.

  • We can now move and attack at the same time. More generally, the input handling has been improved with implementation of multiple commands assignement for a keystroke as well as a delay before repeat.
  • We can go back to the title screen after the game over.
  • Behaviors can now be assembled together.
  • High-level behaviors have been redesigned, especially ranged attack and hit-and-run.
  • A new behavior, sneak attack, has been implemented (Fig. 2).
  • A character (pawn) can have a set of weapons (inventory). Current weapons are claw (melee) and fireballs (ranged). Only one weapon can be active at a time. Each weapon has a charging time (time needed before activation), an activation time (time the weapon is active as well as its effects) and a cooldown time (time during which the weapon is unsusable).
  • Key mapping has been changed accordingly. CTRL to attack, and TAB to switch to the next weapon.
  • Debugging mode has been improved. These following informations can be displayed: FPS, grid, velocity vector, obstacle detector, hitbox, collisions, simplified sprites (Fig. 3).
  • Improved the build process with the automation of graphical assets compilation (mainly the spritesheet).
  • Title screen has been updated and improved a little bit (Fig 1.)

Bug fixes:

  • Attack animations run to their last frame.
  • A memory leak in the AI module has been fixed.
  • When the player loses a life, the HP bar now updates accordingly.
  • Monsters will not be spawned at the same location of another game object anymore.

Fig. 1: Title screen

Fig. 2: Sneak attack behavior

Fig. 3: Displaying debug mode informations

There is a lot of room for improvements (and bug fixes! ^_^) of course. 

Still, if there is anyone serious enough interested in this project, for improving its game design, gameplay, graphics, sounds, musics, background story, programming also, feel free to contact me.



In Topic: Distinct quadtrees for static and moving objects

19 August 2016 - 06:46 PM

I am currently finishing to implement a small prototype, and fix some bugs.

After that, I plan to run a first benchmark between a simple quadtree with all game objects and a quadtree with two layers, one for static objects and another for moving objects.

I will publish my results here of course.

Then, I will try to implement some other structures to compare their performance with quadtrees.

In Topic: Distinct quadtrees for static and moving objects

18 August 2016 - 12:35 PM

I have done some search about AABB tree and it looks promising for both static and moving objects. Are they faster than Quad Tree?

In Topic: Distinct quadtrees for static and moving objects

18 August 2016 - 10:09 AM

There are data structures that are optimized for "build-once read-many". So there is definitely some value in separating out static objects from movable ones. You wouldn't use the same data structure for both, though. There are a lot of data structures out there that are optimized for different situations, so choose the right one for each case if you need optimization.


That said... if you keep your code well designed, it should be easy to swap out implementations later after you have everything built so you can test real world situations and find the data structure that works best for you.

Would you have some suggestions about data structures that could be more suitable than quadtrees for static objects?

In Topic: Land/Sea ratio from a Heightmap

01 August 2015 - 07:14 AM

Thank you for your reply. While you were writing your answer, I came up with another solution involving the histogram.
I define my ranges according to the average altitude of the map and its standard deviation.
First, I compute the cumulative histogram cumHisto:
    var cumHisto = 0;

    for (var i = 0; i < World.width; i++) {
        for (var j = 0; j < World.height; j++) {
            cumHisto += World.mapData[i][j];
        } // for j
    } // for i
Then, I compute the average altitude avgHeight:
    var nbPoints = World.width * World.height;
    var avgAltitude = cumHisto / nbPoints;
I need a loop to compute the standard deviation stdevAltitude, based on the variance varAltitude:
    var varAltitude = 0;
    for (var i = 0; i < World.width; i++) {
        for (var j = 0; j < World.height; j++) {
            var diff = World.mapData[i][j] - avgAltitude;
            varAltitude += diff * diff;
        } // for j
    } // for i

    var varAltitude = varAltitude / nbPoints;
    var stdevAltitude = Math.sqrt(varAltitude);
Given the average altitude and its standard deviation, I can define four ranges which seem to give quite reliable results:
    for (var i = 0; i < World.width; i++) {
        for (var j = 0; j < World.height; j++) {
            if (World.mapData[i][j] < avgAltitude) {
                World.mapData[i][j] = Terrain.DEEP_OCEAN;
            else if (World.mapData[i][j] < avgAltitude + 0.5 * stdevAltitude) {
                World.mapData[i][j] = Terrain.COASTAL_OCEAN;
            else if (World.mapData[i][j] < avgAltitude + 2 * stdevAltitude) {
                World.mapData[i][j] = Terrain.FLAT;
            else {
                World.mapData[i][j] = Terrain.MOUNTAIN;
        } // for j
    } // for i
mini_837212Capturedcran20150801142639.pn mini_317439Capturedcran20150801142726.pn mini_441266Capturedcran20150801142737.pn mini_372853Capturedcran20150801142749.pn