SFML News – Week 40 (2013) – 18 (2014)

Believe it or not, but here’s a new SFML News post. About half a year is it since the last news post, to all the regular followers of the SFML News I apologize. Writing the SFML News is a time consuming thing and with my internship my focus has been heavily shifted toward web development, but as you may read further down, SFML hasn’t been forgotten.

Given the huge gap, I’m sure you’ll understand that I won’t be presenting all new projects, but well see for yourself, the list is still huge. And because of that I decided to put the other news bits first.

Continue Reading “SFML News – Week 40 (2013) – 18 (2014)”

Building = Preprocessing + Compiling + Linking

After answering the same questions over and over and over and over again especially about compiling and linking, I thought it might be time to write down a few things, that I and maybe others could point to instead of keep repeating ourselves in the future. Given the wideness topic I’ll be writing things down in multiple parts. In this first post I’ll be explaining a few basic terms and their practical applications, the next one will go more into details on how linking against external libraries work and in the third and last part I’ll be writing down answers to some common issues. I hope this will turn out as a timesaver for all parties. – As a disclaimer I should add, that I’m a human being that makes mistakes and can have wrong models in their mind, thus if I make a mistake feel free to point them out.

Part I - Building, Compiling, Linking

Part I – Terms and Explanations

Although this should essentially be covered in any basic programming book, even the bad ones, here we go with a few “definitions”:

Application

Looking at it in a very abstract way, an application is no different than anything else on your hard disk, because it’s just ones and zeroes, the important part however is how these numbers get interpreted. Your CPU (the heart & brain of your PC) doesn’t understand the ones and zeroes from a music file, but if you give it the data of an application it can translate them into actions that will do what the programmer intended to (hopefully).

Building

To get such an application, your C++ code has to be turned into ones and zeroes, also known as machine code. The full processes of doing so is called building and is as such more an abstract term, because the process is essentially a composition of mainly three sub-processes: Preprocessing, compiling and linking.

Header File (*.hpp / *.h)

If you’ve done your job right, i.e. followed the correct way of writing code, then you should have all the declarations of functions, classes, structs, enumerates, templates, etc. in header files. With the help of a header file, the compiler will know how much stack and memory space is needed for the machine code that is about to be generated.

Source File (*.cpp)

The source file holds most of the implementation details, also known as code definitions. It’s where the behavior of the application itself is crated, meaning how the declared classes and functions interact with each other.

Inline File (*.inl)

This is not always needed and essentially optional, but it’s a common and good practice to put code definitions, that are required to be in the header file, into an external file and include it at the needed position in the header file. The most common use of inline files is for template definitions, which need to be in the header given that they get executed at compile time and can influence the memory layout and footprint.

Preprocessing

Before your code gets translated into anything the preprocessor will kick-in. All the statements that start with a number sign are actually preprocessor directives and get resolved in the first step of building an application, for example all the #include will get replaced with the actual content of the included header file or for any #define X Z all X will get replaced with Z or any kind of macro will get executed.

Compiling

Now that one source file will hold all required declarations the compilation can begin. Compiling is one of the terms that confuses a lot of people since it’s often used synonymously to building, which in turn isn’t too surprising given that compiling is the most crucial part, since it actually translates all the source into machine code. But you don’t end up with an application itself, but instead you end up with an object file for each source file.

Object File (*.o / *.obj)

Object files contain the translated source code in machine code. While the CPU essentially would understand the commands of the binary data, it would not know where to start exactly and miss other referenced code pieces. Thus these object files are only the building blocks used by the linker to generate the final executable.

Linking

As pointed out above the linker will be combining the object files generate by the compiler. It’s called linking because it obviously doesn’t just append or prepend the files, but actually makes “smart” links between parts of the object files – for details you might want to refer to a linker manual or other sources. But the linker doesn’t just link object files, it also links in libraries and it’s here where the difference between static and dynamic libraries are important, but I’ll go into more details in the next part, for now I’ll just say that static libraries are actually just archives of object files and thus can be linked in directly, while for dynamic libraries one just specify the interface and the “connection” between the application and the external code will be made at runtime.

Integrated Development Environments

This essentially doesn’t have anything to do with building applications, but it’s exactly that point that gets confused often. Integrated Development Environments short IDE are simply a set of tools created to work nicely (integrated) together and assist the programmer in creating code. A compiler and a linker can be considered part of this tool set, but it’s not the IDE that builds anything. Some of the most common IDEs would be Visual Studio, Code::Blocks, Qt Creator and Xcode. However one exception remains and that is, the Visual Studio compiler doesn’t really have a name of its own. Sometimes one refers to it as MSVC (Microsoft Visual C++), which in turn could also mean the IDE itself. What’s certain is, that one should not use “I built this game with Code::Blocks”, but instead “I built this game with MinGW” or “GCC”.

Final Thoughts

Having reached the end of the first part, I hope this basic information will be of some help to new beginners and depending on the response or future experience, I might add one or two paragraphs. The second part already has some words written for, so stay tuned!

SFML News – Week …-29 (2013)

Although I’ve once wanted to make weekly updates on SFML News, the amount of content go more and more, while my time got less and less, thus I eventually stopped. Since there have been many new posts on various projects in the last few days, I decided to make another quick update and present some text and images and because there is so much nice stuff, I’m not going to limit myself on a fixed date in the past. Unfortunately I can’t write about every single project, otherwise this blog post would never end!

Projects

Academic project: Simulation of Scorpion & Mice

This project was presented on the forum for the first time on the 7th if July, it’s an academic project from the Swiss university EPFL and created by the Mac OS X guy behind SFML, namely Marco Antognini aka Hiura. Now the aim of the project was to simulate full life cycles of mice as the prey and scorpions as the predators. The hard part of the project seem to be lying with programming the neural network, rather than getting something displayed with SFML, but in any case it’s quite nice to see SFML being used in notable universities and projects. With this project the use SFML wasn’t just temporarily and won’t stop now, but Hiura says that they’ll be using their SFML based setup in the future, so the next class might be actually learning SFML!

Postmortem – One must die

Postmortem has been first shown over a month on the SFML forum, but it went into Closed Beta just recently and now even tries to get the green light on Greenlight – although I’m still wondering how they’re going to get a free game on Steam…
Here’s a quick description from their website:

Postmortem is a FREE Indie narrative-exploratory game that will stress your moral compass this August 15th! Think The Walking Dead meets Home and The Last Express, with a dash of To The Moon – a perfect mix of exploration, conversation, meaningful choices, discovering clues and some puzzles.
You are an agent of Death sent to take ONE life from a cast of influential and ambitious characters at a charity Gala, in a rich and complex setting of industrial-revolution, conflict-torn country.

They are of course running their own website and a nice dev blog. It’s nice to see, that they’ve already gotten an article on US Gamer. Personally I think it’s an intriguing idea and definitely worth checking out!

Colonies – A Retro Sandbox Survival MMO

Not a new game presentation either, but they’ve now gone into Closed Alpha phase and since it looks really well polish, I just had to include it here. As the title suggest this is going to be a sandbox game with RPG elements and it should be an MMO or at least O(nline) as well. You should be able to settle, create a village, and defend your friends from the horrible creatures who lurk in the forests. You can change the landscape, farm, or hunt in order to survive the conditions, etc. Whenever the word “MMO” drops people get suspicions, since it’s hard to get done right and needs a lot of skill and time, but feel free to follow Jungletoe’s dev blog and don’t forget to stop by their own community.

Basis: Bone and Sprite Integration System

Some of you might have noticed the Spine project from a few month back, which also has support for SFML and I’ve even helped on Kickstarter. While Spine costs you some money Basis doesn’t cost you anything. Both mentioned applications are for 2D animations of skeletal and sprite creation. Although the tool is free the development still needs to be financed, thus they’ve started a Kickstarter project as well and they could really use some help! A download can also be found on the Kickstarter page.

Council of Torment – 2D dungeon crawler with a rich storyline

Although Council of Torment is still in rather early development it still deserves its place here.

Council of Torment is a top-down 2D dungeon crawler inspired by Ultima IV, with a very rich storyline, gameplay elements that’s been under development for 10 months.

From the description on the forum it seems that a big portion of the development will also go into the story. There’s not much more to talk about for now, but it’s certainly a project to keep an eye on.

Rock, paper, scissor.

I think, I don’t have to explain how this game works or I at least hope everyone knows “Rock, Paper, Scissor”! Although there still seems to be some animation issue, it works fine and can be interesting to try and figure out, if it’s based on some pattern or simply randomly generated. Not only can you download the game itself, but if you want, you can also look at its source code.

Metanact – Filesystem spaceshooter

While nobody has ever heard of Schnommus aka Seb, he seems to have been reading the forum for quite a while now. Judging from his progress on Metanact so far, he also seems to know quite a bit on programming. Metanact’s goal is to explore and conquer your own computer’s file system in a 2D environment. So while playing, the game will go through your file system and pick out various file names and represent them as enemy. While this game reminds me of other “file system” games, which would actually delete the files you’re shooting (e.g. Lose/Lose), Metanact is not such a game. It does not do any harm to your file system. You can find out more about Metanact on their website or even help Seb getting a bit more money together for some more nice content on indiegogo.

2D Platformer using SFML and Box2D

It always amazes me how some is able to create such a rather nice game as their first project. I still haven’t managed to get my own little platformer running (most because I end up doing unnecessary stuff) and others just go ahead and get it done in their first project. Though it seems, he’s using the Public Domain tile-set, I’ve found yesterday as well – visuals are something that can blur the actual vision between good and bad.

GoPlanets

One of my favorite game in the current list is GoPlanets. The idea is rather simple but much fun! You’re red and can send out a certain amount of ships to other planets to take them over. The numbers on the planets display how many ships you can send and based on this number a given percentage will be taken away when sending out ships. The number increase over time automatically, so the longer you wait, the more ships you get, but keep in mind that the computer will try to win everything in the meantime as well. Although the current AI isn’t really challenging it’s still very fun to play. I really hope to see some further development on this project!

Project Blastorium: a Bomberman-esque game

I don’t think anyone will really remember my attempts on a bomberman clone for one of the SCC. I got some result, but it was very messy and I think I’ve never got it really finished after I’ve missed the deadline. Project Blastorium on the other hand is very well polished and introduces some different weapons to the playground, which seems rather interesting. You can follow the progress on the game on the dev blog or just in the forum.

Black and White and Colors

Molyjam 2013 a game jam, where you have 48h to start from scratch to the finished product. They seem to have been three people involved in this project and their final product after only 48h is just mind blowing. It’s simple, but very well polished and the game idea is very good. It would be totally awesome, if they’d go and add some more content, i.e. new levels, since you’ll get to the last level in just a few minutes. You can get the Windows binary from the Molyjam site or read some more information on the forum.

Discussions

SFML Game Jam

This discussion just popped up on the forum, thus it’s still very hot and it seems many people are tuning in on the idea – even Laurent would be excited to see something like this.
The goal would be to have a contest going for a specific amount of time (24/48/72h) to start and finish a game using SFML. How, when, where and why is what the discussion is all about, so don’t forget to give your own voice!

Clipboard and Open with Default Application feature for SFML

Originated form the GLFW 3 thread FRex went ahead and proposed the two features. The discussion is still open and if you really want this feature, you should definitely go and write there why you’d like to see this. Personally I think this could be nice, but since it should be relatively easy to implement on my own, it’s not something that should get on a high priority list.

Changes on SFML

There have been so many commits and issue discussions, that I’ve totally lost track. You can however always go and look at the commit history yourself!

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!

TileMapCreator – Update 02

Nearly two month have passed since the last update on the TileMapCreator and I kind of feel bad about it. For my excuse I’m studying for my upcoming big exam.

Last time I was talking about the grid and how I want it to improve; I’ve spend quite some time thinking and trying out things, but haven’t gotten the best solution implemented yet. In addition I’ve looked more into how to use Git and opened a new project over at GitHub, check it out:

TileMapCreator on GitHub

If you clone the repository you’ll need SFML, SFGUI and Thor and you’ll have to create a make or project file on your own. Once I get the time I’ll dig deeper into the whole CMake thingy, you’ll be able to just use CMake to build TMC.
So if you’d indeed get it to compile and run you will only see the GUI, that’s because I’m in the process of refactoring everything and getting more into TDD (Test Driven Development), which means I’ve removed the grid temporarily, added a separated GUI class and implemented different tests. Since the last push this evening I’ve already decided to split the GUI class again into two classes and put them into their own namespace.

So how does the future look like? I decided to first concentrate more on the GUI and loading tiles into the GUI, rather than playing around with a grid that is just somehow plugged into the project but doesn’t connect with the other parts and probably needs to get rewritten later to fit with them…

That sums it up for now! If you want to keep a close look at the project make sure to watch the GitHub project!