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
1
Help / Otter Slack Team
« on: April 27, 2017, 05:26:22 PM »
The Otter community is much more active on Slack!

Join up here: http://otter2d.com/slack.php

2
General / Otter Slack Team
« on: July 14, 2015, 03:44:21 AM »
For real time talk about Otter, join the Otter Slack team!

http://otter2d.com/slack.php

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

Thanks!

(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() {
            base.Update();

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

    }

    class TestEntity : Entity {

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

        public TestEntity() : base() {
            AddGraphic(surface);
            surface.CenterOrigin();
            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));
        }
    }
}

4
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

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

6
General / Surface Example
« on: April 29, 2015, 04:40:34 PM »
http://pastie.org/10121082

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() {
            base.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));
            Graphic.CenterOrigin();

            // 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() {
            base.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() {
            base.Render();

            // Render the surfaces.
            Draw.Graphic(Global.SurfaceGameplay);
            Draw.Graphic(Global.SurfaceHud);
        }
    }

    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);
    }
}

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

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

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

Screenshots







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

http://kpulv.com/309/Dev_Log__Shader_Follow_Up/




10
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();

            game.Start();
        }
    }

    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() {
            AddGraphic(image);
            distortion = new Surface(image.Width, image.Height);
            circle.CenterOrigin();
            circle.Blend = BlendMode.Add;
            AddGraphic(distortion);
            circle.Alpha = 0.1f;
            distortion.Visible = false;
            distortion.AutoClear = false;
        }

        public override void Update() {
            base.Update();
            axis.UpdateFirst();
            //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:");
                    Console.WriteLine(e.Message);
                }
                image.Shader.SetParameter("gradient", new Texture("gradient.png"));
            }
            if (Input.MouseButtonPressed(MouseButton.Right)) {
                distortion.Clear();
            }
            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.SetTarget(distortion);
                Draw.Graphic(circle, MouseX, image.Height - MouseY);
                Draw.ResetTarget();
            }
        }

        public override void Render() {
            base.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);
}

11
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!

12
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

13
Help / Compiling on 32 bit machines
« on: February 26, 2014, 09:59:18 AM »
If you're trying to compile Otter on 32 bit machine, you'll need the 32 bit SFML dll files from the SFML website.  Otter by default comes with the 64 bit ones.

Download the dll files here: http://www.sfml-dev.org/download/sfml.net/  Replace the dll files in Otter with the ones you download and you should be all set.

14
Projects / Flippy Flop
« on: February 09, 2014, 09:59:08 PM »
A new Otter game doodle! http://kpulv.com/254/Flippy_Flop/ ;D



The full source of the game is now in the Examples folder.

15
General / Otter Updates
« on: December 03, 2013, 04:31:20 PM »
Going to start posting update logs on the forum, yahoo~

* Added usable version of RichText
* Added PixelCollider which can collide with BoxCollider, GridCollider, and PixelCollider currently.
* Updated some rendering stuff for Text
* Added "LoadGrid()" for Tilemap
* Added "ColorString" for Color
* More documentation
* Added "AddPosition()" for Entity
* Minor fixes and tweaks

<3

Pages: [1] 2