Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.0 Release Notes Preview #74

Open
NTaylorMullen opened this issue Aug 14, 2013 · 0 comments
Open

0.2.0 Release Notes Preview #74

NTaylorMullen opened this issue Aug 14, 2013 · 0 comments
Labels

Comments

@NTaylorMullen
Copy link
Owner

This is a major release of the EndGate framework. Several breaking changes are included in this release as well as several significant features and a few bug fixes.

Breaking Changes

In previous releases you could add "scenery" to the game by doing the following within your game class:

this.Map.Scenery.AddLayer(...);

Now the equivalent of this is:

this.Scene.Add(...);

Note: ZIndexes between existing scenery objects will now be competing for draw order against other element within the game scene.


Before:

var stm: eg.Map.SquareTileMap,
    tm: eg.Map.TileMap,
    st: eg.Map.SquareTile;

Now:

var stm: eg.Graphics.SquareTileMap,
    tm: eg.Graphics.TileMap,
    st: eg.Graphics.Assets.SquareTile;

Before (inside a game):

this.Audio.Load("myAudio", "foo/bar.mp3");
this.Audio.Play("myAudio");
this.Audio.GetAudioPlayer("myAudio");
this.Audio.Unload("myAudio");

Now (equivalent inside a game):

var player = this.Content.LoadAudio("myAudio", "foo/bar.mp3");
player.Play();
this.Content.GetAudio("myAudio"); // This return value is "player"
this.Content.UnloadAudio("myAudio");

Before:
SquareTileMap's loaded all tiles synchronously resulting in them being drawn as an entire graphic once they were added to the scene.
Now:
SquareTileMap's load tiles asynchronously. To have near the same behavior as before you should tie into the SquareTileMap's OnLoaded event handler to determine when the SquareTileMap has finished loading. Otherwise you can keep your existing code if you don't mind seeing SquareTileMap's loaded in asynchronously (you will see the map load in row by row).


Before:

var source: eg.Graphics.Assets.ImageSource;

Now:

var source: eg.Graphics.ImageSource;

Before:

class MyCollidable extends eg.Collidable {
    constructor() {
        super(new eg.Bounds.BoundingCircle(eg.Vector2d.Zero, 3));
    }

    public Collided(data: eg.Collision.Assets.CollisionData): void {
        var iCollidedAt: eg.Vector2d = data.At;
    }
}

Now:

class MyCollidable extends eg.Collidable {
    constructor() {
        super(new eg.Bounds.BoundingCircle(eg.Vector2d.Zero, 3));
    }

    // Note that CollisionData is now in the Collision namespace.
    public Collided(data: eg.Collision.CollisionData): void {
        // All At did was capture the position of "me", so there's really no need to capture that value because we already have it!
        var iCollidedAt: eg.Vector2d = this.Bounds.Position;
    }
}

Before:

var graphic: eg.Graphics.Abstractions.Graphic2d,
    bounds: eg.Bounds.Abstractions.Bounds2d,
    movementController: eg.MovementControllers.Abstractions.MovementController;

Now:

var graphic: eg.Graphics.Graphic2d,
    bounds: eg.Bounds.Bounds2d,
    movementController: eg.MovementControllers.MovementController;


Features

Usage:

class MyGame extends eg.Game {
    constructor() {
        super();
    }

    public LoadContent(): void {
        this.Content.LoadImage("myFirstImage", "/images/foo.png");
        this.Content.LoadAudio("myFirstAudio", "/audio/foo.mp3");

        var image1: eg.Graphics.ImageSource = this.Content.GetImage("myFirstImage"),
            audio1: eg.Sound.AudioPlayer = this.Content.GetAudio("myFirstAudio");
    }
}

Usage:

var circle = new eg.Graphics.Circle(0, 0, 5, "red");

// Change the circle's color to yellow (multiple different ways, all are equivalent)
circle.Color.G = 255; // Since we initialized it to red, changing the green component to 255 makes yellow
circle.Color = "yellow";
circle.Color = eg.Graphics.Color.Yellow;
circle.Color = new eg.Graphics.Color(255, 255, 0);
circle.Color = new eg.Graphics.Color(255, 255, 0, 1);
circle.Color = new eg.Graphics.Color("yellow");
circle.Color = new eg.Graphics.Color("rgb(255, 255, 0)");
circle.Color = new eg.Graphics.Color("rgba(255, 255, 0, 1)");

Usage:

class MyGame extends eg.Game {
    private _emitter: eg.Particles.Emitter;

    constructor() {
        super();

        var emitter = new eg.Particles.Emitter(0, 0, eg.Tweening.Functions.Linear.EaseNone);

        // Build a pool of textures that the emitter randomly selects to emit.
        emitter.AddTexture(new eg.Graphics.Circle(0, 0, 5, "red"));
        emitter.AddTexture(new eg.Graphics.Rectangle(0, 0, 10, 10, "green"));
        emitter.AddTexture(new eg.Graphics.Line2d(0, 0, 10, 10, 3, "black"));
        emitter.AddTexture(new eg.Graphics.Text2d(0, 0, "Hello World", "blue"));

        emitter.Start();

        // Emitter has several different properties that can be modified to affect how the emitter emits particles.  Take a look at the Particles sample to learn more.

        this.Scene.Add(emitter);

        this._emitter = emitter;
    }

    public Update(gameTime: eg.GameTime): void {
        this._emitter.Update(gameTime);
    }
}

Usage:

class MyGame extends eg.Game {
    private _tween: eg.Tweening.ColorTween;

    constructor() {
        super();

        var graphic = new eg.Graphics.Circle(0, 0, 30, "red"),
            tween = new eg.Tweening.ColorTween(graphic.Color, eg.Graphics.Color.Blue, eg.TimeSpan.FromSeconds(1), eg.Tweening.Functions.Linear.EaseNone);

        tween.OnChange.Bind((newColor: eg.Graphics.Color) => {
            graphic.Color = newColor;
        });

        tween.Play();

        this.Scene.Add(graphic);

        this._tween = tween;
    }

    public Update(gameTime: eg.GameTime): void {
        this._tween.Update(gameTime);
    }
}

Usage:  

class MyGame extends eg.Game {
    constructor() {
        super();
    }

    public LoadContent(): void {
        // This assumes "mapJson" is set to your maps JSON data.
        eg.MapLoaders.JSONLoader.Load(mapJson, (result: eg.MapLoaders.IMapLoadedResult) => {
            // Triggered when the map has finished loading
            for(var i = 0; i < result.Layers.length; i++) {
                this.Scene.Add(result.Layers[i]);
            }
        };
    }
}

  • The CollisionManager has been highly optimized. It now uses a dynamically re-sizing quad tree to speedy collision checks. This also involved adding a new parameter to the CollisionManager's Monitor method to indicate if a Collidable is static or not. If a Collidable is static it means that it will not move throughout its life time and it cannot collide with other static objects (since they don't move). Change the CollisionManager to utilize quad trees #6
class Rock extends Collidable {
    constructor() {
        super(new eg.Bounds.BoundingCircle(eg.Vector2d.Zero, 10));
    }
}

class MyGame extends eg.Game {
    constructor() {
        super();

        /*
        * To further optimize the QuadTree you can change the games collision configuration
        * Aka: this.Configuration.CollisionConfiguration.MinQuadTreeNodeSize and this.Configuration.CollisionConfiguration.InitialQuadTreeSize
        */

        // Monitor the rock for collisions but it cannot move, it's "static".  By letting the CollisionManager know that it's static it can further optimize its collision checking algorithm to increase performance.
        this.CollisionManager.Monitor(new Rock(), true);
    }
}


Bug Fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant