I’ve now demonstrated how to build the SFML 2.0 binaries in an IDE and also with a build utility (better). However, all my tutorials have undoubtedly been Windows centric – I discussed Microsoft Visual C++ and MinGW, after all. Well now it’s time to make that right – in this article I’m going to explain how to build the latest versions of the SFML 2.0 binaries for Ubuntu, using GCC.
Other Unix Operating Systems
With the addition of the post, I’ve covered Windows – both MinGW and MSVC – and also GCC on Ubuntu, Linux Mint, Debian or an Ubuntu variant such as Xubuntu. But what about the rest of you? What if you’re on another Unix operating system? Well, the fact is that you should still have access to GCC. This means you should be able to invoke the actual build operation with the same commands. The other software we need – CMake – should also be available for most platforms. Thus the core elements of what I demonstrate here for GCC with Ubuntu should be applicable to GCC with other Unix platforms.
The thing that you will have to bear in mind, however, is that the other terminal commands I use (such as apt-get to install software) may not be available on your system. You may have a different terminal, and different package manager which is invoked via a different command and syntax. If you want to follow this tutorial, you’ll have to translate those commands into ones appropriate for your OS. Just remember that the invocation of cmake and make should be the same in most circumstances.
Read on the for textual tutorial. I suggest that even those of you who prefer videos read this one, as we’ll be working primarily with the terminal: something which is undoubtedly easier to talk about in writing. Read more…
In this tutorial I’m going to show you how to build the SFML 2.0 binaries from the source using MinGW Make, that is the MinGW make utility.
Read on for the textual tutorial. Even if you watch the video, it’s worth a look at the text as we will be using console commands.
In this tutorial I’m going to show you how to build the SFML 2.0 binaries from the source using NMake, that is the Visual Studio make utility. Here is a Windows batch file which should build SFML for you. Of course, it’s best to read the tutorial anyway as it will introduce you to CMake and NMake – two very useful development tools.
Read on for the textual tutorial. Even if you watch the video, it’s worth a look as we will be using console commands.
This is the first of my SFML tutorials. In it I provide and explain a minimal SFML application which opens a moveable window and waits to be closed. We will build on this in each subsequent tutorial.
I’ll assume you’ve already got the SFML 2.0 binaries set up on your computer, and that you know how to create a project file in your IDE which uses SFML 2.0. If you are unsure about any of these steps, see my earlier posts, or watch some of the setup videos on my YouTube channel.
Here’s the video for this tutorial:
|Note: this tutorial is deprecated. Please take a look at one of my new ones, either for Visual C++/NMake (Windows), MinGW (Windows) or GCC/Make (Ubuntu/other Unix).|
Otherwise, I shall outline the necessary steps here, before providing a few more details where necessary.
- Download CMake from the website, or go straight to the download page.
- Download the SFML 2.0 source, unzip the file, move it to an accessible location and rename the folder.
- Create a solution file for your IDE using CMake, setting BUILD_SHARED_LIBS to TRUE.
- Take note of the value of STATIC_STD_LIBS, as you must link the C runtime to your project in the same manner as it is linked to the SFML binaries
- Open the solution file in your IDE and build SFML 2.0 in Debug and Release configuration (if your IDE supports multiple configurations).
- Repeat steps 3 & 4, with BUILD_SHARED_LIBS set to false.
- If your IDE does not support multiple configurations, repeat steps 3 – 5, setting.
- Copy and paste the resulting libraries to a better location: put them all in a lib subdirectory of your main SFML 2 directory: c:/sfml/sfml2.
So, I have previously mentioned that we’ll be making a game engine, and I have put some resource management code up as well.
Now I don’t want to get into too much detail with the engine until we’ve seen a little more of SFML, but perhaps it would be nice if I gave you a vague idea of what I’m planning.
Well the first version of my engine will contain the following components:
- input Read more…
So now what? As you may have guessed from the title, the programming library I have chosen is SFML – the Simple and Fast Media Layer. But there’s one more thing we need to sort before we get down to specifics, so you’ll just have to wait a little longer…
The fact is that we need a plan. I’ve tried making a game engine before without a big plan and it just rambles on and on. We need to decide what we want before we start. Of course we can change it later if we need to, but an initial plan will keep us in the right direction. It’ll ensure we add all the essential features, and also stop us adding to many additional features without good reason. (It may not sound like a bad idea to continuously add new little features as you’re developing the engine, but if you don’t draw a boundary somewhere, then how will you know when to stop, and move on to the next engine component?) Maybe you have just thought of a cool new effect for your physics system. But it’ll just have to wait! Planning is everything… apart from the coding, of course
Right. It’s time to ask the Leninist question. What is to be done? We know we want to make a game. But how will we go about it? Well. Before we make a game, we need the means to make it. That is, we need a game engine. This engine will provide basic features like loading pictures, sounds and animations as well as playing them and processing input. As we go, we’ll add more features, though – as I suggested above – at a controlled rate!
First we’re going to make a 2D game engine with basic graphics, sound and input. We’ll be testing it along the way and when we’re done, we’ll write a short 2D game demo to showcase our new engine. Then I hope to tweak it a bit and finally move on to some more complicated stuff. At this stage, we’ll take a breather and look back at what we’ve done. We’ll review the engine’s capabilities and make sure there isn’t anything else we want to add to existing engine components.
That done, we will want to add 3D graphics and, if we’re feeling ambitious, perhaps we could finish things off with AI and physics. Then at last, we’ll be ready to make a full game. That’s enough planning for now – we’ll talk more about this game later. The best thing about doing things this way is that when we’re done we can reuse the engine for another game! Great!
- Core game engine
- Our first (2D) game
Well as you saw above, there’s a lot more to it than that, but let’s leave our plan simple for now, eh? In my next post’s I’ll introduce our tools and then we’ll actually get to some coding. I’m going to do some sample applications and perhaps a very short (but complete) game such as noughts and crosses or battleships. Then, we can at last begin to design, implement and debug each engine component, step by step.
See you next time!
So who am I writing this for? Well. Anyone is free to take a look, but I will assume familiarity with programming, in particular programming in C++. If you’re happy with C++ then great! But don’t worry if you’re not. There’s still time to learn! There’s plenty out there: you can try the textual tutorial on cplusplus.com, or the video primer series I have put on youtube.
So. You’re happy with C++. What else will you need? Well we’ll be using and IDE (integrated development environment) an it would be best if you knew how to use it beforehand. Otherwise, my video tutorials will get you started, and further videos I might release with blog posts, may illustrate particular post specific details.
Of course, the blog is all about how to write a game engine and eventually a game, so I won’t assume any familiarity with the actual constructs involved.