Planet Gamedev

Gamasutra Feature Articles

Starbreeze aims to snap up the Valhalla engine in $8.6M deal

May 28, 2015 06:06 PM

Stockholm-based Starbreeze Studios seeks to acquire the Valhalla game engine in a stock deal valued at roughly 73 million Swedish kroner (~$8.6 million USD). ...

Geeks3D Forums

(WebGL) Star Wars BB8 Droid

May 28, 2015 05:36 PM

Great use of WebGL to show just how the real Star Wars BB8 Droid works

[via]

Quote
BB-8 is an astromech...

Gamasutra Feature Articles

Godus developer 22Cans 'reboots' under new chief Simon Phillips

May 28, 2015 05:32 PM

Peter Molyneux's studio 22Cans is making a show of hiring fresh talent and making some staffing changes to "reboot" the company, chief among them being naming recent hire Simon Phillips the new CEO. ...



Geeks3D Forums

NVIDIA AndroidWorks 1R1

May 28, 2015 05:30 PM

NVIDIA AndroidWorks installs all software tools required to develop for Android and reduces the complex process of configuring an Android development system down to a single click. With a full suite of developer tools, AndroidWorks is a professional gr...

Gamasutra Feature Articles

An approach to balancing game economies using spreadsheets

May 28, 2015 04:59 PM

"At a high level, these are the techniques I use in Excel to accomplish this common task in a way that keeps my economy organized and ensures that it is easy to maintain and update." ...

The importance of form factor in making games

May 28, 2015 04:27 PM

Games have to take into account the devices they're played on, and all of the implications of those devices, and their primary audiences -- case in point, Supercell. ...

An indie game with 60 million players? The story of Transformice

May 28, 2015 03:29 PM

Four years in to creating a game that spiked in popularity beyond its developers wildest dreams: A postmortem of boom times, a changing business model, and a studio's transformation. ...

Might & Magic creator nets $4.5M to launch new mobile venture

May 28, 2015 02:43 PM

Game industry veteran Jon Van Caneghem has managed to raise $4.5 million from investors like Tencent to publicly launch a new L.A.-based mobile game developer/publisher: VC Mobile Entertainment. ...

Postmortem: A story-driven roguelike, Sproggiwood

May 28, 2015 02:27 PM

"Conquering a rival civilization -- and concealing your imperialist intentions in rhetoric -- is a difficult task. Likewise is developing a mechanically novel, thematically rich hybrid game." ...

Getting metroidvania Environmental Station Alpha into the world

May 28, 2015 07:58 AM

Developing a metroidvania over three years: A candid look back at the iterative design process for a 2D indie game. ...

Game Design Deep Dive: Darkest Dungeon's Affliction System

May 28, 2015 07:57 AM

Chris Bourassa & Tyler Sigman of Red Hook Studios: "We wanted to capture the human response to stress. Any person can break under pressure, and people break in different ways." ...

David Perry Blog

Playstation E3 Press Conference

by David Perry at May 28, 2015 05:51 AM

Free Tickets available for US theaters: CLICK HERE


Filed under: PlayStation Events, Sony Computer Entertainment Tagged: E3, Playstation Experience



Gamasutra Feature Articles

Twitch bans streams of 'Adults Only' games

May 28, 2015 12:31 AM

The popular streaming service has banned games rated "Adults Only" by the ESRB -- and equivalent organizations in other countries. ...

Gamasutra Feature Articles

Oculus Rift price teased; new input solution to show at E3 in June

May 27, 2015 10:57 PM

News out of the Code Conference comes via Oculus VR CEO Brendan Iribe, who drops a few more details on what you'll expect to pay and how the tech might evolve. ...

Apple to release full Apple Watch SDK this fall, with beta soon

May 27, 2015 08:59 PM

Apps have yet to wow reviewers and early adopters, but a new and improved SDK for the device will be released as a beta in early June. ...

Get a job: Turbine seeks a Senior Mobile Engineer

May 27, 2015 07:55 PM

The house responsible for that Infinite Crisis MOBA and the venerable Lord of the Rings Online needs an experienced software engineer to work on mobile projects in its Needham, Massachusetts office. ...

Ex-AAA talent aims to shake up mobile with a game-like chat app

May 27, 2015 07:33 PM

A group of developers have left jobs at companies like Remedy and EA to launch Futurefly, a Finnish startup that aims to build mobile apps with built-in gameplay mechanics -- starting with a chat app. ...

Geeks3D Forums

Catzilla 1.4 released

May 27, 2015 07:13 PM

Quote
Catzilla 1.4   

Created on 2015-05-26,

 Application:
  • Correct detection of the latest graphics cards and processors:
- NVIDIA GeForce GTX 870 and ...



Gamasutra Feature Articles

Cosmic Picnic is the next step for these former Battlefield devs

May 27, 2015 07:03 PM

A coterie of Swedish developers have quit their posts at Ghost Games and EA DICE to found Cosmic Picnic, a new indie studio based out of Stockholm. ...

Don't Miss: Games from the trash - A history of the TRS-80

May 27, 2015 06:26 PM

In this 2012 retrospective, Gamasutra pays homage to a system beloved by many but forgotten by everyone else: Radio Shack's first computer, the underpowered friend to many budding game designers. ...

Geeks3D Forums

TechPowerUp GPU-Z v0.8.3

May 27, 2015 06:07 PM

GPU-Z is a lightweight utility designed to provide you with all information about your graphics card and GPU. 

 Version History 0.8.3

  • Added VGA BIOS UEFI suppo...



Gamasutra Feature Articles

Flash deal site sells game for $1 without developer permission

May 27, 2015 06:00 PM

UPDATE A British indie studio and its publisher are involved in a public imbroglio over the studio's game Standpoint, which was put on sale for a minimum price of $1 at a flash deal site without permission. ...

Game From Scratch

RPG Maker and Spriter both massively discounted today on Steam

by Mike@gamefromscratch.com at May 27, 2015 05:27 PM

 

So today I fired up Steam to finally pull the trigger on Pillars of Eternity and what do I see….

 

image

It seems that Degica games, the makers of the popular RPG Maker series of game building tools are having a sale today.  Their flagship product RPG Maker VX Ace ( … quite the name ) is currently on sale for 80% off.

 

On top of RPG Maker Vx Ace, RPG Maker XP and RPG Maker 2003 are all also discounted, 80% and 50% respectively.  What perhaps caught my eye most of all however wasn’t the RPG Maker line of products, but Spriter is also on sale for 75% off.   Spriter was a successfully kickstarted project made by BrashMonkey, I had no idea Degica was now the publisher.

 

About Each Program

 


RPG Maker

 

 

This is a program that has been around for a very long time, first released in 1988.  As the title suggests, it’s a game building tool for making RPG’s, generally of the classic jRPG format.

 

That said, this is a proper game building application, a number of commercially shipped games were created using the various iterations of RPG Maker.  RPG Maker was mentioned as an option in my guide to getting kids started in game development.  Bundled with a ton of premade assets, it is a good way to get your hands wet in game development.  In addition to world, character, dialog, etc… building tools, there is also a programmatic layer using the Ruby programming language. 

 


Spriter

 

Perhaps of most interest to GameFromScratch readers is Spriter.  Spriter is essentially a modular 2D animation system.  You basically cut your sprites up into multiple independent pieces which in turn can be animated.  You can also apply an IK chain ( inverse kinematics… think skeleton ) that controls the animation for you.  You can then export the resulting animation as a sprite sheet, sequence of images or as an animated gif.

 

Most likely though you will want to use the Spriter API, or one of the pre-existing plugins, and use the Spriter animations directly in your game engine, such as Construct, Unity or LibGDX.

 

Truth is, I did a pretty lousy job there describing Spriter, so I will just show their video instead…

 

 

Both are on sale until May the 29th. 

 

Oh, and as I finish typing this up, the Steam page for the sale now appears to be broken…

David Perry Blog

Video Game Industry Jobs

by David Perry at May 27, 2015 05:00 PM

Thanks Naughty Dog, I get asked a lot what it takes to be a video game designer…  It’s now answered in one short video.

They also have a video for Programmers.


Filed under: Game Design, VIDEO GAME INDUSTRY, Video Games Tagged: game designer, jobs, Naughty Dog



Gamasutra Feature Articles

Leading by emotion in game design

May 27, 2015 04:53 PM

What about focusing on the emotions you want the player to feel? This blog post explores the issue, with hints from Jenova Chen (Journey.) ...

David Perry Blog

Addictive Game Design Techniques

by David Perry at May 27, 2015 04:50 PM

The question that every game designer wants answered is: what does is take to make an addicting game?


FOUNDATION

There are just three essential elements that a game needs to begin, which can be found in the question below:

“While playing my game are the gamers having to use skill, risk, and strategy simultaneously during most of the gameplay?”

If the answer is “No” to any of the three, that’s your missing element.

Think about Tetris.  Think about Angry Birds.  Think about Call of Duty.  They are nothing alike, yet they share the same three key elements

So what do they really mean?

SKILL = You clearly get better with practice, meaning you feel and notice your improvement.  In ideal terms, you can see that you make more rapid progress every minute you play.  It’s a way to balance your gameplay so you could plot graphs to demonstrate the skill, learning, and improvement is really there.

RISK = You know you can get an advantage if you take a risk, and there are plenty of opportunities to take risks.  Great games let you get creative with your risk-taking. In every hit game, taking risks is fundamental to the gameplay itself.

STRATEGY = There’s more than one way to get through this, and you need to be able to make decisions and feel ownership when your strategy fails.  Great games have gamers immediately blaming themselves for failure and trying a “New Idea” – a strategy.  (That’s the addictive loop.)

Homework: If you have not played Tetris, Angry Birds or any other top selling games, I’d highly recommend you take the time. Getting a feel for the market and industry is essential, and without it, it’s like being in the movie business and never seeing Titanic or Avatar.  Experiencing (and studying) the best-selling games of all time is required homework for game designers.


SUPPORT

CHALLENGE & PROGRESS = Every moment of gameplay you know where you are in respect to your goal(s).  Some designers solve this with Mini-Maps or progress indicators, some have pointers to goals, some even tell you distance.  Great games let you know in advance what a win is to this challenge.  This matters, as it’s much more difficult to get out of your chair the closer you get to your goal.  If you have a challenge: “Go destroy that building”, and an overall goal of: “Win the battle”, then strategy can evolve from the challenge as maybe that building is useful to your strategy, but “You’ll win the war”.  The key point here is that you then need to know where you are in relation to the building, and where I am in relation to winning the war (every single moment).

BLAME = If you fail or die, you MUST not blame the game, and be clear that it is your fault.  The addictiveness dies immediately when you blame the game: “That guy appeared out of nowhere”, “Their bullets go through walls”, etc.  If the game seemingly cheated (and it might lead to frustration), you don’t care if I can explain why, it must be fixed.  When gamers blame your game, it will bleed the addictiveness right out.

RETRY = If you make it difficult to retry a new idea (meaning to try out a better strategy), like you get put too far back or you force them to watch the same movie clip again, you can massively damage addictiveness.  A truly addictive loop has no pain. Check out Tetris or Angry Birds: when you mess up, you try again immediately.

FEEDBACK = When the gamer does something good, let them know!  There should be audio/visual feedback when they are doing well.  Look at highly addictive games – Bejeweled or Candy Crush – a chain event is special and the game feels more excited when you are completing complex chains. Pinball machines are old now, but frankly, they were experts at feedback, as the game would get more and more excited the better you did, to the extreme with flashing lights, sound, even multiple balls and spinning objects. Think of the game itself as having a heartbeat, and its pulse gets more excited the better you do.  Lots of games have a little completion animation when you complete a level, but to be clear, feedback should be timely, not just at the end of the level.  Really addictive games have a bit of a mystery just how special the feedback can become, meaning the gamer can get a nice surprise when they do something rare as the game knows it!


EXTRAS

REVENGE = Revenge is a powerful emotion and your game can remind players of levels, enemies or even other players they need to concentrate on.   It’s tough to quit when you are alerted that a sworn enemy is approaching.  Many game design books only focus on “play with friends” and of course, I will mention it soon, but remember there are a lot more strangers out there (millions of times), so if I were you, I’d try to make strangers fun in your game.  Revenge is just one small example.

MORAL DECISIONS = Make gamers think about your game even when they are not playing by making them make moral decisions – a fantastic example of this is a game called Papers Please by Lucas Pope. Would you tell a white lie to save your family?   Would you keep a couple apart because of a stupid rule?  Would you let someone die even if it was just a 50% chance they would die?   If you make very important decisions, it’s tough not to want to see what happens next.

SOCIAL = Games can be more addictive if you know that you are incredibly close to either beating a friend or being in a position where they will need your help.   The question to ask yourself is “Can I make my game increase the social value of this gamer?”  Need an example?  Imagine this gamer has “Unobtanium, the most valuable entity in the galaxy” or “a spare pilot’s license” or they know a way through level 3 that can be shared with others: “Here’s the code to that door for the next 5 hours”.  If playing is clearly improving your social status, then you are more likely to fire up this game again.

URGENCY = Sales people know that the “Only available today” kind of marketing can cause impulse sales.  Ask yourself “What’s my impulse gameplay?”  What does the gamer know they should do right now before going to bed because the opportunity won’t be there tomorrow? As an example, if they don’t put out the fire in the burning building, it won’t be there tomorrow.  Really want to go to bed knowing the building you care about is burning down?  It’s just a dramatic example, but you get the idea: what needs dealing with right now?

MULTIPLAYER = I’ve personally seen gamers apologize when they had to stop playing a game because their friends were depending on them.   I’ve seen them type “I’m so sorry I’ve go to sleep, I’ve got a test tomorrow.”  This is a great sign that the presence of other people is making the game more addictive to the group.  So the question to ask yourself is “How am I getting other people to depend on me?”. Also, “How am I gaining an advantage as long as they are playing with me?”  A good example in casinos is the two-seated slot machine, if I win you win, and vice versa.  If you leave, I lose potential free wins!  Another example is when a player makes an important kill or win, the group shares in the spoils. So can you make it valuable to you personally when friends are engaged as well?

TIME ACCELERATORS = Imagine in your mind you can predict it will take an hour to complete your goal. That gives you the excuse to abort and think “I’ll just try again in the future when I get more time”.  So ask yourself, “What do I have in my game to make something that feels constant (meaning time) not be constant?”  A simple example is you are walking around but now you have the ability to drive, that changes everything, suddenly time is uncertain, you just know “This won’t take as long as I thought!”, and that’s when the addictive loop is boosted.  Another good example is experience boosters to get to the next status level: people want them so much they happily pay for them in free-to-play games.  Time is valuable and if you give people a chance to do things more efficiently right now, you have their full attention.  As a side note, if you want gamers to care about getting to the next level, just pre-gift them with something cool that they can’t use until they get there.  “Here are the keys to the tank… You need to be level 15 to drive it, you are currently level 14.5”.  It’s just yet another kind of fuel for the addictive loop.


In order to make a video game addictive, it needs skill, risk, strategy, progress, blame, retry, feedback, revenge, moral decisions, sociality, urgency, multiplayer, and ways for the player to accelerate.

However, if a game developer is to bypass one or more of these attributes, there is a single piece that often saves them.


THE SECRET SAUCE

The secret sauce to video games is humor, yes, even in serious games.  Humor is the most difficult thing to do, so it doesn’t have to be “laugh out loud”, but the gamer should feel amused.  I often ask if Angry Birds would be a hit if it was called “The Catapult Game” (without birds exploding etc.) If you can add any humor to your games, you immediately step away from your competitors, as it’s a lot easier not to try.  Humor entertains males and females, so you can double your audience when you entertain both.  Was Angry Birds or Tetris made for Males or Females?  Aha!.


I hope this helps in the discussion of addictive game development techniques. Using these simple elements can help a game to become the addictive success that it deserves to be.

Thanks Thomas Hughes for updating this post.

This post originated from DP’s Book on Game Design.  Available at Amazon.com


Filed under: DAVID PERRY, DP's Personal Opinion, Game Design, Video Games Tagged: game design, video game design

Geeks3D Forums

MSI Afterburner 4.1.1 Final

May 27, 2015 04:09 PM

Quote
MSI Afterburner 4.1.1 Official Download
- Guru3D and MSI have been working hard on AfterBurner, today we release an updated this revision of Afterburner, this app...



Gamasutra Feature Articles

Come to GDC Europe and learn how Bohemia nabs DayZ cheaters

May 27, 2015 04:02 PM

Make time to attend GDC Europe 2015 this August and learn how Bohemia Interactive fought back against cheaters during development of its hit Early Access title DayZ. ...

Design challenges for virtual reality games

May 27, 2015 03:55 PM

"Over the last weekend I took part in the VR Game Jam... This article is a quick summary of current challenges in VR based on how they manifested during the jam and the presentations leading up to the jam." ...

Design lessons from the trenches

May 27, 2015 02:34 PM

How design decisions really get made at a triple-A studio: "the decision-making process ... can be strongly determined by the internal balance of power of the group of people working on it." ...

Turning feelings into mechanics: The narrative design of Apartment

May 27, 2015 01:53 PM

How the interactive narrative of IGF student showcase nominee a•part•ment: a separated place came to be: From conception through to design and execution -- tales told many ways. ...

Indie studio lessons, from the developers of Hatred

May 27, 2015 01:52 PM

His game may be controversial, but this interview with Destructive Creations CEO Jaroslaw Zielinski offers a perspective on running a start-up PC studio under scrutiny. ...

OpenGL

Khronos Boston Chapter Meetup Realtime Fluid Simulation using OpenGL

May 27, 2015 12:20 PM

Boston Khronos Chapter invites you to a presentation and demonstration of realtime fluid simulation using OpenGL compute shaders. Microsoft will be hosting our second event of the year at One Cambridge Center on Thu Jun 4, 6-9PM. The event will feature an in-depth talk on OpenGL and GLSL in simulation applications and will include a live demo. After the talk, there will be time for demos and networking.



Gamasutra Feature Articles

Smooth moves: Designing VR games that won't make players sick

May 27, 2015 08:03 AM

Gamasutra chats with a few VR game designers to figure out what they've learned about not making people sick, and how other developers can apply those learnings to their own projects. ...

Gamasutra Feature Articles

Bloodstained's female lead, Miriam, reflects the game's audience

May 26, 2015 10:55 PM

"I think having a female hero is more motivating to male gamers, and I think women would like to control a female avatar, too," Koji Igarashi says in a new interview. ...

Oculus acquires Surreal Vision, a startup that brings the real world to VR

May 26, 2015 08:51 PM

Startup brings tech that allows VR to scan and represent the real world -- what it calls "state-of-the-art 3D scene reconstruction algorithms." ...

Game From Scratch

A Closer Look At LibGDX

by Mike@gamefromscratch.com at May 26, 2015 08:17 PM

 

As part of GameFromScratch’s ongoing A Closer look at game engine series, today we are going to be taking a look at LibGDX, a Java based cross platform game engine(sorta).  The “Closer Look” series is intended to be a cross between a tutorial, review and overview of a game engine, aimed at helping those evaluating which game engine is right for them.  We are going to go into a bit less technical detail with LibGDX, as this site already has a massive text based and video based tutorial series covering LibGDX in depth.

 

There is an HD video version of this post available as well, also embedded below.

 

Introduction to LibGDX

 

Let’s start with their own description:

Libgdx is a Java game development framework that provides a unified API that works across all supported platforms.

The framework provides an environment for rapid prototyping and fast iterations. Instead of deploying to Android/iOS/Javascript after each code change, you can run and debug your game on the desktop, natively. Desktop JVM features like code hotswapping reduce your iteration times considerably.

Libgdx tries not be the "end all, be all" solution. It does not force a specific design on you.

You can get a complete feature list here.

 

So basically LibGDX is a cross platform, JVM based 2D/3D game engine(sorta) capable of targeting desktops, iOS, Android and HTML.  It is free and completely open source.  When I say JVM based, LibGDX is written primarily in Java but your own applications code could theoretically be written in any JVM based language, such as Kotlin or Scala.  LibGDX is able to compile to HTML using the GWT compiler, while iOS support is provided using RoboVM.  For the most part, 99% of the time, the platform specific portions are pretty well hidden from you the developer.

 

So why do I keep throwing a (sorta) disclaimer every time I use the word “Game Engine”?  Well that’s technically because LibGDX isn’t a game engine, it’s more of a framework, similar in scope to SFML, MonoGame/XNA or SDL.  It provides the underlying “guts” required to make game a game, things like graphics, audio and input.  It however doesn’t provide a scenegraph, essentially the “heart” of a game.  However it does provide a simple 2D scene graph/ UI / Widget library named Scene2D, which is built over top of LibGDX.  The use of Scene2D is completely optional.

 

Getting Started

 

Getting started with LibGDX is incredibly simple.  If you want to use it as just another library that is of course your option.  If you are for example making a desktop only project, you can download and build LibGDX from it’s Github repository.  If you want to create a cross platform game, or like me, want to avoid Java build systems like the plague there is a handy project creation tool available right here.  Simply download and execute the linked Jar file.  It will automatically download all of the required dependencies, although you will have to have a Java Development Kit and the Android SDK pre-installed.  For more detailed installation instructions watch this.  Assuming you have a properly configured Java dev environment, you should see the following:

image

 

This will automatically generate a project for you.  Clicking Advanced allows you to have LibGDX generate IntelliJ IDEA or Eclipse projects for you.  You can also select which platforms you want to support and which extensions to you want enabled.  Once you click Generate, Maven will automatically create a project for you and download all the dependencies.  If you want the tools such as a font generator, particle tool or sprite packer, be sure to select Tools under extensions.

 

If you are looking for more details on working with your specific IDE, check the tutorials for more details.  There are IntelliJ and Eclipse configuration tutorial available.

 

A Simple Project

 

Let’s take a quick look at the project it generated.

 

The heart of your game is the platform agnostic ApplicationAdapter located in the core project.  ( More on this shortly ).  Here is the code:

package com.gamefromscratch;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class MyGame extends ApplicationAdapter {
   SpriteBatch batch;
   Texture img;
   
   @Override
   public void create () {
      batch = new SpriteBatch();
      img = new Texture("badlogic.jpg");
   }

   @Override
   public void render () {
      Gdx.gl.glClearColor(1, 0, 0, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      batch.begin();
      batch.draw(img, 0, 0);
      batch.end();
   }
}

 

If you’ve previously worked in XNA, the overarching structure should be immediately familiar to you, XNA and LibGDX feel incredibly similar to me, and this is a good thing.

 

The nutshell version of what’s happening here is our game extends the ApplicationAdapter class… we will see why shortly.  In it’s create() method we create a SpriteBatch and a Texture object, the texture “badlogic.jpg” is loaded from the assets folder ( by default in the Android project, unless you didn’t create an Android project, in which case it will be in Core ).  The assets folder is basically the root where all of your game’s non-code content is located.  In render() method we clear the background color, start our sprite batch, draw the texture to it, then finish the batch, which results in it’s contents being drawn to the screen.

 

There are a few things to be immediately aware of.  LibGDX provides a fairly shallow abstraction over top of OpenGL ( or WebGL/OpenGL ES, depending on platform ), which can be access with Gdx.gl. calls.  Most of the GL functions are accessible this way, but in a cross platform friendly manner.  The other thing to be aware of is the coordinate system by default follows the OpenGL convention of having the origin (0,0) be the bottom left corner of the screen.

 

When you run the generated code, you should see:

image

 

That’s about as detailed as I am going to get with the code, if you want more details, simply go through the tutorial series for dozens of them.

 

Now the neat part about this whole process is, using the exact same code you could switch your run target to iOS, Android or HTML and it should just work.  Let’s look at exactly how that works.  If you look at the project, your folders should be structured like so:

image

 

Basically you have a project/module for each targeted platform, then core where the cross platform ( majority ) of your code exists.  Let’s take a quick look at the desktop project for a look at exactly how this works. Expanded, the desktop project should look something like this.

image

 

It’s the DesktopLauncher class that is of the most interest.  For desktop projects, this is your application entry point.  Let’s take a quick look inside:

package com.gamefromscratch.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.gamefromscratch.MyGame;

public class DesktopLauncher {
   public static void main (String[] arg) {
      LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
      new LwjglApplication(new MyGame(), config);
   }
}

 

This is where you would put the platform specific code related to desktop platforms.  You can see the traditional program main() is here, inside of which we create a simple configuration object and pass it to our LwjglApplication.  LWJGL stands for Light Weight Java Game Library, and it’s the OpenGL layer that LibGDX desktop implementation is based on.  There is a similar entry point created for the Android application, the iOS application and the HTML5 application.  Each and every one creates a new instance of your game class and passes in the platform specific configurations.  Ideally, this is the extent of your platform specific code, but quite often you have to implement some details on a platform by platform basis.

 

If you look at the various config objects being created, you will notice each is full of properties that are specific to that particular platform, like so:

image

 

Splitting your project up into this format makes platform independence mostly an after thought for most developers.

 

I wont be going into depth of the functionality that LibGDX provides, it’s covered in detail elsewhere.  That said, if functionality is required by a game, but isn’t game specific, chances are its in LibGDX.  This includes graphics, audio, input, motion, asset management and much more.

 

LibGDX Tools

 

Not being strictly a game engine, the tooling support in LibGDX is minimal, but there are some tools included, many of which are command-line based.  There is no world editor, animation tools, etc…  The tools are bundled in the project if you included the Tools extension.  The tools include:

image

 

Most of the tools are Java callable and can be invoked from the command line/terminal.  This means integrating them into your build process is trivial.  The primary tools above are for font and sprite sheet creation.  Only hiero and particleeditor are GUI based:

 

Hiero is a tool for creating bitmap fonts from system/ttf fonts:

image

 

The Particle Editor is a GUI tool for creating particle systems:

image

 

Another critical tool, not included by default, is the fbx-conv project, which is used for importing 3D assets into LibGDX.

 

Built on LibGDX

 

Although not directly part of LibGDX, there are some tools build over top of LibGDX and provide some of the functionality typically ascribed to a full game engine.  They include:

 

Overlap2D  A 2D level and UI editor for LibGDX games built over LibGDX

 

GDX-Proto A 3D game engine built over LibGDX

 

BDX Another 3D engine built over LibGDX, this one built over top of Blender as the world editor.

 

Spine A commercial 2D IK animation tool built using LibGDX by the author of Scene2D.

 

 

Documentation and Tutorials

 

Of course, there is the GameFromScratch.com tutorial series, which I happen to think are pretty good, but I’m biased.  On top of that, there is the Wiki, which is pretty comprehensive.  There is also a generated from code complete reference guide, that while a little shallow in spots, is generally quite useful.

 

There are a couple recently published LibGDX books available as well, one which I somewhat recently reviewed.  I am not sure the other books are really needed between the Wiki and tutorials available on this site.  If you want however, there are some beginner oriented books available as well.

 

For support, there is a quite active forum available.  Well worded questions are generally answered quite quickly.  Stackoverflow also sees a fair number of LibGDX questions.  All told, it’s got a very large community, making community based support pretty solid.

 

Conclusion

 

Personally I am a big fan of LibGDX, even though I am not the biggest Java cheerleader you will find.  If you are looking to create complex 3D games, or want extensive editor support, LibGDX is probably not the engine for you.  If you want a code focused, open source, free, accessible cross platform game engine capable of doing 2D or 3D, you really should check out LibGDX.

 

 

The Video

 

Gamasutra Feature Articles

Get a job: Be an Art Director for Gearbox Software

May 26, 2015 08:10 PM

The studio that brought the world Borderlands and Aliens: Colonial Marines is looking for an art director to work on an "exciting unannounced project" at its Plano, Texas offices. ...

Video: Making games you play for years - A Clash of Clans postmortem

May 26, 2015 07:57 PM

Speaking at GDC 2015, Clash of Clans developer Jonas Collaros took a shot at deconstructing the hit game's development history and asking: what lessons can developers learn from Supercell's Clash? ...

Capcom doubles down on HD remakes to escape its revenue slump

May 26, 2015 07:37 PM

Capcom is focusing on HD remakes after managing to raise its profits during the 2015 fiscal year despite a steep drop in revenue -- thanks to cost-cutting efforts like focusing on digital over retail. ...

Don't Miss: The Pac-Man Dossier

May 26, 2015 06:58 PM

What design and AI lessons can we learn from Namco's seminal Pac-Man? From history through behavior, Gamasutra presents a comprehensive guide to the classic game in this 2009 feature. ...

Nintendo of America promotes its indie devs with a Humble Bundle

May 26, 2015 06:36 PM

The folks behind Humble Bundle have partnered with Nintendo to sell a pack of 3DS and Wii U games from indie teams like Choice Provisions and Drinkbox Studios at pay-what-you-like prices. ...

Geeks3D Forums

(Android) Game Performance: Geometry Instancing

May 26, 2015 06:00 PM

Game Performance: Geometry Instancing

...Rendering a lot of meshes is desired to create a beautiful scene like a forest, a cheering crowd or an army, b...

Bringing DirectX 11 features to mobile in Unity 5.1

May 26, 2015 05:57 PM

One of the new features in Unity 5.1 is a new unified OpenGL rendering backend.
...Until now, we had a separate renderer for OpenGL ES 2.0, one for OpenGL ES 3.0 (that shared a goo...

Gamasutra Feature Articles

Blog: Why don't developers buy and sell intellectual property, much like other assets?

May 26, 2015 05:27 PM

"It makes sense to have multiple IPs all generating revenue. So why are we stuck in the consensus that only publishers are allowed to be in the business of buying and selling IP? Especially when anyone can." ...



Game From Scratch

Welcome to the updated GameFromScratch.com

by Mike@gamefromscratch.com at May 26, 2015 04:03 PM

 

I will admit, the end results look a heck of a lot like the starting point, but behind the scenes it was pretty much a complete rewrite of all the underlying CSS and a good chunk of HTML changes.  Sorry for the delay in new tutorials, but the end is finally here.  I ended up keeping a very similar over all layout and colour scheme to the original site.  I had a darker theme temporarily, but it was harder to read and caused me to receive a fair number of less than happy emails… ;)

 

 

So what’s new here?

 

The most immediately obvious is the old interface has been stripped away.  Outdated menus to obsolete tutorials no longer clutter the site.  Behind the scenes, the HTML is optimized and the page should load better.  The biggest changes are highlighted below.

 

Responsive and Mobile Friendly site

 

This was the number one reason behind the rewrite.  Basically Google tied their search rankings to the mobile friendliness of a site.  I could (and did) turn on the mobile theme for the site as a temporary workaround, but having separate styles for different browsers was ugly.  The new site now scales better across a broad range of devices, from high resolution monitors to small mobile screens.

 

Here for example is the site running on my HTC One mobile phone.

GFS

 

The layout is such that an iPad in portrait mode will get the mobile site, while turning to landscape will get you the full UI.  Use the icon in the top right corner to bring down the site menu.

 

New Getting Started Page

 

A lot of people arrive here with no prior experience.  I have set up a new landing page to get them started with a series of simple questions.  I will be expanding upon and improving this area over time.

 

New Game Engines section

 

Over time I did “Closer Look at” guides for a number of game engines.  I have gathered them together into a single resource, and intend to start adding more guides for more popular engines very soon.  Thing of this as an ideal resource for getting started choosing between different game engines.

 

New Tutorials Page

 

This area is still very much a WIP.  Basically I have done a number of tutorials for a number of different  gamedev topic.  This page is going to bring them all together on one spot.  Once again, very much a work in progress.

 

image

 

Video Section

 

I’ve been producing more and more video tutorials, hosted on YouTube and linked from individual blog posts.  The video gallery is an attempt to bring all of these videos together in a single location.  Still very much a work in progress too.

image

 

Miscellaneous Small Changes

 

There were tons of small incremental changes… site actually has icons now, links to Digg removed, tags improved, font and colour changes, etc.  Most importantly though, Google is now happy and hopefully so are you all.

 

Hopefully you find the new site to be an over all more pleasant experience.  Some things are still in a WIP stage, but good enough IMHO that I can focus again on creating content while I slowly fix the rough edges.  There are bound to be a few bugs, so if you catch one, let me know.  Also, if you absolutely hate a change I’ve made, please also let me know!

Gamasutra Feature Articles

Learning lessons from Goat Simulator's performance in the press

May 26, 2015 03:21 PM

An in-depth analysis: "With Goat Simulator having recently announced its zombie DLC, this is a great opportunity to look at how the game has done in terms of media presence." ...

Blog: Core players and energy mechanics - they don't mix

May 26, 2015 01:08 PM

"Our ambition was (and is) to make THE shooter on mobile. And we went after free-to-play. And we botched it. We botched the energy mechanic... by using it at all." ...

OpenGL

ogldev: ‘SSAO With Depth Reconstruction’ tutorial published

May 26, 2015 12:15 PM

The 46th installment in a series of tutorials dedicated to promoting modern OpenGL development, with a focus on version 3.x and beyond. This tutorial is based on the previous one and adds depth reconstruction to the SSAO algorithm.

Gamasutra Feature Articles

Can you analyze your smartphone game's potential success, up-front?

May 26, 2015 11:32 AM

A quick method to estimate how much potential for success your game has: By crawling the data, and analyzing the success of similar competitors. ...

cbloom rants

05-25-15 - The Anti-Patent Patent Pool

by cbloom (noreply@blogger.com) at May 26, 2015 10:19 AM

The idea of the Anti-Patent Patent Pool is to destroy the system using the system.

The Anti-Patent Patent Pool is an independent patent licensing organization. (Hence APPP)

One option would be to just allow anyone to use those patents free of charge.

A more aggressive option would be a viral licensing model. (like the GPL, which has completely failed, so hey, maybe not). The idea of the viral licensing model is like this :

Anyone who owns no patents may use any patent in the APPP for free (if you currently own patents, you may donate them to the APPP).

If you wish to own patents, then you must pay a fee to license from the APPP. That fee is used to fund the APPP's activities, the most expensive being legal defense of its own patents, and legal attacks on other patents that it deems to be illegal or too broad.

(* = we'd have to be aggressive about going after companies that make a subsidiary to use APPP patents while still owning patents in the parent corporation)

The tipping point for the APPP would be to get a few patents that are important enough that major players need to either join the APPP (donate all their patents) or pay a large license.

The APPP provides a way for people who want their work to be free to ensure that it is free. In the current system this is hard to do without owning a patent, and owning a patent and enforcing it is hard to do without money.

The APPP pro-actively watches all patent submissions and objects to ones that cover prior art, are obvious and trivial, or excessively broad. It greatly reduces the issuance of junk patents, and fights ones that are mistakenly issued. (the APPP maintains a public list of patents that it believes to be junk, which it will help you fight if you choose to use the covered algorithms). (Obviously some of these activities have to be phased in over time as the APPP gets more money).

The APPP provides a way for small companies and individuals that cannot afford the lawyers to defend their work to be protected. When some evil behemoth tries to stop you from using algorithms that you believe you have a legal right to, rather than fight it yourself, you simply donate your work to the APPP and they fight for you.

Anyone who simply wants to ensure that they can use their own inventions could use the APPP.

Once the APPP has enough money, we would employ a staff of patent writers. They would take idea donations from the groundswell of developers, open-source coders, hobbyists. Describe your idea, the patent writer would make it all formal and go through the whole process. This would let us tap into where the ideas are really happening, all the millions of coders that don't have the time or money to pursue getting patents on their own.

In the current system, if you just want to keep your idea free, you have to constantly keep an eye on all patent submissions to make sure noone is slipping in and patenting it. It's ridiculous. Really the only safe thing to do is to go ahead and patent it yourself and then donate it to the APPP. (the problem is if you let them get the patent, even if it's bogus it may be expensive to fight, and what's worse is it creates a situation where your idea has a nasty asterisk on it - oh, there's this patent that covers this idea, but we believe that patent to be invalid so we claim this idea is still public domain. That's a nasty situation that will scare off lots of users.)

Some previous posts :

cbloom rants 02-10-09 - How to fight patents
cbloom rants 12-07-10 - Patents
cbloom rants 04-27-11 - Things we need
cbloom rants 05-19-11 - Nathan Myhrvold


Some notes :

1. I am not interested in debating whether patents are good or not. I am interested in providing a mechanism for those of us who hate patents to pursue our software and algorithm development in a reasonable way.

2. If you are thinking about the patent or not argument, I encourage you to think not of some ideal theoretical argument, but rather the realities of the situation. I see this on both sides of the fence; those who are pro-patent because it "protects inventors" but choose to ignore the reality of the ridiculous patent system, and those on the anti-patent side who believe patents are evil and they won't touch them, even though that may be the best way to keep free ideas free.

3. I believe part of the problem with the anti-patent movement is that we are all too fixated on details of our idealism. Everybody has slightly different ideas of how it should be, so the movement fractures and can't agree on a unified thrust. We need to compromise. We need to coordinate. We need to just settle on something that is a reasonable solution; perhaps not the ideal that you would want, but some change is better than no change. (of course the other part of the problem is we are mostly selfish and lazy)

4. Basically I think that something like the "defensive patent license" is a good idea as a way to make sure your own inventions stay free. It's the safest way (as opposed to not patenting), and in the long run it's the least work and maintenance. Instead of constantly fighting and keeping aware of attempts to patent your idea, you just patent it yourself, do the work up front and then know it's safe long term. But it doesn't go far enough. Once you have that patent you can use it as a wedge to open up more ideas that should be free. That patent is leverage, against all the other evil. That's where the APPP comes in. Just making your one idea free is not enough, because on the other side there is massive machinery that's constantly trying to patent every trivial idea they can think of.

5. What we need is for the APPP to get enough money so that it can be stuffing a deluge of trivial patents down the patent office's throat, to head off all the crap coming from "Intellectual Ventures" and its many brothers. We need to be getting at least as many patents as them and making them all free under the APPP.


Some links :

en.swpat.org - The Software Patents Wiki
Patent Absurdity � How software patents broke the system
Home defensivepatentlicense
FOSS Patents U.S. patent reform movement lacks strategic leadership, fails to leverage the Internet
PUBPAT Home



Gamasutra Feature Articles

Spotlight on Inti Creates, the studio behind Mighty No. 9 and Bloodstained

May 26, 2015 08:02 AM

Inti Creates spent the 2000s making Mega Man games, but has been reborn as its own publisher and developer for high-profile Kickstarter titles. Gamasutra talks to CEO Takuya Aizu. ...

cbloom rants

05-21-15 - Software Patents are Fucking Awesome

by cbloom (noreply@blogger.com) at May 26, 2015 08:27 AM

Awesome. Spotted on encode.ru. It was inevitable I suppose :

"System and method for compressing data using asymmetric numeral systems with probability distributions"

By these tards :

Storleap

Someone in the UK go over and punch them in the balls.

For those not aware of the background, ANS is probably the biggest invention in data compression in the last 20 years. Its inventor (Jarek Duda) has explicitly tried to publish it openly and make it patent-free, because he's awesome.

In the next 10 years I'm sure we will get patents for "using ANS with string-matching data compression", "using ANS with block mocomp data compression", "using ANS as a replacement for Huffman coding", "deferred summation with ANS", etc. etc. Lots of brilliant inventions like that. Really stimulating for innovation.

(as has happened over and over in data compression, and software in general in the past; hey let's take two obvious previously existing things; LZ string matching + Huffman = patent. LZ + hash table = patent. JPEG + arithmetic = patent. Mocomp + Huffman = patent. etc. etc.)

(often glossed over in the famous Stac-Microsoft suit story is the question of WHAT THE FUCK the LZS patent was supposed to be for? What was the invention there exactly? Doing LZ with a certain fixed bit encoding? Umm, yeah, like everyone does?)

Our patent system is working great. It obviously protects and motivates the real inventors, and doesn't just act as a way for the richest companies to lock in semi-monopolies of technologies they didn't even invent. Nope.

Recently at RAD we've made a few innovations related to ANS that are mostly in the vein of small improvements or clever usages, things that I wouldn't even imagine to patent, but of course that's wrong.

I've also noticed in general a lot of these vaporware companies in the UK. We saw one at RAD a few years ago that claimed to use "multi-dimensional curve interpolation for data compression" or some crackpot nonsense. There was another one that used alternate numeral systems (not ANS, but p-adic or some such) for god knows what. A few years ago there were lots of fractal-image-compression and other fractal-nonsense startups that did ... nothing. (this was before the VC "pivot" ; hey we have a bunch of fractal image patents, let's make a text messaging app)

They generally get some PhD's from Cambridge or whatever to be founders. They bring a bunch of "industry luminaries" on the board. They patent a bunch of nonsense. And then ...

... profit? There's a step missing where they actually ever make anything that works. But I guess sometimes they get bought for their vapor, or they manage to get a bullshit patent that's overly-general on something they didn't actually invent, and then they're golden.

I wonder if these places are getting college-backed "incubation" incentives? Pretty fucking gross up and down and all around. Everyone involved is scum.

(In general, universities getting patents and incubating startups is fucking disgusting. You take public funding and student's tuition, and you use that to lock up ideas for private profit. Fucking rotten, you scum.)


On a more practical note, if anyone knows the process for objecting to a patent in the UK, chime in.

Also, shame on us all for not doing more to fight the system. All our work should be going in the Anti-Patent Patent Pool.


Under the current first-to-file systems, apparently we are supposed to sit around all day reading every patent that's been filed to see if it covers something that we have already invented or is "well known" / public domain / prior art.

It's really a system that's designed around patents. It assumes that all inventions are patented. It doesn't really work well with a prior invention that's just not patented.

Which makes something like the APPP even more important. We need a way to patent all the free ideas just as a way to keep them legally free and not have to worry about all the fuckers who will rush in and try to patent our inventions as soon as we stop looking.

05-21-15 - LZ-Sub

by cbloom (noreply@blogger.com) at May 26, 2015 08:27 AM

LZ-Sub decoder :


delta_literal = get_sub_literal();

if ( delta_literal != 0 )
{
    *ptr++ = delta_literal + ptr[-lastOffset];
}
else // delta_literal == 0
{
    if ( ! get_offset_flag() )
    {
        *ptr++ = ptr[-lastOffset];
    }
    else if ( get_lastoffset_flag() )
    {
        int lo_index = get_lo_index();
        lastOffset = last_offsets[lo_index];
        // do MTF or whatever using lo_index
        
        *ptr++ = ptr[-lastOffset];
        // extra 0 delta literal implied :
        *ptr++ = ptr[-lastOffset];
    }
    else
    {
        lastOffset = get_offset();
        // put offset in last_offsets set
        
        *ptr++ = ptr[-lastOffset];
        *ptr++ = ptr[-lastOffset];
        // some automatic zero deltas follow for larger offsets
        if ( lastOffset > 128 )
        {
            *ptr++ = ptr[-lastOffset];
            if ( lastOffset > 16384 )
            {
                *ptr++ = ptr[-lastOffset];
            }
        }   
    }

    // each single zero is followed by a zero runlen
    //  (this is just a speed optimization)
    int zrl = get_zero_runlen();
    while(zrl--)
        *ptr++ = ptr[-lastOffset];
}

This is basically LZMA. (sub literals instead of bitwise-LAM, but structurally the same) (also I've reversed the implied structure here; zero delta -> offset flag here, whereas in normal LZ you do offset flag -> zero delta)

This is what a modern LZ is. You're sending deltas from the prediction. The prediction is the source of the match. In the "match" range, the delta is zero.

The thing about modern LZ's (LZMA, etc.) is that the literals-after-match (LAMs) are very important too. These are the deltas after the zero run range. You can't really think of the match as just applying to the zero-run range. It applies until you send the next offset.

You can also of course do a simpler & more general variant :

Generalized-LZ-Sub decoder :


if ( get_offset_flag() )
{
    // also lastoffset LRU and so on not shown here
    lastOffset = get_offset();
}

delta_literal = get_sub_literal();

*ptr++ = delta_literal + ptr[-lastOffset];

Generalized-LZ-Sub just sends deltas from prediction. Matches are a bunch of zeros. I've removed the acceleration of sending zero's as a runlen for simplicity, but you could still do that.

The main difference is that you can send offsets anywhere, not just at certain spots where there are a bunch of zero deltas generated (aka "min match lengths").

This could be useful. For example when coding images/video/sound , there is often not an exact match that gives you a bunch of exact zero deltas, but there might be a very good match that gives you a bunch of small deltas. It would be worth sending that offset to get the small deltas, but normal LZ can't do it.

Generalized-LZ-Sub could also give you literal-before-match. That is, instead of sending the offset at the run of zero deltas, you could send it slightly *before* that, where the deltas are not zero but are small.

(when compressing text, "sub" should be replaced with some kind of smart lexicographical distance; for each character precompute a list of its most likely substitution character in order of probability.)

LZ is a bit like a BWT, but instead of the contexts being inferred by the prefix sort, you transmit them explicitly by sending offsets to prior strings. Weird.

05-16-15 - Threading Primitive - monitored semaphore

by cbloom (noreply@blogger.com) at May 26, 2015 08:27 AM

A monitored semaphore allows two-sided waiting :

The consumer side decs the semaphore, and waits on the count being positive.

The producer side incs the semaphore, and can wait on the count being a certain negative value (some number of waiting consumers).

Monitored semaphore solves a specific common problem :

In a worker thread system, you may need to wait on all work being done. This is hard to do in a race-free way using normal primitives. Typical ad-hoc solutions may miss work that is pushed during the wait-for-all-done phase. This is hard to enforce, ugly, and makes bugs. (it's particularly bad when work items may spawn new work items).

I've heard of many ad-hoc hacky ways of dealing with this. There's no need to muck around with that, because there's a simple and efficient way to just get it right.

The monitored semaphore also provides a race-free way to snapshot the state of the work system - how many work items are available, how many workers are sleeping. This allows you to wait on the joint condition - all workers are sleeping AND there is no work available. Any check of those two using separate primitives is likely a race.

The implementation is similar to the fastsemaphore I posted before.

"fastsemaphore" wraps some kind of underlying semaphore which actually provides the OS waits. The underlying semaphore is only used when the count goes negative. When count is positive, pops are done with simple atomic ops to avoid OS calls. eg. we only do an OS call when there's a possibility it will put our thread to sleep or wake a thread.

"fastsemaphore_monitored" uses the same kind atomic variable wrapping an underlying semaphore, but adds an eventcount for the waiter side to be triggered when enough workers are waiting. (see who ordered event count? )

Usage is like this :


To push a work item :

push item on your queue (MPMC FIFO or whatever)
fastsemaphore_monitored.post();

To pop a work item :

fastsemaphore_monitored.wait();
pop item from queue

To flush all work :

fastsemaphore_monitored.wait_for_waiters(num_worker_threads);

NOTE : in my implementation, post & wait can be called from any thread, but wait_for_waiters must be called from only one thread. This assumes you either have a "main thread" that does that wait, or that you wrap that call with a mutex.

template typename t_base_sem>
class fastsemaphore_monitored
{
    atomicS32> m_state;
    eventcount m_waiters_ec;
    t_base_sem m_sem;

    enum { FSM_COUNT_SHIFT = 8 };
    enum { FSM_COUNT_MASK = 0xFFFFFF00UL };
    enum { FSM_COUNT_MAX = ((U32)FSM_COUNT_MASK>>FSM_COUNT_SHIFT) };
    enum { FSM_WAIT_FOR_SHIFT = 0 };
    enum { FSM_WAIT_FOR_MASK = 0xFF };
    enum { FSM_WAIT_FOR_MAX = (FSM_WAIT_FOR_MASK>>FSM_WAIT_FOR_SHIFT) };

public:
    fastsemaphore_monitored(S32 count = 0)
    :   m_state(countFSM_COUNT_SHIFT)
    {
        RL_ASSERT(count >= 0);
    }

    ~fastsemaphore_monitored()
    {
    }

public:

    inline S32 state_fetch_add_count(S32 inc)
    {
        S32 prev = m_state($).fetch_add(incFSM_COUNT_SHIFT,mo_acq_rel);
        S32 count = ( prev >> FSM_COUNT_SHIFT );
        RR_ASSERT( count  0 || ( (U32)count  (FSM_COUNT_MAX-2) ) );
        return count;
    }

    // warning : wait_for_waiters can only be called from one thread!
    void wait_for_waiters(S32 wait_for_count)
    {
        RL_ASSERT( wait_for_count > 0 && wait_for_count  FSM_WAIT_FOR_MAX );
        
        S32 state = m_state($).load(mo_acquire);
        
        for(;;)
        {
            S32 cur_count = state >> FSM_COUNT_SHIFT;

            if ( (-cur_count) == wait_for_count )
                break; // got it
        
            S32 new_state = (cur_countFSM_COUNT_SHIFT) | (wait_for_count  FSM_WAIT_FOR_SHIFT);
            
            S32 ec = m_waiters_ec.prepare_wait();
            
            // double check and signal what we're waiting for :
            if ( ! m_state.compare_exchange_strong(state,new_state,mo_acq_rel) )
                continue; // retry ; state was reloaded
            
            m_waiters_ec.wait(ec);
            
            state = m_state($).load(mo_acquire);
        }
        
        // now turn off the mask :
        
        for(;;)
        {
            S32 new_state = state & FSM_COUNT_MASK;
            if ( state == new_state ) return;
        
            if ( m_state.compare_exchange_strong(state,new_state,mo_acq_rel) )
                return; 
                
            // retry ; state was reloaded
        }
    }

    void post()
    {
        if ( state_fetch_add_count(1)  0 )
        {
            m_sem.post();
        }
    }

    void wait_no_spin()
    {
        S32 prev_state = m_state($).fetch_add((-1)FSM_COUNT_SHIFT,mo_acq_rel);
        S32 prev_count = prev_state>>FSM_COUNT_SHIFT;
        if ( prev_count = 0 )
        {
            S32 waiters = (-prev_count) + 1;
            RR_ASSERT( waiters >= 1 );
            S32 wait_for = prev_state & FSM_WAIT_FOR_MASK;
            if ( waiters == wait_for )
            {
                RR_ASSERT( wait_for >= 1 );
                m_waiters_ec.notify_all();
            }
            
            m_sem.wait();
        }
    }
    
    void post(S32 n)
    {
        RR_ASSERT( n > 0 );
        for(S32 i=0;in;i++)
            post();
    }
       
    bool try_wait()
    {
        // see if we can dec count before preparing the wait
        S32 state = m_state($).load(mo_acquire);
        for(;;)
        {
            if ( state  (1FSM_COUNT_SHIFT) ) return false;
            // dec count and leave the rest the same :
            //S32 new_state = ((c-1)FSM_COUNT_SHIFT) | (state & FSM_WAIT_FOR_MASK);
            S32 new_state = state - (1FSM_COUNT_SHIFT);
            RR_ASSERT( (new_state>>FSM_COUNT_SHIFT) >= 0 );
            if ( m_state($).compare_exchange_strong(state,new_state,mo_acq_rel) )
                return true;
            // state was reloaded
            // loop
            // backoff here optional
        }
    }
     
       
    S32 try_wait_all()
    {
        // see if we can dec count before preparing the wait
        S32 state = m_state($).load(mo_acquire);
        for(;;)
        {
            S32 count = state >> FSM_COUNT_SHIFT;
            if ( count = 0 ) return 0;
            // swap count to zero and leave the rest the same :
            S32 new_state = state & FSM_WAIT_FOR_MASK;
            if ( m_state($).compare_exchange_strong(state,new_state,mo_acq_rel) )
                return count;
            // state was reloaded
            // loop
            // backoff here optional
        }
    }
           
    void wait()
    {
        int spin_count = rrGetSpinCount();
        while(spin_count--)
        {
            if ( try_wait() ) 
                return;
        }
        
        wait_no_spin();
    }

};

Gamasutra Feature Articles

Making the whimsical Monster Mingle: 2D art process and more

May 25, 2015 09:03 PM

Mingling monster parts and exploring a "world full of surprises" -- the art process for creating good-looking, kid-friendly characters and populating a world full of them. ...

This Week in Video Game Criticism: From Polybius to pixel art

May 25, 2015 06:44 PM

This week, our partnership with game criticism site Critical Distance brings us picks from Eric Swain on topics ranging from the legend of Polybius to a response to Blake Reynolds on the contemporary reception of pixel art. ...

Video: Using a real-time feedback system to make better games

May 25, 2015 06:02 PM

Unknown Worlds' Hugh Jeremy explains how and why building a real-time sentiment feedback system into its open-world undersea exploration game Subnautica helped the studio make a better game. ...

Our strange journey: Industry vets go from premium mobile to Steam hopeful

May 25, 2015 05:27 PM

"So what did we learn together here? Don't be afraid to ask for what you want, as long as you're being honest and aren't being greedy. Sometimes even if you don't think it can happen, life can surprise you." ...

Geeks3D Forums

Blender 2.75 Test 1 with OpenCL kernel split for AMD GCN

May 25, 2015 02:13 PM

Blender 2.75 Testbuild Now Available

The Blender Foundation has released the first testbuild of Blender 2.75 and is asking everyone to help test it.

We are finis...