SFML News – Week 11 (2013)

Although I probably shouldn’t start again with something new and rather try to get more of those computer science articles ready, I still had this funny idea of releasing ‘news’ articles on what has been happening in the SFML community. I’ll try to release weekly articles, but I don’t promise anything and I don’t even know how much I’ll write for each article.

Projects

Kroniax

As promised by AlexAUT, Kroniax 0.4 got published last Sunday and it adds a complete redesign of the GUI and a few additional levels. Although he mentioned that it would take longer before the next version, he managed to get 0.51 (download page) out yesterday.

But who’s AlexAUT and what’s Kroniax? AlexAUT joined the SFML community in October last year and has been most likely busy ever since. Less than a month ago he released his probably first bigger game with SFML. It’s some kind of a side-scroller, where you have to maneuver a white triangle, representing a ship, through a maze of blocks. To make things more interesting the velocity of the triangle as well as the strength of gravity varies from level to level or can change within each level. Next to the described Arcade mode, the latest version 0.51 features now another mode called Speedchallenge, where you can change the velocity on your own, while you still have to beat the level. Since it is called ‘challenge’, AlexAUT added an online highscore, so you’ll get some aim to fight for.

Kroniax is extremely addictive and makes a lot of fun. Since I had so much fun with it, I’ve even made quick Let’s Play:

Open Hexagon

Legendary Vee has done it again and released not only one new version of Open Hexagon but five; starting with 1.8 and ending with 1.84 (download page). The most noticeable change are the online highscores. Everyone who’s playing with the official version in ‘official mode’, will automatically submit their scores to a server and get their current position and the top 8 places. But that’s not the only new thing; you now get a full menu for various options and a nice pseudo 3D effect. As always you can find the full changelog in Vee’s detailed ReadMe. The minor updates were mostly bug fixes, as well as security and performances updates.

I actually wanted to make another video on Open Hexagon, but my microphone on the headset died and I don’t have a replacement yet. The built-in mic of my notebook is not really useable for such things, but you can still checkout one of my older videos on Open Hexagon:

NEAT Visualizer

The NEAT Visualizer is a project, which visualizes an implementation of the Neuro-Evolution of Augmenting Topologies (short NEAT) algorithm. The NEAT algorithm evolves neuronal network structures and weights them simultaneously. Such a network is capable of learning some simple tasks, which the visualizer should make prettier for the eye. The used algorithm doesn’t have anything to do with SFML, since it’s a generic, but the visualization uses SFML underneath. Based on NEAT lolz123 has also written a small but fun game as Ludum Dare.

lolz123 released a new video and a new version of the NEAT visualizer this week. You can look at the video here:

Discussions

New SFML Logo

Nearly two years ago Laurent opened the discussion on the forum for a new logo. Back then we already assumed SFML 2.0 would get released anytime now, but well we are still waiting, more on that in another post though. After the thread died out for a while it’s back again and every week we get a few new suggestions. The ones of this week were in my opinion quite strange and not very well suited as logo. On two of them it’s nearly impossible to see the letters ‘SFML’, especially if you don’t know already that they should be there. The other one is textured which is not useable at all for a logo. But maybe I’m not artsy enough to understand this, so I’ll let you make your own opinions:

Will SFML support OpenGL ES sooner than expected?

OpenGL ES is as specification for a platform and language independed 3D programming. It’s mainly aims embedded systems (thus the ES) such as Raspberry Pi or devices that run Android or iOS.
If SFML were to be ported over to OpenGL ES, it could potentially open the world to a whole new set of platforms and thus new games and applications with SMFL. In general Laurent wants to get SFML to OpenGL ES, but in the past this was not due for anytime soon. What could then change his mind? Well slotdev started a discussion on the forum about having a DirectX backend for SFML, which would involve even a bigger change to SFML, but luckily some guys have created ANGLE, which basically translate OpenGL to DirectX calls and thus enables one to write OpenGL applications for platforms which support only DirectX. The downside to this is though, that ANGLE implements an OpenGL ES specification. Since slotdev and a few more people are commercially working on games for casino machines, Laurent stated that he’d be looking into getting OpenGL ES support sooner than plant, if they require it anytime soon. The discussion was then moved to private chats and we’re kind of left in the dark what they decided on.

What do you guys think about elevating the priorities on OpenGL ES? Should Laurent tackle other more important issues first before rewriting huge junks of SFML’s code? Let me know what you think in the comments below.

Source code changes

Personally I feel like we got a much more involved community in the past few weeks, but I’m not sure whether this is just because I’m looking more closely at the commits and what’s going on, or if it’s really because more people are submitting pull requests and Laurent actually accepts them. It also kind of feels like, Laurent got a bit more open about contributions after the forum thread with the title: “More Commuity-driven Development”

  • We received a fix from one guy, who had problems with some events on Arch Linux with Awesome WM. – 560b741
  • As noticed by our great Nexus in a forum post, the explicit for the sf::Text constructor wasn’t needed anymore. – 5c46daa

 

I hope you’ve enjoyed reading my news post and actually got some news out of this. If you feel, that I’ve missed some parts or just got any kind of feedback, please leave a comment down below or contact me by means of PM, Mail, Twitter, IRC, etc. I’d really to hear some opinions.

yEd – A simple and nice diagram tool

How often do you find yourself, trying to put some information graphically into sense, but fail to do, because the software you’re using isn’t really nice to use?

Maybe you’ve never experienced that or have never needed to do so, but I have on multiple occasion and it has never been fun.
Being a fan of open source and free software I quickly found my way to Dia, but seriously this software is not fun to work with. The interface seems to be quite buggy and you can get tired by clicking and searching through the menus and then there you’ve all that mess with your objects…
Next up being a Windows user and student I can get a copy of Microsoft’s Visio for free. Well the interface seems quite familiar and the functionalities are fitting… but it just doesn’t feel like the solution, in fact the chaos still remains.

Today, I was browsing again through my RSS feeds and found that a friend of mine (Stefan Schindler aka Tank) has published his first tutorial/article about Game Development Design (it’s very interesting and should definitely read it!) and he was using some nice and fancy diagrams. So mentioning the diagrams on IRC he immediately pointed me towards the software he used: yEd.
Here’s the solution to my initial problem:

diag

And for all the lazy people that don’t want to check out the site, here’s a YouTube video:

Stay tuned for more updates on my projects!

SFMLUploads.org – Relaunch

So I’ve taken ownership of the project SFMLUploads.org which is basically a file and image hoster made specially for developers who are using the SFMLibrary. Below you’ll find the announcement text I wrote for the official SFML forum.

After quite a few ups and even more downs SFMLUploads is finally back online!
SFMLUploads.org was originally created by the user Haikarainen back in May 2011 but due to server issues the project had experienced some hiccups in the early days and then went offline in July 2012. As quite a few things have been uploaded to that site and linked to in this forum, I felt it was wrong to lead the project drop dead, thus I contacted Haikarainen and convinced him to let me host and maintain the website. So here we are with the relaunch of SFMLUploads!

All the files and user accounts have been successfully transferred over to the new host, thus you’ll be able to log into your old account again to get access to your files. If you don’t remember your password you can contact me and I’ll give you the opportunity to re-register.

SFMLUploads logo

SFMLUploads is aimed at developers using the SFML library, and it’s main purpose is to serve those users with bandwidth for:

  • Project archives, allowed extensions are: .rar, .zip, .tar, .tar.gz, .tgz, .deb, .rpm, .7z, .xz, and .ace.
  • Code-snippets, syntax-highlighted code with support for 100+ languages, "fork"-able, meaning users can create other versions of it. Useful with debugging etc. Kind of like Pastebin.
  • Screenshots/images, allowed extensions are .jpg, .jpeg and .png. Primarily for screenshots, but other picture are allowed as well.

The main rule is: It HAS to have something to do with SFML, either if it’s for a forum post where you seek help for debugging a problem related to/which uses SFML, or if it’s download links for your awesome game on your personal blog or something, etc. You can read the full terms here.

I hope you like it – signup and enjoy! :)

PS: This service is 100% free, if you feel like donating for the hosting cost then you can do this here. Thanks!

A SmallGameEngine or State Machine

introFrom a question ask in the official SFML forum which linked to a tutorial by Anthony Lewis at GameDevGeek.com I took the challenge up on me and converted that small game engine or maybe it would be better just called a state machine from SDL to SFML. In the near future I also hope to rewrite the original tutorial but of course inserting my insights and explain the additional changes I made. Also I’d like to get some more or less official approval that I’m allowed to copy bits and pieces from Tony’s text but unfortunately he didn’t reply to my e-mail (via the contact form) yet. So here a few things about it.

For all those that don’t understand what a state machine is, here a quick definition:

It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition, this is called a transition. – Wikipedia

So there you have it; we have a finite number of states of a game, like the menu, the splash screen, the game and the credits screen. The machine is running as long as there’s an active state and only one state can be active. (More details in the upcoming/original tutorial.)

So since the code is completely based on that tutorial it also uses the same states, namely IntroState, MenuState and PlayState. You start off with the IntroState and then by pressing any key you’ll proceed to the PlayState from which you can either invoke the MenuState or exit the application. From the MenuState you can only switch back to the PlayState.

After some thinking I’ve changed actually quite a lot of the GameEngine class and how states get created, paused, resumed and destroyed. I’ve also decided to use a few nice language features (e.g. RAII or std::unique_ptr<T>) so the code can now get described as C++ code rather than C with classes code.
Those changes, next to the ‘artistic’ advantages, give you more flexibility in using the states, as you can reset a state by just recreating it and it ensures that all three functions HandelEvents(), Update() and Draw() get called before a new state gets started, thus minimizing possible strange behaviors.

So overall it’s a nice little demo for a state machine and I might just as well use it in some future project. So feel free to literally check-it-out (or better git pull) on GitHub. If you got any questions then just put them in the comments, if you have any suggestions or bug reports use the issue tracking system of GitHub.

SmallGameEngine

TileMapCreator – Update 01

As promised here comes a small update on the TileMapCreator; screenshot first:

tmc

So this must seem disappointing, nothing really changed, except maybe the gray square on the grid. But then again I’ll have to remind you that TMC is far from being useable and the biggest changes will happen in the codebase which then again don’t necessarily need to be visually present in the application. What did then change?

In the old version I just had one class Grid which handled all the selecting and highlighting decisions next to the rendering part. This ‘method’ got quickly out of hand and there was no useable way to keep track of every cell and its states. But if one ‘object’ has different states why would I want to try really hard to synchronize different vectors? Why not just use another class? So I introduced the new class Cell for which exist just one header file. One cell keeps track of the states highlighted, selected, changed and filled. Additionally if also hold a shared_ptr to the texture or nullptr if the cell doesn’t hold a tile.

For the grid rendering I also thought about for quite a bit, actually it was the first part I changed, and I’ve chosen the following render steps.

for each cell
  if the cell has changed
   draw the blank sprite to clear the cell
   if the cell is filled
    draw tile
   if the cell is selected
    draw selector
   if the cell is highlighted
    draw highlighter
   draw the grid overlay
 if one cell has changed
  update the grid texture

This assumes an iteration over all cells doesn’t cost much time. Also I always clear the cell because it’s possible that the tile as some transparent pixels, rendering it on old content would produce a wrong image. This seems to work quite well.

Another approach I could think of would be using multiple render textures for different layers and then combine them at the end. But I don’t really see how it would make a difference in performance and it would probably only increase the GPU memory usage.

As you can see in the screenshot the highlighting already works (again). When ever your mouse cursor hovers over a cell it will get highlighted once and when you leave it, it will get ‘unhighlighted’ and the next cell will get highlighted.

Next up will be selection. For that I’ll have to store the selected cells in a vector or a similar data structure, to tell the grid which should be shown as selected and later to tell the events like delete or place where to work their magic.

TileMapCreator – A GUI tool

Whenever you’re thinking about creating a tile based game you end up with some hackish format for loading tiles. There’s no good way to edit the format and if you forget which number represents which image you’re lost.

Although I’ve never really come close to a functioning tile based game, I often failed at the map load and create functionalities. So I looked a bit around for existing editors and loading functions and there are quite a few like Tiled or Mappy, but they mostly don’t fit my needs or use some proprietary libraries I’m not willing to use, either because of the overhead (e.g. boost) or license (e.g. Qt). With that in mind I decided to create my own editor. I will work it out for quite specific properties and then try to open it up for further settings.

But since this is a blog about my development experience you can guess the editor is still in a very basic state. Once I’ve hardened the code a bit more, I’ll open new project on GitHub, until then you’ll just have to keep reading the updates on this blog.

The GUI concept is quite simple; on the left side there’s a grid which represents the tile map and on the right holds various GUI elements and a list of the existing tiles you can work with. As I was thinking about the GUI I’ve searched a software for fast prototyping with GUIs and ended up with Pencil, which can run as extension in the Firefox browser but you can also use it as native application. It’s a bit of overkill to create a concept image for this simple GUI but I did it anyways:

concept

For the implementation part I first though about using Qt since it provides a very nice interface but since I’d then had to figure out how to use it with SFML I decided to take a better look at SFGUI. It works pretty good but it misses many features you’d expect from a GUI system but since it’s in constant development there’s more to come in near future. I’ll probably post about SFGUI separately since there are a few words more one could talk about it.

Additionally I use the Thor library for handling my resources. Thor acts as an extension to SFML and adds many higher level feature like resource manager and particle systems. For TileMapCreator it seems to be a quite big and the since I don’t really have to share my resources the manager is actually just a easy way to load resources.

So with SFML, SFGUI and Thor I get my base onto which I can build the TileMapCreator. So far I’ve setup the GUI system and created a grid class on which I’ll have to do some tweaking.

Icons

I’ve chosen the icon package Grunge-Icons from icons.mysitemyway.com. I don’t really like them but I couldn’t find anything that does have a big enough resolution and not just 16×16, looks a bit non-standard and can be used freely. So if you have any suggestions please leave a comment!

That’s it for now but I’m sure there will be a few updates before this gets useable.