Hello Guest

Author Topic: Otter Updates  (Read 191330 times)

0 Members and 2 Guests are viewing this topic.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #15 on: May 30, 2014, 11:52:14 AM »
I just pushed another wave of updates on the journey to the big 1.0.0.

* Text and RichText's rendering positions have been changed.  The default origin will now be the top left most position of any text, instead of allowing for "bleed."  This should make it simpler to deal with.

* The Tilemap class got a few updates including a performance boost for clearing tiles, and a final pass on tile layers.  Everything in the Tilemap class should now be usable as intended.

* Documentation fixes and updates across the board.

* Debugger has been updated to adjust for the Text updates.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #16 on: June 12, 2014, 02:12:00 PM »
* Text now has CenterTextOrigin() in an attempt to find the center of the actual text, and not the full bounding box.

* RichText also now has CenterTextOrigin()

* Fixed Text bug that would cause text to jitter when the height of the tallest character was changed.

* Fixed the same issue in RichText.

* Tilemaps have had some improvements in their performance for looking up tiles.

* Tilemaps can now use Enums for their layers.

* Fixed bugs with accessing tiles out of range in a Tilemap. Tiles are now automatically clamped inside of the limits of the Tilemap.

* Tilemap GetTiles() will return a list of TileInfo objects for every tile on a specific layer.

* GridCollider now has a Clear() function

* GridColliders can now load collision data from a Tilemap, using a specific layer on the Tilemap.

* Fixed a bug with not updating Graphics when their alpha was changed.

* Game's "SmoothAll" value should now actually affect Textures. Considering changing this to a static value on Texture.

* Fixed crash bug with Surface's SaveToFile() function.

* Updated the Glide Tween Library to the latest revision.

* Updated the documentation.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #17 on: June 16, 2014, 12:14:12 AM »
In the dev branch I pushed a few changes:

* Bug fixes for Text and RichText rendering

* Particle class no longer uses Tweens, should be more efficient now maybe.

* Entity LifeSpan is now a float (for all you delta time people out there.)

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #18 on: July 29, 2014, 04:02:41 PM »
In the dev branch:

* Added SetPosition() to Graphic

* Added Start(Scene firstScene) to Game.  (Instead of having to set Game.FirstScene)

* Added SurfaceX() and SurfaceY() to Surface for getting the positions on a surface relative to the game window (doesn't work for scaling and rotating yet though.)

* Added a bunch more utility stuff to Tilemap.

* Minor Entity updates.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #19 on: September 07, 2014, 04:08:16 PM »
In the dev branch:

* Auto tiling supported now for Tilemap

* Fixed screen resolution bug when using SetWindowScale or SetWindow with only a width argument

* Some tweaks to Joystick related input things

* Deadzone changed back to being separate for X and Y axes

* I think some other minor changes or tweaks that I can't remember right now

I'll be merging with the default branch probably in a week or two.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #20 on: September 15, 2014, 04:28:26 PM »
In the dev branch:

* Music no longer uses EventRouter for global volume changes.

* QuitKey has become QuitButton, and defaults to having the Escape key registered to it.

Fruckert

  • Member
  • Posts: 60
  • Total Square
    • View Profile
Re: Otter Updates
« Reply #21 on: September 15, 2014, 08:25:30 PM »
How does the autotiling work?
I'm having a bit of trouble following the code.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #22 on: September 16, 2014, 01:47:23 PM »
I'll work on an example today ;D

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #23 on: September 16, 2014, 02:48:51 PM »
In the dev branch:

* Added an auto tiling example in the Examples folder.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #24 on: September 30, 2014, 06:07:37 PM »
Merged the dev branch in today for 0.9.7

* Updated Glide tween library

* Sessions now have an indexer for data

* Atlas.Exists() fix

* Collision multi-add bug fix

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #25 on: October 05, 2014, 02:05:45 PM »
In the dev branch:

* Added Polygon class

* Added PolygonCollider for testing collisions with convex polygons (concave don't work!)

* Various minor fixes in some of the Colliders

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #26 on: October 17, 2014, 01:11:30 PM »
In the dev branch:

* Fixed a dumb memory leak in the RichText class.

Fruckert

  • Member
  • Posts: 60
  • Total Square
    • View Profile
Re: Otter Updates
« Reply #27 on: October 29, 2014, 02:07:32 PM »
So, the DataSaver class acts a little different than I was expecting.
The old Game.GetConfigData would set the data to the given default if nothing was found, but this one doesn't.
Might I ask why not?
I found it pretty useful for first-time runs. I'd set it to load from the file, get all of the config options with the defaults, and then save the file before Game.Start was ran. On the first run this would generate a new .cfg file with all of the default settings, and if a setting got erased from the file the game would write the default back in. I have that set up halfway with the DataSaver, but because it just returns the default instead of setting it the game just saves an empty .cfg.

Kyle

  • Administrator
  • Member
  • Posts: 258
    • View Profile
Re: Otter Updates
« Reply #28 on: October 30, 2014, 04:36:05 PM »
Are you using the "OrDefault" methods?  For example there's a GetInt, and a GetIntOrDefault, which you can specify a default value to return if nothing is found.  Maybe I'm not totally understanding what is different now ;o
« Last Edit: October 30, 2014, 04:46:41 PM by Kyle »

Fruckert

  • Member
  • Posts: 60
  • Total Square
    • View Profile
Re: Otter Updates
« Reply #29 on: October 31, 2014, 10:53:19 PM »
The previous methods in Game and Session would add the given default if it wasn't found. DataSaver doesn't.
Code: [Select]
/// <summary>
/// Retrieve an option from the game options but return a default value if that value isn't found.
/// </summary>
/// <param name="key">The key to search for.</param>
/// <param name="onNull">The default value to reutn if that key isn't found.</param>
/// <returns>The value on the key, or the default value if no key is found.</returns>
public string GetOption(string key, string onNull = "") {
    if (GameOptions.ContainsKey(key)) {
        return GameOptions[key];
    }
    else {
        GameOptions.Add(key, onNull); //Right here!
        return onNull;
    }
}

This is how I was expecting it to work:
Code: [Select]
public float GetFloatOrDefault(string key, float defaultIfNotFound = default(float)) {
    if (data.ContainsKey(key)) {
        if (string.IsNullOrEmpty(data[key])) {
            SetData(string, defaultIfNotFound);
            return defaultIfNotFound;
        }
        float test = 0;
        if (!float.TryParse(data[key], out test)) {
            SetData(string, defaultIfNotFound);
            return defaultIfNotFound;
        }
        return GetFloat(key);
    }
    SetData(string, defaultIfNotFound);
    return defaultIfNotFound;
}
Something like that.

I was using it when the game booted to ensure that .cfg files would generate.
I'd tell the game to load the config file, do things like "Game.SetWindowScale(float.Parse(Game.GetConfigData("screensize")));", and then save the file before Game.Start.
On the first boot, because nothing was set in the config yet, it would populate everything with default values and then save the .cfg file. And, if keys were deleted from the .cfg, it would load them back in.
Sorry if I'm explaining it poorly, I have a hard time getting thoughts and ideas out of my brain and into writing.