SFML Games – February (2016)

Maybe this will actually turn into a monthly thing again, who knows?!

New Games

As last month this section contains only games for which binary files have been provided, so I could actually try them out.

Cendric: An RGP Platformer

Cendric

I have run into this one quite a while back and was especially excited, because it’s being developed by some fellow Swiss people. As the title says the game is a mix of an RPG and a platformer. The only playable version currently consists of one map where you can walk around and talk to one NPC and one platformer level. If I understood the game play correctly you could realm around the world and whenever you entered a cave or other places, you’d essentially switch into “platformer mode”. You can upgrade your character with various gear that you either find or buy from NPCs. Since that playable version they have done quite a lot of changes, so things might look a lot different now.

The project is open source, they have their own website and have made a forum post.

Tennis Pong

Tennis Pong

Some people may have enough of Pong clones, but I’ve to say despite it being a Pong game, the art makes it a lot more attractive. The sound effects are spot on (they are apparently from Mario Tennis of Wii U), the music in the menu is great and little details such as the ball’s shadow changing depending on the “height” makes it just an overall great game. Additionally the AI can be beaten, which makes more enjoyable than just being always defeated.

You can find more information in the forum post. If you want to find out more about the author you can check out his website.

YAPG – Yet Another Platformer Game

YAPG

While there’s not much game play to see as of right now, the more interesting part is that the whole game is built to be very modifiable. One can create their own blocks, levels etc. and the level editor will be directly included. I hope that we’ll get to see some more in-game content soon!

Until then you can check out the source code on GitHub and read more information about it on the forum. And don’t forget to check out the author’s website!

SnakeFML

SnakeFML

As the title kind of hints at this is a snake game, but with the head being the SFML logo, but with eyes. The color of the body gets picked randomly when the game starts. Unsurprisingly the goal is to catch as many mice as possible while not colliding with yourself or that water. As most other snake games it’s quite enjoyable to just quickly jump into and play a bit. I hope we’ll see some more changes in the near future.

The game is also open source and for some more discussion check out the forum thread.

Game Showcases

Some games don’t have playable versions yet, but feature some interesting videos or screenshots.

Heart

Heart

The game reminds me quite a bit of circular Pong/Breakout, the goal seems to be to move the circle around so the emitted ball will hit the near matching color on the outer ring. The concept was highly inspired by this video. Check it out on the forum.

Blind Jump

Blind Jump describes itself as Space Themed Adventure Game with Roguelike Elements. The levels are procedurally generated, the goal is to follow certain way points and should increase in difficulty over time. I like the shown designs so far quite a bit, so it will be interesting to see the final product. Check it out on the forum.

Muffin World

Muffin World is a simple platformers that is not locked into a grid and comes with moving platforms. It’s still in development but the built-in level editor looks already quite promising, Check it out on the forum.

Pointless War

Pointless Wars

Last but not least is a game that was already featured last month, but didn’t have a name back then. It’s a turn-based strategy game that builds a lot around how you setup your formations. I really like the art style and the idea behind it sounds quite intriguing. Check it out on the forum.

Honorable Mentions

No honorable mentions this month, but they’ll be back in the future!

SFML Games – January (2016)

Due to exams I had been quite busy during January and February and only now came back to look at all the newly created SFML games. However since I don’t really feel like summarizing discussions or important things going on in the community, I didn’t want to make this another SFML News post and thus named it SFML Games.

New Games

In this section I’ll only feature games for which binary files have been provided, so I could actually try them out.

Slimey Carnage

Slimey Carnage

I love platformers, so this fits directly into my category. While it’s marked as alpha release the visuals are quite polished, the game menu is very well done – especially the settings screen – and the music and sound effects fit very nice. The only downside is, that after a few level the game gets nearly impossible (for me). My guess is that the game was created while using a controller and has not really been tested with a keyboard, or the developer is just a huge platform player. If the controls get adjusted this could easily turn out to be my favorite game of the month. Check it out on the forum.

SF-SpaceG

SF-SpaceG

Next up is SF-SpaceG a small game that reminds me of Asteroids, but goal here is to fly around and get all the checkpoints while avoiding the asteroids. It is kind of strange that the deceleration is a lot slower than the acceleration, plus when you destroy an asteroid it doesn’t go away, but only stops moving and turns red. Additionally it can be quite tricky to figure out whether you’re moving or now since all the asteroids around you are movie as well. The game can be quite fun, but it needs quite a bit of work to get there, especially with the visual feedback. Check it out on the forum.

Fury3D

Fury3D

Not exactly a game, but I guess it’s a start to some game. Fury3D is a simple 3D rendering engine written in C++11 and modern OpenGL. It uses quite a few various libraries, but the demo runs and looks quite nice. Check it out on the forum.

 

Game Showcases

Some games are not yet playable but have some interesting screenshots or videos which I’ll provide here.

Our Dear Paper Fighters

Unfortunately at the time of writing this the link for the download was unavailable so I didn’t get to try it out. The video looks very nice and little narrative popups are quite funny. It feels a bit bullet-hellish which I usually don’t like, but it think this could be quite enjoyable after all. Looking forward to being able to play it. Check it out on the forum.

Unnamed turn based strategy game

Unnamed turned based strategy game

The goal here is to fight win two consecutive battles in a row against another army. From the provided screenshots it seems like quite a bit of the mechanic is already implemented. Check it out on the forum and if you want to see more screenshots and vote for a name, check out this thread.

The Dare

There isn’t a whole lot of information on the project, but it should end up as a top-down horror game set in a psychiatric ward where other patients will try to kill you, while you explore the unknown parts of the facility. Check it out on the forum.

15 Puzzle

A simple puzzle game where you have to bring the scrambled pieces back in order again. Check it out on the forum.

Honorable Mentions

While not published exactly in January, I’ve picked out a few games that I just felt deserved a mention here.

Cinnamon Warfare

Cinnamon Warfare

It’s a two player game created by Nexus and few other people during the overnight contest at Devmania. The snowmen’s labor union is attacking you and you need to coordinate the building of a defense wall made out of gingerbread. Unfortunately I didn’t have a second player to really test it, but it looks nice and has some fun elements to it. Check it out on the forum.

Re:creation

Re:creation

This game has been in development for quite a while now, but it’s so great and Elias Daler, the developer behind it, is very open with all the tech he’s using. It’s a top-down RPG like game with an interesting mechanic called recreation. Checkout the forum thread for more information, it also contains among nice screenshots a lot of very interesting C++ discussions.

Convert EPS to SVG – Cisco Icons for yEd

I wasted like one or two hours on this and thought, I’d make a quick post, so others don’t have to waste their time in the future.

Convert EPS to SVG

If you just want to convert some EPS files to an SVG file, all you need is Inkscape and then use the following command to do the magic:

inkscape input-file.eps --export-plain-svg=output-file.svg

If you have a bunch of these files you can use the following command on Windows to convert them in one batch:

for %%f in (*.eps) do inkscape "%%f" --export-plain-svg="%%f.svg"

Of course Inkscape supports a lot more formats with a lot more options, just use the help flag to get the full list.

Cisco Icons for yEd

I originally ran into the problem, because I wanted to use the “standard” Cisco icons for a network diagram in yEd, an awesome and free graph editor. While googling I ran into this post which provides a set of Cisco icons for yEd, but the huge color difference between the icons just wasn’t acceptable (light blue vs “Cisco” blue). So I thought to create my own set and found myself converting the EPS from Cisco’s official Network Topology Icons page. I then converted them as described above, imported them into yEd and exported the full set for you to enjoy. There’s still some color difference, but less extreme. Since a lot of the icons are rather useless – or do you use some space router at home? – I’ve selected a few of the icons which seemed most useful to me and created a separate package. Note: The converted SVG files ares included.

Cisco Icons SVG + GraphML [394 KiB]
Cisco Icons (Selected) SVG + GraphML [41.7 KiB]

See this article on how to import the icons into yEd.

A look at CLion 1.0

For the development of Synth Guitar my Ludum Dare Compo entry I decided to use JetBrains’ CLion as my IDE. Ever since writing my most popular post about MinGW-w64 and an older EAP version I played around with the thought of trying it out, but never found the right project for it. For a year or two I’ve been using Code::Blocks, but was never fully satisfied (among others also because of this), however whether CLion will replace Code::Block for me is still open.

CLion

The Setup

Before I had the EAP (Early Access Program) version installed on my notebook, but for my desktop PC I got to newly install the full version of CLion. As a student I get a non-commercial license for free, not only for CLion but for most of JetBrains’ products. If you however want buy CLion you’ll be paying €99 for a personal and €199 for a commercial license.

The download was very fast and with 138 MiB acceptably small. In comparison the offline installer for Code::Blocks with a compiler is 98 MiB and for Visual Studio you’ll be spending 6.9 GiB of your bandwidth, because Microsoft unfortunately doesn’t manage to provide a version just for C++.

CLion Setup

The setup is very simple and I quite like the settings part when starting CLion for the first time. It allows you to directly change the options for design, version control integration and proper compiler detection. The later is one of the strong points compared to Qt Creator or Code::Blocks, because CLion supports and properly detected my MinGW-w64 installation, while it always seemed a bit of a hassle with Code::Blocks or you first needed to learn how Qt Creator actually handles toolchains and compilers. I wonder though why JetBrains couldn’t fully “support” the latest builds of MinGW-w64, not even with their 1.0.1 update. Then again I ignored the warning you get for it and have yet to run into any problems because of that. However CLion has stated that it can lead to freezes in certain situations.

The Build System

As someone who quite likes CMake, CLion’s native support is amazing and something I’ve been looking for quite some time. Of course Qt Creator comes with CMake support as well, but last I tried it, it did not integrate very well. With CLion you write your CMake code, link your favorite libraries through it and it will build and run just fine. One thing that seems a bit strange compared to most other IDE is, that CLion keeps by default all the build files in a temporary directory somewhere in your user directory. I mean it makes sense to not spam the source directory with all the CMake temporary files, however every now and then one might want to do something specific with the binary and has to go search it in there. My assumption is that CLion expects you to install the binaries instead. Luckily the directory can be changed with a few simple clicks if you know where to look.

One of the strange default options CLion ships with is that it allows multiple instances of the application to be run. So when you for example are debugging, you can also click on run again and the interface will switch to a different layout but still keep running in the background and a new instance will be loaded. During the Ludum Dare Compo I didn’t figure out that there’s a stop button if you switch to the correct tab, thus I ended up killing off GDB manually. I’m however really glad that pressing the stop button works, because pressing the stop button with Code::Blocks most of the time simply doesn’t work and you end up having to kill the process in the task manager. After the Compo I got a response from CLion that there’s an option to only allow one instance. This should in my opinion be the default setting given that single-instance applications are a lot more common.

The Editor

I had been using Vim for some web development during a year or so and gotten quite used to some commands, however I’m still not a Vim guru, but can’t argue with the fact that it can accelerate the code-writing quite a bit. As such I tried out CLion’s Vim-Emulator and I’ve to say it’s very good. My main critique would be, that it’s not obvious in what mode you’re currently in, as such it’s really annoying when you start typing commands or text and only then notice that you’re in the visual mode. I honestly never had that issue with Vim, so all I can assume is that the indicators aren’t well placed. Something else that got me quite annoyed is that in almost all cases when you click on the editor to get the focus back, it will (accidentally) switch to visual mode. This usually lead me to keep hitting the ESC key multiple times just in case, to ensure that I ended up in command mode. Since the Vim-Emulator is a general JetBrains’ feature and not strictly related to CLion it might also just be me, who isn’t used to it.

I’m not a big fan of getting my code automatically formatted, since my style usually doesn’t match with the coding style of a lot of other C++ developers. Until I realized that CLion allows you to customized the formatting rules to about every detail, it was quite annoying to work with at times. But the customization settings are in fact so detailed that you have to be careful to not overlook the option you actually want to change. What was a bit counter intuitive however is that in order to make any changes to the formatting, you first have to create a new style setting. The ones that are installed by default are read-only. Some indication for that would be helpful and would’ve saved me a trip to the all-knowing Google.

Performance

Performance is one of my main concerns with JetBrains’ IDEs. CLion is written in Java and even though they do a great job at hiding that fact, meaning the application doesn’t feel nor look like your standard cheap Java application, the resource allocation regarding RAM and CPU time is something you might not want to overlook. To be fair though, it’s impossible to tell whether Java itself has much to do with it or if there is more improvement possible in CLion’s codebase alone.

When opening my Ludum Dare project and just letting CLion sit there, the memory allocation idles at around 1000-1200 MiB. I assume most of it is used for source code meta information to make auto-completion or similar things faster. However Synth Guitar only uses SFML as library, which makes me wonder how the memory allocation scales for larger projects with a lot of different libraries. Personally it doesn’t seem like a big issue, after all there’s plenty of free RAM and it certainly is a better alternative to keep that data in memory compared to Visual Studio’s huge IntelliSense database files.

Something that got a bit of an issue during my Ludum Dare live stream, was the CPU usage of CLion. It’s nice to see CLion using no CPU time at all, when doing nothing, but it gets quite scary when you look at it while writing code. It will jump all over the place starting off at around 30% total CPU allocation and when you start compiling something it actually maxed out my CPU. If you do CPU-heavy things like encoding live stream video and audio data at the same time, such a high CPU load can become a bit of a problem. Again it’s just a speculation, but I’d claim that optimized C++ code instead of Java code, would reduce the CPU usage for the general editing part quite a bit.

Synth

Refactoring

Having worked with CLion for only a short period of time, it’s kind of hard to talk about features, since I have yet to discover most of them and put them to use. But since we’re talking about JetBrains here, I think the most talked about feature is their refactoring tool. I’m very used to manually refactoring everything and as such will first need to get used to the option of having code changed automatically, as well as learn what the tool can actually do. Something that I tried to do was rename my copy of a class, but apparently that’s still a missing feature. It might have been just my lack of knowledge, but using the refactoring tool with the Vim-Emulator seemed to cause some trouble.

Conclusion

CLion is a solid IDE for C++ development. You really notice the long experience JetBrains had with building code editors and yet they still managed to keep up to date with the “latest tech” (Git, CMake, MinGW-w64, etc.). I really hope that performance will improve a bit and am sure that some of these early bugs and missing features will get fixed over the next few months. I wish the developers of Code::Blocks and similar IDE would take a look at the look and feel of CLion and try to aim for that as well. Especially Code::Blocks seems to not have improved noticeable over the past years, which is quite a shame.

Everyone who works a lot with CMake should really give CLion a shot. I already started another project with CLion, so who knows maybe Code::Blocks will slowly drift into the “unused” section of my PC?

As a final note: JetBrains has in the meantime released version 1.0.1.

Ludum Dare Compo #32

Ever since 2012 when I kind of first discovered Ludum Dare, I wanted to fully participate in one of the compo, but for the past two years the dates usually clashed with some other event of mine. However in similar fashion I participated twice in the SFML Game Jam, of which the upcoming 4th as just been announced. Last weekend the timing was finally perfect and I managed to properly participate in the Ludum Dare Compo #32.

Synth Guitar

► VOTE ► Ludum Dare entry ◄ VOTE ◄
GitHub repository
Windows & Linux downloads

MenuState
The goal of the game is get from the start position to the nice looking platform as fast as possible while using sounds to open the doors inbetween. Ah and did I mention that you are some kind of a Synth Guitar?

Synth Guitar

You get points for opening doors and finishing a level, also your score decreases for every step you make and for every wrong button you press but you’ll never go below zero.

PlayState

My Setup

Although I’ve written about this already on the Ludum Dare “blog” I still like to share things here again. My workspace was essentially just my newly built PC, my rather bad but comfortable Logitech MK710 keyboard, my ROCCAT Kone XTD mouse and my two monitors. The notebook you see on the image below was used to provide a webcam stream on the second day.

Workspace

As for the software involved: The OS is obviously Windows 8.1, which I’ve been using for many years now without any issues. Since I was using C++ my choice of compiler was a no-brainer as well i.e. MinGW-w64 POSIX Dwarf2 GCC 4.9.2 (x86), but for the IDE I switched things a bit and tried the just released JetBrains CLion v1.0. Since the software is rather new and I’ve been asked by someone on Twitter, I’ll do a more detailed post just on CLion later on. One of the best features of CLion is the native integration of CMake, so instead of having some awkward project file to deal with, I can just write CMake “code” and compile it that way.

Coding wise I used – who would’ve thought – SFML for nearly everything, but also added Thor with its very nice ResourceHolder that got added just a few days ago. For my animation and level files I used JSON to write them and found this awesome header-only json library by nlohmann – it’s seriously easy to use! As starting point I used my SmallGameFramework that I still have to fix up and push to GitHub…

Moving on from basics and programming, also for the first time I’ve an older and thus free version of Aseprite for my pixel “art” and animations. First I just wanted to do some pixel images but once I noticed the animation features in Aseprite, I just had to make use of it and it was really simple. In addition to that I also used my go-to image editor PhotoFiltre 7 which is essentially nothing special but I really like the interface and it opens with a second or two, which is perfect for doing quick edits on things. Also in the image “processing” business I might mention ShareX, which is the most awesome tool ever. It allows me to take screenshots that get automatically uploaded to imgur. It’s free, goes out of my way and works reliable.

For the audio bits I used the Diatonic Composer to generate some classical sounding MIDI file. Then I fed the MIDI file into sforzando a free soundfont player while utilizing the soundfont Evanessence2. I really hope to get a slightly better setup at one point, because the generator as well as the soundfont player are rather limited. The sounds you hear for the wave forms in-game are actually generated on the spot.

And the last part is about streaming. On Saturday and on Sunday I was streaming over 12h each (see here and here) and for that I used the unbeatable Open Broadcaster Software. And since I wanted to use the webcam from my notebook, I setup a Monaserver, broadcasted the webcam feed through the LAN to my desktop PC, played it back with VLC and then captured it again with OBS. It was not pretty but it did the job even if the delay was way too high.

Conclusion

Having a somewhat finished framework ready to go really help a lot in the development since I could immediately jump in and didn’t have to bother with a lot of the boilerplate code. I really hope to get this small framework a bit expanded so things will end up even easier and less hack-ish to code, because while writing a framework you can take your time to design things properly, I did not have that time during the Compo which ended up in a lot of code repetition.

While nobody will watch someone code or sit around for hours on end, I still like to stream stuff, because it kind of forces me to keep working on it and not start some video game or randomly browse the internet. In addition to that it gives some nice conversations from time to time and you feel less as a solo developer. I just hope to get a better solution for the webcam, since I feel webcams make streams a lot more interesting.

It took a lot of time, but in the end it was really nice to have something finished and ready to be voted on.

SFML 2.2 Released!

I’ve gotten rather quiet here on this blog, but I’d say it’s a good sign, because that way I could spend more time on helping get SFML where it is now. After nearly one and a half years SFML has finally reached version 2.2!

SFML

A lot in the SFML source code has changed, though I think the biggest change is not the source itself, but that SFML is now managed by the SFML Team and that with the team new guidelines had to be set in place. Laurent has maintained SFML for a long time alone with help from the community and Marco (aka Hirua) for the OS X parts, but with real life getting more and more time consuming the development slowly but steadily stagnated. Realizing that development was nearly at a stop, he placed Jan (aka Nexus or Bromeon) in charge. This worked relatively well, but the main issue wasn’t solved: SFML is a rather complex project by now and with so more and more users willing to use it, it becomes rather impossible for one person to do all the work, discussing on the forum, writing code for all modules, organizing issues, updating the website, etc. and with such a workload it becomes easy to deny many feature request and keep things as easy as possible. After I had started a discussion on Rethinking the definition of “Simple” we could clear many things and the solution was the birth of the SFML Team.

We all would’ve loved to release SFML 2.2 as fast as possible, but there were just too many issues piled up to go and release a new version, while a lot was still broken. We first wanted to implement multiple features, but then decided to focus on just the Window Focus feature and fixing many other issues. After 177 closed issues the 2.2 milestone has been closed the source code has been tagged. This can essentially be seen as the release, however for many you can only call it a full release if you also provide binaries and as of today, they are online:

» SFML Downloads

The website now also features Contribution Guidelines, a Code Style Guide, explanation on our new Git Workflow, the full Changelog with nice links to all the issues and nearly the most important page Frequently Asked Questions. The FAQ page already holds answers to many, many, many of the common problems which can arise with SFML and we as a team believe that it will reduce the amount of redundant questions and help all the new users advance faster. Next to these new pages we also added a button to the now official SFML IRC channel on irc.boxbox.org and made a lot of changes to the website in general.

With the Holidays coming up soon, there probably will be not that much development happening, but we already have a possible roadmap setup for SFML 2.3 and this time, we’ll make sure it won’t take as long anymore. Stay tuned and Happy Holidays!

How to use MinGW-w64 with CLion

Update 29.09.2014: As pointed out by Anastasia Kazakova in the comments, CLion’s EAP has received an update which added native support for MinGW-w64!

In the past few days, I’ve seen CLion mentioned on multiple locations including the SFML forum. CLion is a new IDE developed by JetBrains for CMake based projects, it supports multiple languages and can be further extended with plugins. Some might recognize the interface since it’s very similar to JetBrains’ popular Java editor IntelliJ IDEA.

CLion

Personally I haven’t really looked at the IDE in-depth, since JetBrains is the creator of the allegedly awesome ReSharper tool for Visual Studio – which I’ve never used – the IDE itself should provide some pretty decent refactoring capabilities. Last I checked out Qt Creator, I was a bit disappointed at the sluggish CMake integration; this at least seems to work a lot better with CLion. However maybe Qt Creator upped their game since then as well.

This post however shouldn’t really be about introducing/promoting CLion and maybe some or many of you who somehow find this post already know what CLion is, instead this should actually be a short tutorial on how to use a compiler of the MinGW-w64 family with CLion.

Tricking CLion

For whatever reasons the developers at CLion apparently didn’t get the memo, that the original MinGW has been relatively abandoned and most of the user base has moved on to the MinGW-w64 project, which originally was created to develop a 64-bit compiler, but now supports both architectures. As such CLion currently only officially supports the vanilla MinGW. As a MinGW user for many years, the fact that CLion only wanted to recognize the original MinGW as compiler seemed rather odd, since the differences in using either a MinGW or a MinGW-w64 version nearly doesn’t exist. When I ran ProcMon and tracked what in the filesystem CLion accessed, I noticed that it checks for the existence of include/_mingw.h. By providing such a file in your MinGW-w64 directory structure you can trick the compiler into accepting it as MinGW compiler.

How To

Here are the few steps to make it work:

  1. Get your MinGW-w64 compiler installed somewhere.
  2. Create a file with the path [MinGW-w64 dir]/include/_mingw.h and the content shown below.
  3. Point CLion to your [MinGW-w64 dir] and watch how CLion recognizes your MinGW setup.

_mingw.h

#ifndef __MINGW_H

#define __MINGW_H

#define __MINGW32_VERSION           3.20
#define __MINGW32_MAJOR_VERSION     3
#define __MINGW32_MINOR_VERSION     20
#define __MINGW32_PATCHLEVEL        0

#endif /* __MINGW_H */

Disclaimer: CLion is still in an Early Access Program and may change any day. This trick worked for me, but there’s still a chance that it might not work for you.

To end this write up, here’s the introduction video from JetBrains on CLion – it was posted on their blog.

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)”

Guest Post: The origin of Daeva Theory Studios

Many of you will know Artur Moreira, who’s a Protuguese game developer and also goes by the nickname Grimshaw on the SFML forum and other places. He recently released his first game through is newly founded indie company Daeva Theory Studios (former www.daevatheory.com) and since he’s a good friend of mine, I thought it would be nice to hear his story on the development process. Without further ado here goes the first guest post on this blog:

Hello! My name is Artur Moreira. I am the founder of Daeva Theory Studios, a startup games company which is already established with a published game, but is still trying to find its place in the world.

Our first game, Terra: Rise of Mankind, was an attempt to explore a mix of genres, in a rather experimental perspective of the world. This is a 2D game where you take control of a planet, being able to build structures, space ships and use them to combat in space battles! The game is quite unique, so it was very hard to get it right, even though I think it has its flaws. It feels like an RPG in some ways because you need to level up by obtaining experience, which unlocks new things to make you stronger or richer. The space ships also evolve as they gain experience, becoming stronger. However, I think the game feels even more like a real time strategy game, because of the way you move your ships and fight the battles.

Android app on Google Play

In sum, this was a vision of a game I had and started improving on it over time. Had I not been so naïve in the beginning, it would have probably turned out a way better game. There was a bad planning in the start, some bad designs which eventually had to be removed and replaced and overall productivity faults along the road. I guess this is normal for someone still beginning, creating his first commercial game, so I just learned my lessons and kept going in the direction of better games. Either way, I thought someone else could benefit from knowing on what I failed and what I’d do differently.

Now that we published our first game and can now be called an independent games company, I wanted to share our experience up until this point, as well as the conclusions we made through development. It would be great if any of my tips could favor you and help your life in some way.

And here goes the first tip:

Continue Reading “Guest Post: The origin of Daeva Theory Studios”

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!