I moved to a new URL! Check it out!

posts tagged with: sfml

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?

To Shader Hell and Back

To Shader Hell and Back
As I'm starting to send out builds of Super Sky Sisters for people to test I'm slowly churning through bugs and crashes that I was completely unaware of until the game runs on different hardware. One of those crashes is caused by creating way too many shaders so I've been investigating on how to address that for now.

One big idea I had was to change how Otter uses shaders internally, but I think after some experiments this idea probably isn't going to work. The idea was to have Otter's Shader class keep a cache of compiled shaders instead of creating and compiling a new shader every time. Basically when making a shader it would check to see if an exact copy of that shader has already been created and compiled, and if so it would just use that one.

However that means that every sprite using the same shader would then also be sharing that shader's parameters. So if I wanted to change the color on an enemy, it would change the color on everything else as well. In order to get around that Otter's shader class would then have to manage and apply the shader's parameters before each render. So EntityA could set its parameters before rendering, and then EntityB could do the same.

I went down the rabbit hole a little bit with this technique but quickly found it performs like crap mostly. Iterating through every parameter per shader per entity per render becomes pretty chuggy pretty quickly. At first I thought this would be a pretty good idea since it would reduce hundreds of shaders to just 1, but the process of applying parameters before each render seems to be not the fastest thing in the world.

So now I'm back to the regular old way that Otter does shaders which is creates and compiles one for every shader instance. This has some downsides but I'm pretty sure it still ends up being faster than my experiment with a compiled shader cache.

I have some work ahead of me still to stop some of the crashes for Super Sky Sisters, but I'm pretty sure I know how to fix it it's just figuring out the right arrangement of code to implement the fix!

To SFML or not to SFML

To SFML or not to SFML
That is the question on my mind these days...

I think things would be smoother if I were just running the main C++ version of SFML, but unfortunately I am just way more comfortable in C# which means only having access to SFML.Net.

Don't get me wrong, SFML.Net is pretty great, but I think more and more I'm feeling like I should jump off to something else. I like SFML's API, and I think it does a lot of things in ways that make sense to me, but the support from the game development community just isn't there.

I know I am probably experiencing the old grass is greener feeling, but right now it feels very tempting to start to build Otter to run with something else underneath it. If I were to switch to anything I think right now my best option would be XNA/Monogame.

Image


This is just a quick little test, but it is running in XNA with something much like Otter. Monogame seems to have the biggest support lately when it comes to portability which is pretty appealing. Right now I can barely get the latest version of SFML.Net to cooperate and that's after having someone else send me a compiled version of the library because for the life of me I just cannot get SFML.Net to build.

Just rambling a little bit here. I did manage to get SFML.Net 2.3 working with Otter... but with an unfortunate downside with texture smoothing that for some reason doesn't exist with 2.2. Texture smoothing for whatever reason now has a weird effect on the edges of textures, and when I try to use those textures in shaders I get weird results when sampling pixels around the edges.

Just feeling pretty frustrated I guess! I'm going to go down the XNA rabbit hole a little bit inbetween finishing up Sky Sisters... maybe it's possible to get an XNA build of the game rolling but who knows!

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

Otter Updates

Otter Updates
Some quick Otter updates!

* OnAdded() timing has been changed for Entities. When an Entity is added to a Scene the OnAdded() method is now called after the Entity has updated its component lists. This is so that a component can register with the Entity's OnAdd method before the Entity is added to the Scene.

* Added GetTopEntity() and GetBottomEntity(). These methods allow you to pass in a bunch of Entities and find the top most and bottom most entity in the rendering.

* Added GetComponent() shortcut methods to Component.

* Added CollideEntities<T> method that will return a list of a specific type of Entity.

* Possible graphics changes. I want to explore the possibility of reworking the rendering system to allow for multiple transformations to be applied to graphics. This would possibly allow easier parent to child relationship transformations and more. Mostly because I noticed when working on games that I want to have multiple scales, rotations, and translations applied to graphics at times, and it would be nice if Otter had built in support for it.

That's all for now!

Image