![]() | |
PC Games
• Orb Tutorials
• 2D shoot 'em up Latest Updates
SDL2 Versus game tutorial
Download keys for SDL2 tutorials on itch.io
The Legend of Edgar 1.37
SDL2 Santa game tutorial 🎅
SDL2 Shooter 3 tutorial
Tags • android (3) • battle-for-the-solar-system (10) • blob-wars (10) • brexit (1) • code (6) • edgar (9) • games (43) • lasagne-monsters (1) • making-of (5) • match3 (1) • numberblocksonline (1) • orb (2) • site (1) • tanx (4) • three-guys (3) • three-guys-apocalypse (3) • tutorials (17) • water-closet (4) Books ![]() The Attribute of the Strong (Battle for the Solar System, #3) The Pandoran War is nearing its end... and the Senate's Mistake have all but won. Leaving a galaxy in ruin behind them, they set their sights on Sol and prepare to finish their twelve year Mission. All seems lost. But in the final forty-eight hours, while hunting for the elusive Zackaria, the White Knights make a discovery in the former Mitikas Empire that could herald one last chance at victory. |
![]() The Legend of EdgarThe Making OfHistory ● SDL tutorials ● Starting out ● Entities ● Sprites and animation ● Maps ● The map editor ● Scripting ● Gameplay ● Controls ● Enemies ● 1st release ● Bosses ● Two quests ● Graphics, music and sound effects ● Medals ● Internationalization ● Bugs ● The good ● The bad ● Conclusion ● Statistics ![]() History
I'd always wanted to write a 2D platforming game, and initially it was going to involve a knight entering a castle, to rescue a princess. Pretty standard stuff. I was going to have features like being able to drink potions to give him wings and fly for short periods of time, but this was just something I thought about, and never actually committed anything to paper. SDL tutorials
After completing Blob And Conquer, Stephen stopped making games to pursue other interests. I decided to add some tutorials to the Parallel Realities pages to give people who were just starting out making games a bit of a leg up. They started out as very simple things, such as opening a window, displaying an image and playing a sound. I then added more tutorials to demonstrate moving a sprite around, firing bullets and dealing with collision detection, so someone could make a simple space shooter. I then did a tutorial on tile-based collision detection, essentially allowing someone to develop a platform game. Starting out
I had a fairly good idea about what the game would be about and that the player should be able to return to previous maps, rather than treating them as separate levels that the player would progress through. Allowing the player to wield different weapons would allow for some weapon-based puzzles and also increase variety. An inventory system would therefore be needed. I went out and bought a notepad so I could jot down ideas as I came up with them, as well as sketching out what enemies should look like and design the maps. Sometimes I'd come up with an idea when I was out or at work so I'd either note it down in my phone or email it to myself, because otherwise I'd have forgotten about it by the time I got home. This only happened a couple of times but fortunately something else jogged my memory a couple of days later. Entities
I treated everything in the game (enemies, items, weapons) as an entity, with a field denoting what its type was. Furthermore, every entity had a name which was used to determine what properties file to load up. Certain entities, such as keys and doors, also had additional information stored so that the player could identify what they were or what they required. For example, a door might require a item in the player's inventory called "Forest Cell Key". Sprites and animation
The first problem I encountered with writing the game was dealing with loading sprites and animation. Initially, I had a text file for each entity's sprites, which listed the sprite's filename and its id. I could then reference the sprite's id in the entity's animation file. The sprite file would contain: Maps
The size of the maps in the game were hard-coded, since they were just massive arrays. This worked out OK to start with but before the first release I realized that the map size was too small. I increased the size and ended up making them bigger than they actually needed to be, but this was OK since having wasted space was better than having to go back and increase the map sizes halfway through the project. The map editor
When I first started out, I just used a text editor to place a few tiles into a file and added Edgar and a chicken (more on these later). When I was satisfied that it all loaded up OK it was time to make an editor, to allow me to place tiles and entities more easily. I put together a very simple editor that allowed me to toggle between placing a tile and placing an entity. I then added small features such as filling in an entire row with tiles and snapping an entity to the grid, rather than being able to place it freely. Once I'd placed all the tiles and entities I'd go into a text editor and adjust the data. Scripting
Scripting was possibly one of my most favourite parts of the game to code. It allowed me to make the characters walk around, talk, give the player objectives to complete, and so much more. As an example, here is the script run when Edgar encounters one of the hidden bosses, Azriel: Gameplay
One of the trickiest parts of the game was keeping it fresh. There are 26 maps in the game, so making sure that the player didn't start experiencing déjà vu, I had to come up with something unique about each map (or at least a couple of new enemies). For example, in the Laboratory I came up with the idea that the player could drink a potion which would turn Edgar into a monster that could swim through water. The Left Tower contained no enemies at all, but had some memory puzzles involving teleporters or endless corridors (if the player chose the wrong path they'd simply be warped back to the start, giving them the illusion that they were walking forever). Controls
Right from the start of the project I knew I wanted the game to have joystick support and configurable controls. I already had a PS2 joypad for playing MAME and I wanted didn't want to be hunched over a keyboard playing the game (with keys that I couldn't configure). Adding support was pretty straightforward and well received by players who appreciated being able to modify the controls to their own liking. Enemies
I didn't want Edgar to be the sort of game that featured just 4 base enemies, simply colour swapped or tweaked for appearances later in on. I therefore did some brainstorming with my notepad and came out with as many unique enemy types as I could think of. Here are a few of my favourites: 1st release
After a few months of writing the game, it was in a state that I could release a version to the public. Version 0.10 only had a couple of maps, and only one save slot. The response wasn't great, with much of the criticism being levied at Edgar's walking speed and having to catch ten chickens in such a massive map (the Village map was about twice the size that it is now). The blandness of the maps didn't help things, but that was something I was able to improve at a later date. Bosses
I decided I wanted to not only have regular bosses in the game, but secret ones, too. The first secret boss I created was basically just the Red Grub with a lot more energy and a couple of different attacks. The advantages to defeating the secret bosses was that the player could increase their hit points and, in some cases, obtain an item towards the optional quest. Two quests
A few months into the development I decided to add an optional quest to the game. The main quest in the game involves Edgar setting out to rescue his father, but an additional quest would involve Edgar seeking out and defeating an ancient dragon known as Chaos, who had been bound and imprisoned beneath the sorcerer's fortress. Chaos had been defeated, but not killed, by a warrior known as Ivan, who had long since passed away. Upon reading that Chaos has been slowly recovering his power and will soon be free, Edgar decides to subdue the creature once more. Finding Chaos isn't too difficult, but actually being able to survive his breath requires the player to create a special shield, by collecting a number of items. The tricky part comes from the fact that after certain events in the game, the required items are no longer available. Graphics, music and sound effects
My first attempt at drawing Edgar was quite poor. I'd never tried to draw anything properly before, so it turned out to be quite a challenge. After a while I looked at some old arcade games, to see if I could copy the style. My next attempt worked out better and the result is what you see in the game now. My ability to draw did improve as I continued to develop the game, although some of the graphics really do need some work (the Phoenix in particular could do with re-drawing). For the sound effects, I looked mostly on FindSounds, before moving onto FreeSounds. Again, finding a suitable sound effect is quite a task and I didn't simply want to stuff in any old effect just for the sake of it. Medals
Much like the Xbox's Achievements and the PS3's Trophies, I decided to add in medals, which the player could earn by performing different tasks in the game. There are 54 medals in the game, a fair few of them being hidden from the player, as they are story related. Many people decry Achievements and Trophies, saying that people only play games to earn them, but I think they add great replayability to a game. Internationalization
In an effort to make the game available to as many people as possible, I added support for Gettext. This all worked out fine on Linux, but when I tried it out on Windows, I discovered that some languages displayed garbage. After trying a lot of different DLLs, I noticed that Frogatto had support for Russian, which was one of the languages that was corrupting in Edgar. I delved into Frogatto's source code and noticed that it was using its own implementation of Gettext. I contacted the developers and they helpfully explained that it was to avoid the very same issues that I was experiencing. Once I coded an implementation of my own, the problems went away. Bugs
Of all the bugs that reared their ugly heads in the game, the worst had to be the map resetting bug. What would happen is that, after the player escaped from the Catacombs (a map where the player had very limited vision), the Fortress had reset itself, causing the player to end up getting trapped in the Catacombs again. I never encountered the bug myself, but numerous players reported it. I added reams of code to try and detect the bug and ran the game for hours at a time, making it randomly change levels, save the game, reload the game, but nothing reproduced the problem. The good
I'm pleased that I achieved so much and saw this project right through to the end. It's been a great way to stretch my imagination and watch the game evolve over time. I hope it's something I can look back on in a few years and be proud of. The game is a standalone story and I have no plans to ever write a sequel (though even if I did it wouldn't feature Edgar). The bad
The game didn't work out exactly the way I wanted it to and it isn't especially popular, but I'm not too bothered about that part. There are a few bugs in the game that are slightly annoying, but don't detract from the gameplay so I may leave them as they are. Some of the feedback I received wasn't exactly encouraging and some of it is even slightly disturbing. I guess I know what it's like to have a stalker now... Conclusion
The Legend of Edgar has been a great experience and I hope you've enjoyed playing it as much as I've enjoyed making it. 2.5 years is a very long time to spend on anything and I probably won't make anything on this scale again. In an environment where you cannot move for endless First Person Shooters, I wish there were more 2D platformers like Edgar. Statistics
Development time: 2.5 years |