Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Kyle

Pages: [1] 2
Help / Discord!
« on: May 23, 2018, 06:25:14 PM »

Join us in Discord for more active discussions using Otter, C#, and other stuff.

Projects / Discord!
« on: May 23, 2018, 06:24:45 PM »

Join us in Discord for more active discussions using Otter, C#, and other stuff.

Bugs / Discord!
« on: May 23, 2018, 06:24:11 PM »

Join us in Discord for more active discussions using Otter, C#, and other stuff.

Ideas / Discord!
« on: May 23, 2018, 06:23:42 PM »

Join us in Discord for more active discussions using Otter, C#, and other stuff.

General / Discord!
« on: May 23, 2018, 06:22:38 PM »

Join us in Discord for more active discussions using Otter, C#, and other stuff.

Bugs / Open Broadcaster Software, Surfaces issue
« on: July 14, 2015, 12:48:54 AM »
I've discovered a crash in Otter that only happens when using Open Broadcaster Software.  If you are capturing an Otter game using the Game Capture mode, it seems that the game will crash when creating a Surface after the game has already started (so after the window has been created.)

If anyone out there can test this for themselves it would be a huge help for me to try and confirm that is whats happening, and it's wide spread or not.  If you can download Open Broadcaster Software from here: https://obsproject.com/ (use the Windows 7/8 beta, not the multiplatform) and try capturing your Otter project using Game Capture.  At some point during your game create a new Surface and render some stuff to it, and then render it to the screen, and see if the game will crash at that point.  If you can crash it, it would be awesome if you could post the crash message, the relevant source code, and your hardware specs (mostly video card and operating system matter, I think.)


(here's some test code that I used, you can just copy and paste this if you want)
Code: [Select]
using Otter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OBSCrashTest {
    class Program {
        static void Main(string[] args) {
            var game = new Game("OBS Crash Test");
            game.Color = new Color(0.5f, 0.25f, 0.25f);

            game.Start(new TestScene());

    class TestScene : Scene {

        public TestScene() : base() {


        public override void Update() {

            if (Input.KeyPressed(Key.S)) {
                Add(new TestEntity());


    class TestEntity : Entity {

        Surface surface = new Surface(100, 100, Color.Black);

        public TestEntity() : base() {
            SetPosition(Rand.Float(Game.Instance.Width), Rand.Float(Game.Instance.Height));

            surface.AutoClear = false;

            surface.Draw(Image.CreateCircle(30, Color.Red), Rand.Float(100), Rand.Float(100));

General / Otter examples coming soon!
« on: July 09, 2015, 03:57:26 AM »
Finally got around to setting up a proper way to post examples here: http://otter2d.com/example.php and I should be adding some in the coming weeks. ;D

Ideas / Otter Internals Discussion
« on: June 30, 2015, 06:10:26 PM »
Hello!  Lately I've been thinking about getting Otter off of the SFML.Net train and putting it on something else, but I'm not sure if this is both necessary or worth it.  Some options are trying to go for a more direct route to openGL with C# and just cut out SFML, or port it to Monogame, or maybe there's some other options out there I'm not aware of.

I'm wary of the portability of SFML, and also the support of SFML.Net in general.  SFML.Net right now still remains to be behind in the recent SFML updates and I'm not sure how much of a priority it is for the SFML team.  Also I've spoken to a few devs that have deeply regretted their choice of SFML when it came time to port their games to various platforms, and that's a little scary!

If anyone has any ideas or thoughts on the matter please let me know! This isn't something that I'm going to be immediately doing, but will be something for the future.

General / Surface Example
« on: April 29, 2015, 04:40:34 PM »

Code: [Select]
using Otter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SurfaceExample {
    class Program {
        static void Main(string[] args) {
            // Create a new game to play.
            var game = new Game();

            // Set the scroll of the surfaces to 0 so they never scroll on the camera.
            Global.SurfaceGameplay.Scroll = 0;
            Global.SurfaceHud.Scroll = 0;

            // Start the game with a new GameScene.
            game.Start(new GameScene(1000, 1000));


    class GridBackground : Entity {
        public GridBackground() : base() {
            Layer = 10;
            Surface = Global.SurfaceGameplay;

        public override void Added() {

            // Just render a simple grid background so when the camera scrolls we can see it.
            AddGraphic(new Grid(Scene.Width, Scene.Height, 40, 40, Color.Cyan));
            Graphic.Alpha = 0.4f;

    class Player : Entity {
        public Player(float x, float y) : base(x, y) {
            // Add a basic red box for the graphic.
            AddGraphic(Image.CreateRectangle(20, 20, Color.Red));

            // Assign this entity to render to Global.SurfaceGameplay instead of the default game surface.
            Surface = Global.SurfaceGameplay;

            // Set up a collider for movement.
            var collider = AddCollider(new BoxCollider(20, 20));

            // Set up the rest of the movement stuff.
            var axis = AddComponent(Axis.CreateWASD());
            var movement = AddComponent(new BasicMovement(400, 400, 30));
            movement.Axis = axis;
            movement.Collider = collider;

    class PlayerHud : Entity {
        public PlayerHud() : base() {
            // Basic hud test with just some text.
            AddGraphic(new Text("This is the HUD!", 20));

            Surface = Global.SurfaceHud;

    class GameScene : Scene {
        public GameScene(int width, int height) : base(width, height) {
            // Add the entities to the scene when the scene is created.
            Add(new Player(HalfWidth, HalfHeight));
            Add(new GridBackground());
            Add(new PlayerHud());

        public override void UpdateLast() {

            // Set the scene's camera to follow the player.
            var player = GetEntity<Player>();
            CenterCamera(player.X, player.Y);

            // Set the surface's camera to follow the scene's camera.
            Global.SurfaceGameplay.CameraX = CameraX;
            Global.SurfaceGameplay.CameraY = CameraY;

            // Zoom the surface up and down with the arrow keys.
            if (Input.KeyDown(Key.Down)) {
                Global.SurfaceGameplay.CameraZoom -= 0.005f;
            if (Input.KeyDown(Key.Up)) {
                Global.SurfaceGameplay.CameraZoom += 0.005f;

        public override void Render() {

            // Render the surfaces.

    class Global {
        // Keep global references to the surfaces used for rendering the game.
        public static Surface SurfaceHud = new Surface(640, 480);
        public static Surface SurfaceGameplay = new Surface(640, 480, Color.Gray);

Help / Auto Tiling Example
« on: September 16, 2014, 02:48:14 PM »
An auto tiling example program can now be found in the examples folder: https://bitbucket.org/kylepulver/otter/src/380a3518e5cc377361e2728bf80f3ce3b9fde11c/Examples/AutoTilingExample/?at=dev

Let me know if you have any questions!

Projects / Starforger 2
« on: September 09, 2014, 01:05:08 AM »
A few weeks ago I went to a local game jam in Phoenix!  The them was discovery and I set out to make some kind of space exploration procedural thing.  The final result was a game I named Starforger II.  There is no Starforger I, but maybe I can make a prequel someday.

Starforger II v1.0 - Windows (92mb)

Whoa what's with the file size?  Well this game has a lot of weird sounds in it, and maybe I can figure out how to get them more compressed, but right now they take up a lot of space.

The game uses Enter, X, C, and the arrow keys, or a USB game controller (although the game is designed around the 360 controller, so using one of those would be ideal.)


Projects / Explosion Shockwave Shaders
« on: June 11, 2014, 04:29:04 PM »
An example of doing explosion shockwaves and gradient mapping:


Projects / Neat Shader Example
« on: June 02, 2014, 11:28:14 AM »

Just a quick shader example that I was playing around with yesterday.  Download the source and the files here: http://otter2d.com/download/shaderz.zip

You can paint onto a hidden surface that manipulates the image with a shader.

Code: [Select]
using Otter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShaderTesting {
    class Program {
        static void Main(string[] args) {
            var image = new Image("pic.jpg");
            var game = new Game("ShaderZ", image.Width, image.Height);

            game.FirstScene = new TestScene();


    class TestScene : Scene {

        Image image = new Image("pic.jpg");
        Image circle = new Image("circle.png");
        Axis axis = new Axis(Key.W, Key.D, Key.S, Key.A);
        Surface distortion;

        public TestScene() {
            distortion = new Surface(image.Width, image.Height);
            circle.Blend = BlendMode.Add;
            circle.Alpha = 0.1f;
            distortion.Visible = false;
            distortion.AutoClear = false;

        public override void Update() {
            //image.X -= axis.X * 3;
            //image.Y -= axis.Y * 3;

            if (Timer % 30 == 0) {
                try {
                    image.Shader = new Shader("../../shader.frag");
                catch(Exception e) {
                    Console.WriteLine("Shader error:");
                image.Shader.SetParameter("gradient", new Texture("gradient.png"));
            if (Input.MouseButtonPressed(MouseButton.Right)) {
            image.Shader.SetParameter("time", Timer);
            image.Shader.SetParameter("distortion", distortion.Texture);
            image.Shader.SetParameter("offset", Util.SinScale(Timer, 0, 1));
            image.Shader.SetParameter("mixfactor", Util.SinScale(Timer * 0.1f, 0, 1));

            if (Input.MouseButtonDown(MouseButton.Left)) {
                Draw.Graphic(circle, MouseX, image.Height - MouseY);

        public override void Render() {

            Draw.Circle(MouseX - 15, MouseY - 15, 30, Color.None, Color.Red, 2);

Code: [Select]
sampler2D texture;
sampler2D gradient;
sampler2D distortion;
uniform float offset;
uniform float time;
uniform float mixfactor;

void main() {
vec2 pos = gl_TexCoord[0];
vec2 distortColor = texture2D(distortion, pos);
pos.x += distortColor.r * (sin(time * 0.1) * 0.05);
pos.y -= distortColor.g * (cos(time * 0.1) * 0.05);
vec4 color = texture2D(texture, pos);

float gray = (color.r + color.g + color.b) / 3;

vec4 gradientColor = texture2D(gradient, vec2(gray, offset));

gl_FragColor = mix(color, gradientColor, distortColor.r + distortColor.g);

Help / Using OtterSpine with Otter
« on: March 27, 2014, 02:39:27 PM »
The support for Spine Animations in Otter is now moved to this repository: https://bitbucket.org/kylepulver/otterspine

Keep in mind that in order to use the Otter spine runtime you have to own a legal copy of Spine.  This is why I can't simply include it in Otter.

There's a few steps to getting the runtime working:
  • Download the Otter Spine Runtime from the source repository.
  • Slap it in a directory somewhere you can access from your project.
  • In your solution that contains Otter, and your game project: Add an existing project to the solution.
  • Navigate to OtterSpineRuntime.csproj in the folder you downloaded from the repository.
  • Now select your game project and add a reference to OtterSpineRuntime.
  • Now in OtterSpineRuntime add a reference to Otter
  • Hit build and everything should be happy.  Use the "SpineAnimation" class.
  • If it blows up for some reason, make sure that the build order of the projects in your solution is: Otter, OtterSpineRuntime, YourGameProject

I'm sure there's going to be issues and bugs with this, but for right now this was the best solution I could come up with.  If anyone has any ideas on how to make this easier, then please let me know!

General / Upcoming Angle Changes
« on: March 01, 2014, 03:01:25 PM »
As I've been working on my new game with Otter I realized that a lot of my angle/trigonometry functions have been pretty inconsistent.  In the wild world of video games, positive Y is going down, and not up, so some of my functions compensated for this, and others didn't.

In the next update I'll be pushing a change that changes the Util.Angle function to return degrees by default, and also flip the y.  This means, hopefully, from this point onward the angle 0 will always be RIGHT, and the angle 90 will always be UP, and so on.

I'm not really sure how other engines have handled this, but hopefully this doesn't wreak havoc on anyone's projects.  After the update you should be able to just find all references to the Util functions that have changed and fix them up.

Anyone have any thoughts on this? :O

Pages: [1] 2