Background Stuff

That’s me done A LOT more to my game framework. I’ve completely redone the Level-Editor (making it a lot easier to use), redone the background’s for Mario-style layer background scrolling, and added audio, both effects and background music.

The Level-Editor has been updates so that objects are placed from the sidebar. This means that the user can simply select the object, and place it. Once selected, an object is placed with the Left-Mouse button and deleted with the Right-Mouse button. The screen can be scrolled left and right. There’s also a maximum and minimum cap on object limits. Blocks have a minimum number of zero and a max of 2000 (more than enough for one level), while the player has a maximum and minimum of one (meaning two players cannot be placed, and the player cannot be deleted). Here’s a picture of the Level-Editor in action!



Next, I’ve been working on the background. I changed the space-theme to mountains, so I could have a layered scrolling background. The background is actually made up of four layers (including a foreground) – the Sky, clouds, mountains and trees. Each layer moves at a different speed, creating a nice feeling of depth. In addition, with the new background graphics, done by Lauren Martin (view her Tumblr here), the game actually feels a lot more professional.



For the last part, I’ve added audio into the game. Using SFML, I’ve created a Sound Manager class, which handles all audio within the game. There are two types of audio, Sound Effects and Music. Sound Effects are stored in a Buffer and can be played at any time. I’m going to limit the number of sounds that can be played to around a dozen or so, though I doubt I’ll even have this much! Music is slightly different. Instead, a file location is found, and then streamed from the location while the game’s running. This helps with performance, since loading a huge music file into a Buffer would really affect the performance of my game (something I’ve been working hard to keep at its best so it can run on my low-spec laptop).

As well as this, I’ve also updated my User Input class so it can detect whether a key is pressed or not based on a string. An example would be: if ( UserInput->keyboard( “a” ) == true ) . What I’ve done with this is changed the controls so they’re loaded in from a .txt file. I’ve also added mouse support, so players can choose whether they use keyboard or mouse to move.

At one point, I updated the WinMain() function so that my window was resizable, but the graphics looked horrible scaled to I got rid of this. In the future, I might update this so that the graphics scale properly in the x and y-axis, with a black background around the dead-space, however this isn’t very high on my priorities list.


Level Builder

For my SFML demo, I’ve managed to incorporate a few new features and tidied up the coding a lot! While the game itself hasn’t changed much since last week, the coding is substantially better and much more advanced!

I’ve updated the Rocket’s Fire Particles, so that they look a bit better. It’s essentially three types of particles – Red, Yellow, and White – which all have different lifetimes and densities. By using them, it makes the rocket look like it’s shooting fire out the back, and I’m very happy with the results. It makes the game look much more professional than just having an animated sprite of fire behind the player! Plus, by using SFML Primitives in a Vertex Array, it can render thousands of particles without the slightest dip in performance! (though there are only a couple hundred in this screenshot)



I’ve also worked on the Rendering System. I’ve created a class, Renderer, which has several groups of Pointers to Game Entities. Each group accounts for a layer onscreen. By doing this, I can set Entities to be drawn behind or in front of each other! I can set specific objects to have different depths, such one block is behind the Player and another in front.



The last major thing I’ve been working on is the Level Builder itself, or Construction Mode as I’ve taken to calling it. Entered by simply pressing a button during gameplay, here I can place, delete, or move objects around. Then, by pressing the button again, it returns to gameplay. This is the feature I’m most proud of, and has received (by far!) the most work. I’ve divided my Game Entities into three groups; Dynamic Objects (Player, Blocks), Static Objects (Backgrounds), and Particle Objects (Fire, Rocket Thrusters). I’ve only managed to implement the Level Builder to work on Dynamic Objects right now, and it can edit any Dynamic Object. By using The Console, the user can enter the name of the object, say ‘Player’, the move the player around the screen, choosing their start point! By changing the name to ‘Block’, the player can begin placing and deleting blocks without exiting the program. The data is outputted to a .txt file, which is how the objects data is stored.



Summer Project

Since finishing uni for the summer, I’ve been working on a Scrolling Shooter in C++. In just a few short weeks I’ve learned a lot, and just this morning I implemented very basic particles into the game! They look a bit rubbish now, but I plan to use them a lot more! I’ve also managed to speed up by reworking the way textures are handled.

I’ve not implemented shooting or enemies yet, but neither should be very hard! Right now I’m focusing on the basic framework and getting everything running smoothly.

There are a few problems I’ve ran into, mostly with collision detection. The maths behind collision detection, especially in 2D, isn’t too complex. What is more difficult is figuring out a way to not let it slow the whole game down to 7 FPS. I’ve got a two-fold strategy. All objects which don’t move, like Blocks, are divided into areas. The player will first test they’re in the same area as a block, then check if they’re close enough to collide, then the actual collision detection code is called to test a simple square overlap.

For the frame rate, I’ve just been using SFML sleep to limit the frame rate to (around) 60 FPS. I plan to make this much better, implementing Delta Time into it to get much smoother results.

I also need to finish my User Input class. Acting as a wrapped for SF::Keyboard and SF::Mouse, this allows me to not just tell which key is press (and when), but tell the difference between keys tapped and held. In the future I’ll update it for key releases too! Right now it also only detects Number and Letter keys, as I’ve simple not gotten round to the Control Keys.

Here are a few screenshots of the game below


Uni Over

So that is me finished my second year of university. Overall, it was difficult, especially the physics and maths, but I am proud of all the work I have done. I have gained a greater understanding of the framework behind Game Engines, learned how to manipulate Vectors and Matrices throughGLM, and learned a lot about the underlying systems of OpenGL, including the Graphics Pipeline.

The project I am most proud of is, Cityscape. Completing it taught me a lot about Game Development process, like the underlying Matrix Maths behind games, and the benefits of working in a Well-Organised Team.

For over the summer, I plan on working on three projects. One is a Gamemaker: Studio project, the other is a HTML5 game with Construct 2. I plan to release both of them before the summer is over!

For my third project, the main one, I will be working on a SFML scrolling shooter, similar to R-Type. I have been working on it a few weeks, and I have a lot of the framework done. I have States, Sprites, and Collision Detection. I have even made a background that tiles itself, based on a single image! However, what I have spent most of my time doing was creating a Level Buildermode. I have made it so you can build entire levels in game (with data outputted to a .txt file). You can place blocks using the mouse, the Left Button placing them and the Right deleting them. The blocks snap to a 32×32 grid. Here are some screenshots below:


screenshot2Yes, all the artwork is by me right now