Jump to content
  • Advertisement
gdbeegees

Options for low lag/high performance 2D game engine?

Recommended Posts

Hello world! 

I'm new here, and I'm getting into hobbyist game development. Have tons of programming experience from others parts of life. I'm trying to take everyone's advice and not try and build an engine from scratch, but I haven't run into anything that fits my needs.

I am trying to build a very twitchy, fast moving puzzle game. Imagine something like a very, very fast moving game of Tetris, but with some scrolling and other things flying around the screen. The graphics will be very simple and old school, I just want a cacophony of quick moving entities for the user to deal with. 

I want the game to have a very high skill ceiling, and very responsive controls. For this reason, I want it to be very high performance, and high absolutely minimal input lag. I am programming strictly for the P.C - mobile is not a concern here at all. 

Shopping around for available 2D game engines, and I have not found an engine which serves these needs. For instance, I don't think Unity could give me the control I need in order to minimize input lag. I worry about using any kind of interpreted language with the engine for this reason. 

Does anyone have a suggestion for an engine to use for my application? Am I truly better off rolling my own in this case? Can you suggest an open source application that fits these needs? 

Share this post


Link to post
Share on other sites
Advertisement
2 hours ago, gdbeegees said:

 

Shopping around for available 2D game engines, and I have not found an engine which serves these needs. For instance, I don't think Unity could give me the control I need in order to minimize input lag. I worry about using any kind of interpreted language with the engine for this reason. 

Well, I'm not that familiar with Unity in practice (I just have general knowledge of it) or how they deal with input, but can you tell us why you think it wont work?  If you're making a 2D game on PC, I'd imagine that Unity should be adequate to handle any number of objects moving around on the screen with minimal input lag. 

Can you be more specific about what you're talking about?  How many objects?  What code are they all running?  What framerate do you want to achieve?  Have you dont tests with Unity (or other engines) to determine what their limitation are?  

Share this post


Link to post
Share on other sites

I'm fairly new to game development topics, so forgive my ignorance. 

No, I haven't done any engine tests with unity. I was half expecting someone to say that Unity would work just fine. What I know for a fact to be insufficient would be some Javascript powered DOM model, as every engine I've seen like that seems to have several ms of input lag associated with it. 

To elaborate on what I am trying to achieve here, I am trying to put together a very twitchy puzzle game something akin to Tetris. I want to controls to be extremely consistent so that if it ever catches on, it could be played competitively. That is to say, I want to design the game in such a way that no matter what happens there is zero chance of any kind of lag whatsoever. I want it to run at 60fps. 

Of course this depends heavily on how many entities I render on the screen, and I'm willing to tune that, but what I want is to render a great deal of them without sacrificing the consistent frame rate and controls. 

I don't intend to do anything interesting visually at all. We are talking something like hundreds of flying interlocking blocks and that kind of thing. 

Here are my worries with Unity and similar engines:

1) Way too many features much for what I am trying to achieve. 

2) Garbage collected scripting language means I can't control potentially random dips in frame rate. 

3) The input handling might be abstracted behind some huge object oriented library that I have no way to tune. I would rather have extreme consistency with input handling than graphical fidelity. 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
49 minutes ago, gdbeegees said:

No, I haven't done any engine tests with unity. I was half expecting someone to say that Unity would work just fine.

...

Here are my worries with Unity and similar engines:

1) Way too many features much for what I am trying to achieve. 

2) Garbage collected scripting language means I can't control potentially random dips in frame rate. 

3) The input handling might be abstracted behind some huge object oriented library that I have no way to tune. I would rather have extreme consistency with input handling than graphical fidelity. 

 

Then maybe someone who has expertise with Unity can comment on this.  My guess is that Unity should have decent input handling latency, but that's just a guess based on input handling not exactly being a difficult problem for an engine to deal with.  I'd be more concerned if you had hundreds of AI or physics objects all flying around, because those might bring Unity to its knees.  If the objects have fairly simple behavior, then even Unity should do a good job with it.

Share this post


Link to post
Share on other sites

Yeah, I'd love to hear from Unity people on that. For what it's worth, I would love to know if there was a peppier smaller thing more oriented toward 2D games out there. I feel like there isn't much middle space between something like SDL (not really an engine) and something like Unity (too much engine).

What I'd put together myself is something written 99% in native code with a very small scripting DSL tailored to my particular game mechanics. 

I am by no means an expert but I get the notion that Unity is optimized for 3D games where there are usually much deeper hierarchies of elements. 

Share this post


Link to post
Share on other sites

Input in general has some lags from the key stroke up to the program action is a way round through the OS deep dark APIs but as long as you do not have a multiplayer online game, those few ms are a tax you need to pay that wont effect any player so far. You can make yourself a test how many key strokes per second are possible. I think a professional gamer gets up to 35 clicks per second and maybe some more keystrokes (let assume 70) so you have round about one input every 28 ms to 14 ms. Nothing to real worry about.

Unitys own input system defentiely has some input lagging because it is a polling based system and dosent handle very well (for controler input for example). You could use a third party input system from the Asset Store  since found it as our standard input system because it has a more advanced use of the OS APIs and bypasses some bottlenecks the old Unity input system is running into (it for example uses the hardware driver directly via HID handling instead of the OS message pipe)

Share this post


Link to post
Share on other sites
Posted (edited)

Yes Unity uses polling as its primary input request method. It means you explicitely query for input in your update loops like

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Debug.Log(Input.mousePosition);
        }
    }
}

as to what they write in there docs. But as I wrote above with Rewired you get some event based input (you still need to handle when your game loop has priority to run)

Best way would be to try to run your own thing if (and only if) your input latency is higher than between 28 ms and 14 ms. I use a global message queue in my custom engine that has an input latency of an avarage of a few milliseconds where an OS message is processed using HID API and immediatly pushing the result into the writing end of the event queue

Edited by Shaarigan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!