I moved to a new URL! Check it out!

posts filed under: otter

Otter Updates

Otter Updates
A lot of Otter updates have gone through the pipe over the past few weeks and I should mention what they are!

* RichText bugs related to calculating the longest line of text have been fixed. Basically for one frame the RichText would miscalculate the length of its lines resulting in a slight offset for that frame.

* Fixed a bug with CollideEntities where the same entity could be registered to the list more than once.

* Entities now have a Position property vector.

* Added Scene.GetEntitiesAll()

* Added the ability to load in assets with a packed byte array. (See the Files class for more details.)

* Animating characters after text is written with RichText is now handled in a way that wont reset all the animations when appending to the string. If you don't know what this means don't worry about it.

* Added Coroutine.WaitForTween() to make it simpler to pause a coroutine until a tween has finished.

* Debugger.Summon() is now public and can be called from code. This isn't tested very thoroughly and could result in some undesired behavior in rare cases.

* Added Component.GetEntity<T>() to make it easier to get the correct Entity type. (Basically just hiding the casting in that method instead of having to cast Component.Entity)

* Input has static methods for getting joystick information (GetJoystickName, VendorId, and ProductId)

* Slight optimization in some collision methods (not very noticeable probably.)

* Added Graphic.TextureChanged() virtual method. Called when a graphic's texture has been changed.

* Added a Countdown Component for simple timers that just count down to zero from a specific time.

* Scene and Entity have indexers now for integers. Entities and Components are given unique integer ids when they are added to Scenes and Entities respectively. Not sure if this is useful, but adding it seemed like a good idea.

Okay I think that covers most of it.

Also for other types of Otter updates you should follow this instragram.

Otter on Nuget

Otter on Nuget
Thanks to the help of some friendly internet folks I finally got a process to get Otter up and running on Nuget! You can check out the latest main build of Otter all wrapped up as a Nuget package right here.

Image


I know that it was in demand for awhile now but for the longest time I just couldn't figure out the process needed to get Otter up there. Now you can enjoy all the luxuries of the Otter game making framework without having to go download files and move them around and all that junk. Just install the package from Nuget and you're good to go!

Also somehow the name Otter wasn't taken already?

Otter Updates

Otter Updates
Okay apparently it's been like three months since I've posted about Otter updates, and there's been a lot since then. I guess since my life was in chaos for the past few months I slipped up. Oh well! Here's a quick breakdown on changes and fixes to my C# game making framework thing.

* Fixed a bug with rendering a BoxCollider with a width or height of 1 or 0.

* Fixed a rendering bug caused by changing the font size of a RichText object at runtime.

* Added flags for Sound and Music to check if they're currently playing audio. Sound.IsPlaying and Music.IsPlaying will be true if they're playing back audio.

* Added Color.Shade(float) which will return a color from black to white with the specified float. For example Color.Shade(0.5f) will return a gray color where 0.5f is set for red green and blue.

* Fixed a bug in Input.CharToKey() (a key was missing...)

* Fixed a bug in CollideEntities where an Entity could collide with itself.

* Added Collider.Overlap(x, y, px, py) which will do an Overlap test with a specified point (px, py) Very useful for doing UI stuff and checking for a point overlapping a collider.

* Fixed a bug with LastPressed and LastReleased timers on Button.

* Added Util.ListCombine<T>() to take a bunch of lists and combine them into one list. I don't know if this is already a C# thing so whatever.

* Added Color.FromBytes()

* Added Axis.Reset() to totally clear an Axis's input state.

* Added Button.Reset() to totally clear a Button's input state.

* Fixed a bug where Gradient wasn't blending with its Color.

* Added DataSaver.FileExists().

* Added Particle.ActiveCount but I'm not totally sure if this works as intended.

* Fixed a bug where creating a Text object would not accept an SFML.Graphics.Font.

* Added MouseDeltaX and MouseDeltaY to get the mouse movement since the last update. Mostly used for locking the mouse inside the game window.

* Util.GetFieldValue works for static fields now.

* Added Scene.CameraFocus which if set to an Entity the Scene will then follow that Entity.

* Added Rand.IntXY which returns a vector2 of ints.

* Reworked EventQueue component into EventStack and EventQueue.

* Added GraphicList which is a Graphic type that is a list of graphics.

* Added Anim.OnNewFrame() which is invoked whenever the current frame of an Anim changes. Useful for tying code to specific frames of an animation.

* Huge debugger api changes which uses attributes now instead of RegisterCommand with CommandTypes. Check out the example here to see the new style.

* Added a bunch of stuff to the Debugger like tab auto complete and parameter help when typing in a command.

* Entity.UpdatedOnce is now public (private set.)

* Scene.RemoveNextFrame(Entity) will remove an entity with a one frame delay.

Wow that's a lot of stuff! I'm really happy with the new debugger API that uses all kinds of crazy reflection stuff now instead of a bunch of RegisterCommand method calls.

If you've been using Otter then you should drop by the official slack sometime and hang out with your fellow otter lovers!

Otter Example: Tweening

Otter Example: Tweening
Did you know that Otter supports tweening? Now you do! Tweening is one of the coolest things in the world in my opinion and it's one of the easiest ways to create sweet effects and animations in games.

Image

(I don't know what's up with the end of this gif so whatever.)

Otter makes use of the Glide tweening library by Jacob Albano. It has a similar syntax to TweenLite from the AS3 days of using FlashPunk, and since Otter is based off of FlashPunk having a syntax similar to a flash tweening library makes a lot of sense to me.

Check out the full source code of this example on the Otter example page!

Otter Example: Surfaces

Otter Example: Surfaces
Another Otter example has washed ashore. This one deals with understanding how to use Surfaces. Check out the full example right here to see how to make pretty pictures using Surfaces.

Image


Image


Surfaces are essentially just wrappers for a render texture. I like to think of them as canvases that can be drawn to. Otter by default uses one big Surface the size of the game window to render the game. Surfaces can be a great way to add something like a minimap or HUD to your game, or make use of shaders. I often use multiple surfaces when making my games so that I can zoom in and out on the main Surface and keep things on the HUD unaffected by the zooming.

Otter Updates!

Otter Updates!
I've been pretty productive on coding stuff lately so with that comes some updates for Otter! Here's some of the things that have changed or been added lately in the dev branch:

* OgmoProject has a lot more utility methods now like GetValue() and GetLayerData(). If you need to check out level data before actually loading a level into a Scene this can be pretty useful.

* Added OgmoProject.RemapAsset() for when you need to assign a different path for an asset being referenced in your Ogmo projects. For example if you need to take the path of a tilemap from the ogmo project and reassign it to something else when being loaded into the game.

* Fixed a thing that I broke in SetHibox on Entities.

* Util.Clamp now supports Vector2 input and output.

* Added shortcuts to Scene methods like GetEntity<> on Entity just to make code a little bit less verbose at times.

* Added Button.LastPressed and Button.LastReleased. These are both timers that will count up since the last button press and release respectively. Pretty useful for doing input buffering type stuff, or waiting until an input has been released for some amount of time before changing state, and all that kind of stuff.

* Added GetFillRect() to NineSlice.

* Made Debugger.RegisterInstantCommand() public and added Util methods to go along with it. You can now add debug commands that can be used immediately instead of executing them at the next update. Also fixed some bugs in the debugger related to this.

* Fixed the rendering of GridCollider (it was too large by 1 pixel for each cell.)

* Added GetTileIndex() to Tilemap and GetIndex() to TileInfo.

* Texture.CopyPixels now actually works (warning: blittng operations are very slow.)

* More Collider parameter options in all of the Collide, Overlap, etc methods.

* Added Scene.GetEntitiesWith<> which is a weird way to grab a list of Entities that have a specific set of Components. This is probably very slow and should be used sparlingly, but it might be useful to some folk.

* Various small fixes and tweaks that don't really effect end users.