SFML 2.5.0 Update (Or how I learned to hate RenderTextures)

 

 

On May 6th, the C++ Simple and Fast Media Library (or SFML for short) was updated to stable version 2.5.0, adding various updates including more optimial iOS support, bug fixes, added functionality for Text and Audio and various optimizations. For such a big release, it made sense to upgrade and get my Vigilante Game Framework updated, and why not update Gemstone Keeper while I’m at it?

Well it took nearly a month, but I did manage it in the end. Gemstone Keeper 1.0.5 has been uploaded to Steam, both for Windows and Linux!

As the title suggest, a lot of the work had to do with the updates to the sf::RenderTexture object. However, I don’t absolutely hate them, they are extremely useful for rendering a scene to an area of the screen, or to apply post-processing effects to. However the problem lied in how I was using them, and how the fixes done in the latest update effectively broke my engine’s rendering system.

The initial update showed promise, as my most recent game worked fine, but moving onto the framework’s examples and Gemstone Keeper showed that a lot of things weren’t rendering at all.

Vigilante Framework currently renders 3D models using Modern OpenGL, and while it was working fine with SFML 2.4.2, it rendered nothing with SFML 2.5.0. The solution was embarrassingly simple despite the amount of effort put into fixing it, including implementing my own version of SFML’s glCheck function and re-writing SFML’s own OpenGL example to run with modern OpenGL. When rendering the 3D scene, I modified some of the OpenGL states, which wouldn’t be an issue before but now those OpenGL states carry over into other contexts. The solution was to simply make sure that the GL states were reset BEFORE rendering the scene using a sprite object.

 ///Render 3D scene and apply to a sprite.
 RenderTarget.resetGLStates(); //Reset the GL states to the default for SFML
 Sprite->Draw(RenderTarget); //Render the sprite.

Gemstone Keeper however uses legacy OpenGL, and while I could have updated the VFrame source code but that could take more time to fix. Regardless, I was able to get it working by rearranging other objects that define sf::RenderTexture, including the bloom post processing effect and the help popup terminal.

Gemstone Keeper’s other graphics were another story. The approached I had been using up to this point was to render text objects onto a single rendertexture, and then store the generated texture to be used as a sprite, particle or tilemap. While this was okay for the time, but it is rather inefficient and bad for graphical memory.

I wanted to do a single-texture approach, where all the graphics are rendered onto a single texture, and a rectangle area is specified when creating renderable objects, for a while but I kept putting it off. SFML’s update, causing any newly created render textures to dereference generated textures, it was time to take this approach on. The best part is that most of the work was already done by myself with the additional code of Jukka Jylänki’s MaxRectBinPacker algorithm, all that needed doing was to change how I defined renderables from setting the texture to whatever the name of the genrated texture is to the name of one texture sheet, and to get the correct rectangle from a map/dictionary, searching by string ID.

CaptureCaptureCapture

Now this doesn’t mean the entire game’s visuals are rendered from one texture. Including the 3D gemstones, any assets that use a repeated texture grabs a subsection of the main texture as a copy, same applies to the VBackdrop as well. Getting the icon was a more painful looking process of converting the entire texture sheet to an sf::Image, so I can load in a subsection to a new sf::Texture object, and then convert the new texture object to an sf::Image in order to set it to be the application icon.

sf::IntRect iconArea = TextureData::p()->GetTextureRect(TextureData::p()->GetPortalTextureName(true));
 sf::Image image = VGlobal::p()->Content->LoadTexture("TextureSheet").copyToImage();
 sf::Texture tex;
 tex.loadFromImage(image, iconArea);
 VGlobal::p()->App->setIcon(iconArea.width, iconArea.height, tex.copyToImage().getPixelsPtr());

Like I said, not pretty.

So enjoy Gemstone Keeper, the number of you who own it. Now back to doing more stuff in C++…

Advertisements

WizardJam – Re(re4ti0n

So June is almost over, and right now I’m writing as SGDQ is going on, but in the few weeks prior I was working on a game for my game-jam of June.

The game jam for this month is Wizard Jam, the seventh jam organised for the Idle Thumbs website and podcast. This was a jam that was fairly relaxed in comparison to most I take part in, being more than two weeks, with a very open themed convention. Instead of a singular theme, your theme is to choose from one of the many episode titles of the Idle Thumbs podcasts, which did take a while for me to pick, but I decided to choose one based on a little experimental project I was working on.

After being inspired from GDC earlier this year, I started work on a simple facial animation system to be used in the feature of a game. It used SFML’s primitive rendering system with interpolation and managed to get it to speak based on a simple string input. Wizard Jam gave me the opportunity to utilise it in a game with the theme “Read Our Lips” to test how effective it is.

The concept was a game where you were given quotes that are incomplete and corrupted, and your goal is to complete them based on your interpretation. The player had a short amount of time to enter their guess before being shown the next one. I went with giving the game a basic layout of an office, with a futuristic computer screen for the input and a faulty old looking monitor for the broken quotes. Thanks to SFML’s sf::Event::TextEntered, it’s incredibly easy to handle text input. It took less than a day to get the concept done, and an additional two days to get the initial layout done.

While I did take one day out to play around with the sfeMovie library, I spent most of the time polishing the existing game concept, improving the visuals and adding sound. I added camera movement so the text would be easier to see for a short amount of time. I updated the backgrounds so I could give a bit of a parallax effect.

The monitor was updated to use a lot of shaders, the title screen used the same amount of shaders. The main distortion shader was felixturner’s bad-tv-shader, combined with a fish-eye lens and scanline effect. I originally included a noise shader (as you can see in the previous tweet) but I found that darkened the colours so instead replaced it with the bloom shader that I’ve used in Berzerkatron and Gemstone Keeper. Finally, after some feedback, I added a simple chromatic aberration effect by offsetting the colour channels. It appeared to create an old and broken monitor effect that seemed to get some good impressions from people I showed it off on Discord servers.

There is no music for this game, just sound effects and ambient noise. Most of them were sourced from soniss’ GDC audio libraries, with some additional royalty free sounds for TVs and crowds. The name was kind of inspired by l33t speak, as I wanted to summarise the concept of the game (restoration/recreation) with the distortion you deal with.

The gameplay flow of having two minutes to guess as many quotes correctly was actually the last moment idea, originally you had to guess five random quotes with fifteen seconds each, but I felt that made the game too short for anyone finding it easy. One game dev on the Birmingham Indie Dev Discord suggested also making each quote progressively harder to start, but each would slowly become easier over a period of time. That way the game starts easy but gets difficult, but the currently displayed quote will slowly fix itself if you let it wait.

I was hoping to polish up the game a bit more over the weekend, but I went out to a party that unfortunately ended with the theft of one of my bags. While nothing game dev related was stolen, an expensive costume that I wear for public events was taken and it’s been reported to the authorities, although that didn’t stop the moment from dropping my emotional and motivational drive. I did get some last finishing touches done and missed the deadline by a few seconds, however the host was able to add Re(re4ti0n to the jam submission list the following morning.

You can play Re(re4ti0n by clicking the above image or right here.

Ludum Dare and the CFZ GameJam

To show my commitment to the “One Games Jam Per Month” resolution I set myself, I took part in Ludum Dare 41 in April and the Confuzzled Games Jam in May. You can click below to try out the entries, while I explain the development approach to both.


Ludum Dare 41 had a promising selection of theme, but it ended up with the problem of people picking what many considered the worst one: Combining Two Incompatible Genres. The main issue with this theme is that in theory, there are no incompatible genre combinations. Granted there are genres which in a broad sense looks like they wouldn’t fit, but with infinite creative possibilities and countless examples in previous Ludum Dares, you can make any two genres work together.

Several submissions had examples combining music-rhythm with adventure, the visual novel with point ‘n click, racing with city building and many more. I went with what turned out to be a more common submission, combining a shooter with a puzzle game. Specifically, I had the idea of a vertical shooter in the style of an interactive board game.

The concept was simple, you had players controlling the ships, and one player controlling the enemies. The ships can move and shoot one each turn based on dice rolls, and the enemies movement, placement and shooting are based on cards picked up each turn. The ships have the goal of surviving long enough to defeat the boss, while the enemy has to defeat all the enemy ships. It was a concept that I felt was easy enough to implement, with it mainly being event-based, with a game flow that could easily work as a physical board game.

However, a lot of issues came from delivering the game. Most of the issues, such as the game’s pacing, weird controls, the lack of CPU players + no options to set how many people in play meaning that five people were needed to play the game properly, could be narrowed down to time and how rusty I was with the engine I used, HaxeFlixel.

I made the mistake I’ve done in the past where I go out on the Saturday with friends, thinking that whatever notes I come up with was enough for me to power through the game on Sunday and Monday. However with the idea being so unconventional, that having the Saturday to set up how the game would work would have been a lot more beneficial.

Instead of using Vigilante as I have done with the past game jams, I went with my usual go-to engine for Ludum Dares, HaxeFlixel. As Vigilante was based on HaxeFlixel, they do have a similar structure. HaxeFlixel also has the benefit of being able to build for both web and desktop platforms, but I should have had a bit more practice with the latest version as on Sunday the rust was already showing. Some aspects such as asset loading were aggravating, functions weren’t performing how I assumed they would and Haxe doesn’t have the same syntax as C++ so I had to think more about what to write. It especially didn’t help that building for Windows didn’t work in time, and the HTML5 build would freeze at random points making it unplayable, which is why the game’s itch.io page requires Adobe Flash, as it’s the most stable build for HaxeFlixel.

By the time the Monday deadline was creeping up, I was becoming less and less driven to get the game feeling good and more getting it out. That’s why I couldn’t get the features I wanted, but because I already put so much effort in and wanted to get a games jam entry submitted for April, I went ahead and submitted… something.

Looking at the feedback, I can understand the criticism of it being slow, and I really wish I at least had the option to set the number of players and added in some form of CPU player, even if it was just RNG responses. I’m not happy with the score I’ve gotten, it’s definitely my worst LD entry not counting the even number curse where the entries that I made didn’t even get a ranking. There is a lot to learn and I have to take those lessons in, because not every games jam is gonna go as planned.

If you want to see what an experimental board game shooter looks like, feel free to have a go at Strategysphere.


The games jam for this month was ran by Confuzzled, a convention that I’ve been going to since 2011, but this year’s theme is video games and as such, they held the first ever Confuzzled Game Jam. The jam was three weeks long, with no specific theme but people could get ideas any of the previous convention themes, so my initial idea was an Osu style game where you had to play through a level while a scene would display your performance, and the level would be a music-rythm based auto-runner. I felt that the cutscene portion would have been too complex with my slow and sub-par drawing skills, to get what I want on time, and after Ludum Dare I wanted to focus more on the game so I stuck with the auto-runner.

Fortunately, this isn’t the first time I’ve tried to build a game for Confuzzled this year, I worked on a platformer prototype for a few months but motivation and other work got in the way, however the work did mean I already had suitable code for platformer physics. The biggest challenge I had was creating a level long enough for a music track, that was where a level editor comes in.

I initially thought of using Tiled, but I wanted to easily preview segments of the track and have game relevent infomation that I can use for reference, that’s when an idea occured to me to make my own. I wasn’t sure what GUI library to use until I saw a really good article on SFML with dear imgui. dear imgui is what’s called an Immediate Mode Graphical User Interface, essentially, unlike a traditional GUI library where you have to set up your UI elements, handle their input responses and render them individually, an IMGUI will set up and handle the UI elements you want during your update function. For example, if you want a button, in an IMGUI library you simply call a single function in an if statement condition bracket, and write the button press response in the braces of the if statement. While there is global setup for dear imgui, there is still less set up compared to when I used GWEN years earlier, making setting up the level editor’s user interface super easy.

Despite my ealier comments on drawing, I could still draw passable enough to do a running animation with a run-cycle reference, and once I added in some visual effects and some music from LMMS, I got a game! My sister came up with the idea of calling one of the foxes Foxtrot and giving him a buddy called Tango, so that’s why the game is called Foxtrot + Tango!

All entries for the Confuzzled Game Jam will get their games showcased at the convention itself, but you can play all the entries on Confuzzled’s website. Now I have the rest of the con to prepare for, as not only am I showing off a game I made for it, but I’m talking about game development as well.

Roguelikes and a Faulty Computer

I hope things are going well with all those who read this, whether it be while hard at work or relaxing while browsing their social media. Since GDC 2018 happened, it took a while to adjust me back to a work routine. It didn’t help that the week after I returned to the UK I was off to Bristol celebrating a four-day weekend with friends and family for my birthday. Fortunately, with my day job going on, I have managed to recover from jetlag and get back into a coding routine with some bumpy roads. I figured it’d be good to detail what went on up to now.

RDDL

The Games Jam for March was the Seven Day Roguelike (or 7DRL for short). This is a long-running one-week games jam dedicated to the roguelike genre. This year was the first year they hosted the jam on itch.io, instead of the Roguetemple forums and other hosting services that had since gone defunct.

The first time I took part in 7DRL was in 2016 with Dungeon Racer, while I was glad to get a game done using my engine for the first time since Gemstone Keeper’s early demos, in hindsight the concept was a bit too out of reach for me without preparation. This time I decided to do a bit more of a simple roguelike.

RDDL (pronounced Riddle) was originally going to be a dungeon based roguelike in the style of the Crystal Maze, where the player would have to find a key in each room to progress. Health would decrease over time and the only way to regain health was to either find it through treasure or defeat enemies. I used the GenLevelTools like I did previously, however, I noticed how lacking some of the features are (particularly with tilemap generation).

I ended up using the tile mapping system for this, which worked well with the tilesets made for Dwarf Fortress. I had considered adding the ability to change tilesets like I did previously with Dungeon Racer but I ran out of time. I also got to take advantage of GL-Transitions again with a cool grid flipping transition, people on the roguelikes Discord liked it so I took full advantage of it.

Overall it’s great to get a proper working roguelike, especially one that people would undisputely call a roguelike unlike my previous games. As of writing, voting has just ended on all entries, so you can check out how well it did on itch.io. Feel free to check out all the other entries too!

Speaking of previous games…

Gemstone Keeper: One Year On

As March 31st of this year is the one-year anniversary of the release of Gemstone Keeper on Steam, I figured it was a good idea on Twitter to talk about how it’s done and what I should learn from it. You can check out the start of the thread below.

I was inspired by Eniko of Kitsune Games to do this, after a tweet she posted on how stressful being an indie developer was. I feel it’s necessary to let people know that despite the success stories, a lot of stories aren’t as impressive. I still maintain that Gemstone Keeper’s response was positive, considering the circumstances, and I still appreciate the support and feedback people give.

Technical Issues

So on Thursday 5th April, I was reading an article on my main game development and home desktop machine when suddenly I got a Blue Screen of Death. I initially thought this was typical, at least until the machine restarted and would go to a blank screen. I tried restarting again and the same blank screen appeared. I checked the bios and the hard drive looked fine, but the same blank screen.

Then after taking out all other drives, I tried again and this time it says that there are no bootable drives found… this doesn’t sound good. After a few diagnostics and checking the hardware with the help of some friends, we’ve come to the conclusion that while the hard drive is fine, something happened when the BSOD hit that caused the Windows OS to come corrupted.

The good news is that nothing has been lost. All of my game development work as well as personal files and other, less relevent, projects have all been backed up on either external HDs or online cloud services (meaning that after my last major technical mishap over three years ago, I’ve definitely learned from my mistakes). Not to mention that while I cannot boot into Windows, I am still able to access the HDD using a bootable Linux drive, so anything on it is still salvageable.

As a result of this incident, it’s been decided that it’ll be better to upgrade components of the desktop instead of trying to repair it. The current HDD is a little over six years old, so even if I managed to fix Windows then who knows when the drive completely dies. Plus with more modern components, I can take advantages of any addition performance of say, an SSD for the OS and a HDD for data as opposed to a HDD for everything else.

Hope that clears up everything. Just like to make two short announcements, I’ve began on a new project, development will continue once the upgrades have been finished sometime this week. The next games jam I’ll take part in for April will be Ludum Dare 41.

Enjoy April folks!

GDC 2018

As I’m writing this, I just came back from my long trip in both San Francisco, with the main purpose to attend the Game Developers Conference.


This is my second year in a row for me attending GDC, the first time was really fun with loads to do, and I got to explore San Francisco. This time around, I did have a little experience and could had a good idea of where to go, but that didn’t mean there were some changes that threw me off. The main one being that the North and South Moscone Halls were being rennovated, so they looked like a construction site. The buildings were still explorable, but it was quite a contrast to last year. A section of the Yerba Buena Park above the North Hall was closed off as part of the rennovation.

As with last year, there are several sessions, talks and workshops going on during all five days along with the Expo Halls, Day of the Devs and Indie Megabooth, however this year also had the GDC Theater. The theater shows a lot of documentaries about game development, specifically the indie scenes around the world. However I didn’t go to that many talks, I had an Expo Plus badge, meaning I was limited to Sponsored, Career and Advocacy sessions, and some don’t interest me while others clashed with other things going on at GDC.

The Expo Halls are separated into indie game development (which includes Alt.Ctrl GDC, Train Jam and the IGF Pavilion) and major companies + middleware. There were a lot of games to try out, and several companies were giving out freebies. For me the best freebie was an Xbox One Game Controller from the Microsoft stand!

Finally, there are plenty of opportunities to meet with game developers. GDC had over 30,000 people in attendence, so it’s always overwhelming, but most of the people tend to be sociable and there are plenty of meetups and afterparties to get to talk to people. Even as an introvert I managed to talk to game developers from around the world, from Indie to AAA and got a load of business cards in the process!

After checking out many of the indie games, I’m tempted to try out a new visual style. I’m used to pixel art in my games but I feel as though more can be done instead of simple low resolution designs. It might also be fun to try some more expressive designs as well.

HighJam #1 – Berzerkatron

UPDATE: The results of HighJam #1 are online. Berzerkatron got Second Place in Theme and Third Place in Graphics! Thank you to all those who have provided feedback. I have since updated a post-jam version of the game and to celebrate the results a new update has been uploaded. You can find out more on Itch.io.

As part of my effort to participate in one game jam a month, the month of February is HighJam. This is the first game jam is organised by HighSight Gaming, a Twitch Streamer who specialised in Indie Games with Indie Insights for a while (a show which Gemstone Keeper appeared twice on), although now it’s been replaced with a new show analysing classic games, In Hindsight.

The theme of this jam was Atari Remakes, specifically to quote the description: “you must reimagine any Atari 2600 game of your choice”. One of my favourite 2600 games made by Atari was Berzerk, originally released at arcades in 1980 and was ported to 2600 in 1982. While the rules stated that I was not limited to the graphics, sounds and mechanics of the original, I felt like doing a “modernized” look wouldn’t do so well. The concept in my mind was to do a reimagining that would be in the style of Jeff Minter. It’s most likely due to the man’s past work, I had an image in my head of a “Berzerk 2000” of sorts, with a psychedelic feel, visually creative backgrounds and random sound samples.

Click here to go straight to the game!


Here is how I developed two of the most interesting concepts of this game:

The Level Rotating Transitions

This was a feature I was really keen to make, and once I found it was possible and implement, I wanted to keep silent about it so people can witness it while playing and see what their first reaction to it was, and when watching HighSight’s Playthrough (Skip to 01:54:30) I think it’s safe to say it worked. The initial version of the cube shader was by gre on gl-transitions.com, a website I’ve used recently for Gemstone Keeper.

The shader itself fakes perspective by skewing both textures so it appears thinner when further away, and moves both so it appears like a cube.

I modified the texture to remove the reflection at the bottom as it seemed unecessary and added a variable and functions so it could not only rotate it clockwise in the Y-Axis for horizontal transitions, but rotate it in the X-Axis for vertical transitions, it was then a case of using a uniform variable for me to define which direction I want the shader to rotate towards. You can check out the modified shader in the Assets folder of the game.

Randomized Levels

Funnily enough, having the levels be randomized wasn’t out to be creative but because I couldn’t think of a quick method of creating a huge array of level designs (the original Berzerk had somewhere in the range of 1024 different level variations!).

When looking through the original Atari version, I figured the levels were all configured into a 3×3 grid (I realised I was incorrect afterwards, as the Atari 2600 had 4×3 grid levels and the Arcade version had 5×3 levels), and then by defining each segment to a binary number I could determine which segment should have walls in either or all four directions.

I’d then construct a path between the player’s starting segment and the segments of each available exit, for the the remaining segments that have no value set, I’d use a random value. This last step had to be constrained as to have as few empty rooms as possible. However, as the above gif shows, not all levels are fully explorable. I also use the grid to determine which areas enemies and civilians should appear in.

Backgrounds

Unfortunately, I didn’t have the time to plan out or work on the brilliant background effects Jeff Minter develops, but GLSL-Sandbox is an excellent gallery of GLSL shaders that render brilliant visuals without any additional assets. I decided to pick ones that were monochromatic and were visually interesting without pointing too much attention from the game itself. I also used my multipass shader system to apply a shader that added a diamond gradient and another that made it possible to crossfade between different backgrounds.

Civilians

Interestingly, the idea of civilians to rescue (idea taken from Robotron and Llamatron) was kind of a last minute idea. I added this part of the game to encourage players to explore the level and add pressure to spend more time in the level while involving Evil Otto.

I did run out of time to implement some things I wanted like particle effects, but I’m happy I managed to get a playable version done. I did take one or two days off to have some leisure (and charity work) but I feel this is worthwhile. Hopefully enough people will vote and leave a good rating on this game.

Global Games Jam 2018

One of my New Years Resolutions is to take part in at least one games jam each month. This was a goal I set myself so I could develop more variety of games for the year of 2018. For myself, the games jam of January (and first games jam of the year) was Global Games Jam 2018, taking place on site at Staffordshire University in Stoke-on-Trent.

https://static-cdn.jtvnw.net/ttv-boxart/Global%20Game%20Jam.jpg

I’ve regularly participated at GGJ since 2013 at the Stafford Campus, however in 2016 the Stafford Campus eventually closed its doors and all the departments (Computer Science, Game Development, Web Development, Film, TV and Music etc) were all moved to the Stoke Campus. I skipped 2017 after a lot of regular GGJ attendees were put off by travelling to Stoke and hearing that because of security issues they couldn’t allow overnight stay. Near the end of 2017, one of my friends asked if I was interested in going since she was going as well, so I thought “Sure, why not?”.

Stoke Campus has improved a lot since I went there on rare occasions as a Student, and GGJ became a lot more organised on that site. Gone were the days where getting a table or a PC being a free-for-all, as people had to get tickets in advance for what kind of room they want, and each room had plenty of machines with the latest software (especially for Unity and Unreal Engine 4 developers). Gone were the days of little to no security or support since all rooms required a badge to get into (all attendees received badges at the start of the day) and the jam had volunteers available to provide support for the entire 48 hours. Gone were the lack of food and drinks on site as free fruit, tea and coffee were available on site, and with both Subway and the University’s Student Union Bar open all weekend and a short walk from the site.

The games jam began with a keynote, featuring tips & tricks from Unity, an ad for the Amazon Appstore, a celebration of 10 years of GGJ, a talk from Robin Hunicke and an 80s style workout video from Thorsten S. Wiedemann. The audience was riffing the whole keynote up until the theme announcement, which was fun and all but I did feel bad for Robin’s talk as she was giving an inspiring talk that was meant to encourage interesting stories and concepts, but the six minutes of nonstop talking with an unchanging shot of the San Francisco Bay Area bored almost everyone.

The theme was Transmission, and the theme announcement segment implied this could be anything from communication, to mechanical to passing one thing to another. Our team consisted of myself, my friend Kira, programmer James and two 3D modellers, Benz and Matt. We came up with the idea of a twin-stick shooter where you move along sound waves. James did an incredible job of generating sound waves visually using vertex shaders and lining up the player position with the line, Kira created a tone generator for the game to use, and I worked on enemy behaviour, management, bullets, GUI and main menus, and we all chipped in where we could to get the game in a finished state. Benz and Matt worked on the in-game models, as well as a nebula skybox. Here is the progress in tweets:

So we managed to finish with about an hour or two to spare, which is very good for us. I hardly post much about what I’ve worked on at GGJ because in most of the events they end up not finished, but this is the third out of five GGJs that ended up being finished. So here’s our game: Formants

Let’s see what the games jam of February will be.