• Avoid - Slideshow

  • WC - Slideshow
  • Steering - Slideshow

  • WE SlideShow

  • PI - Slideshow

  • DOOM - Slideshow

  • TSOI - Slideshow

  • WS - Slideshow

TestGame

I’m currently working on a little game to keep my skills at a good level during my job / internship hunt. It’s nothing fancy, especially from the graphic point of view since I’m the one doing the sprites.

My initial idea was to make kind of a Ghouls and Ghosts. I plan to also add some rogue-like features but it is still to be determinated.

I try to work a fair amount of hours each weeks on this among the other activities that I do and it’s quite effective so far.

There is a thing to take in consideration while reading this page, I started writing on the project a little while after starting it so the first explanations in the beginning of the page will mostly be written, no screenshots. Also, the first three steps have been created simultaneously since they’re all prior to the date of creation of this page.

 

Step 1 : Starting the project

At the beginning of this project, I wanted to provide some kind of demonstration of my SFML framework as well as simply use it for the pleasure of making a game out of it. 

At the time I already had in mind to make a ghouls and ghosts like but as we will see in later updates the style of the game has changed a bit even if its base is still the same.

I started by making the main character's movements, having a good start on that would help me to go further next, and it worked well.


I also made my first animations :



Surely, they're not the best ones but at least they're mine ! If it goes to a bigger game maybe I'll update these and create better ones.
The walking animation was a bit tricky but the fact that my character is fully white help me a lot since I don't have to deal with which arm goes where. I decided to analyse an animation I saw in a video a few days before (thanks TomSka) and recreate it as good as possible.

Making the character jump gave me a bit of a hard time because, suprisingly enough for someone who studied video game developping, I never made that before out of engines where it has already been done like Unity or Unreal Engine. If you look at my other projects, no one jumps because it has never been requested. I didn't want to just make the character position go up by increasing its Y location manually (which would have resulted  in a triangular type of shape for the jump), so I chose to use a sinus since it has the right shape and is quite easy to use.

Beside some states transitions, the jump was the only real obstacle that stood before me regarding the movements.

Step 2 : Creating the weapon system

Even if "weapon system" is a bit of a big word for what it currently is, I had to figure something out nonetheless. I created a main (abstract) class Weapon from which all the ones I will use later will inheritate so I can use the same functions in them, an occasion to apply the polymorphism I practiced at school.

Dagger
My first weapon is a dagger, I haven't figured out what makes it unique but since the character can kind of throw them all around nearly as often as he likes, I think it's gonna stay that way. It will be a rapid fire weapon with little damages, at least it's like that in my head for now.

Creating this weapon showed me a little problem, the throwing animation lasted too long, the weapon was thrown at the end of it and there was too much latency between the input and the action. I shortened the animation which is now maybe a little less visible but the overall gameplay is better.

I will certainly add more weapons later but I just wanted to make it work and do some other things before that.

Step 3 : The environment

Until that moment, my character was moving into nothingness, so I decided to add some scenery around him and the idea of assembling predetermined patterns to create a world came to me. I had the same system as The Binding Of Isaac in mind, the shapes of the rooms are predetermined but not the floors, which are the addition of multiple rooms. My game is an addition of multiple sections with shapes that I created but the order in which they come out is not for anyone to decide. It also allows the game to continue forever and I don't have to create entire levels from my mind, it was the first "rogue-like" idea that went to me among others later.

Before choosing from hundred of designs for my sections, I created the first one just to try my idea.

I first created a text file with numbers in it : 
Section pattern
0 being empty spots and 1, the ground.

Then, I created a class that reads that file and fills a sprite array where the ground tiles should be. The first section of my game was born ! I made a Level Manager containing three sections which were going to move one behind the other to create a scrolling, it worked pretty well and pretty quick, so I continued to my main idea and created another class named Pattern which contains an array of char filled with the zeros and ones and also the height of the first and the last tile for junction purposes (the next section can't be too high from the previous one or the character will not be able to continue).

I finally set in motion my idea : the Level Manager reads all the section files stored in a specific directory and creates the same number of pattern in a list. Sections are instanciated from the manager by selecting a random (and fitting in height) pattern from that list. At the beginning of the game, three sections are created and as the character walks new ones are added behind the previous ones.

Another big development part was to make the scenery move in function of the player's inputs, when to stop the character and when could it move freely, same went for the environment. I determined a zone were the character could move and beyond it, move the scenery.

I worked it around with three zones, the character is almost always in the green one, when it's inside it, it moves and the scenery stays still. When approaching the blue zone and going to the right, the character is still in walking animation but stays on its location while the scenery moves to the left. When the character touch the red zone and goes to the left, it stops like before and the scenery goes to the right but since the sections that have passed the left border of the window are destroyed, the scenery will stop at the beginning of the current section, in that case, the character can move to the left border of the window and stops there.

The final step of the environment management was to step on the different tiles (the character was flying at the middle of the window untill then). I simply created a function that determines where the ground is under the character and if the latest is on, above or under that level. If the character is under ground level, it's raised, other wise no action is done.

Step 4 : Conclusion on the three previous steps and what's next

This is the final part done at the creation of the page, steps behind this one will not be done the same day. I will now say what remains of the previous steps, is still to be done and is going to be created in the (near or not) future.

The character teleports itself when the tiles are not on the same level instead of falling a bit or jumping. This issue is the next thing I will work on I think and I'm even going to block the character when the next tile is higher so the player will have to make a jump.

Another simple thing to do is destroying the weapons that touches a tile when moving, I don't want daggers digging in the ground !

Of course, later will come enemies and a better handling of the pattern selection for the sections creation, currently the pattern are not sorted in any way which means that they are all a potential selection even if they will never fit. I intend to maybe sort them by entry height to go faster and do fewer iterations and random calls. I also have to verify the first three section created as I can have an issue with junction on these ones.

I think that's all for now so I leave a video of the current version of the game right there .


Step 5 : Controller support and enemies

It's been a little while since the last update because I had to enhance my framework to use the controller in my games. It took me quite some time but I managed to make it work even if there are still some improvements to do.

But let's talk about the new features of the project, I resolved many bugs like the teleportation of the character and improved a bit its jump for a better transition to the falling state. I managed the destruction of the weapons when touching an enemy or the scenery.

I sorted the patterns by height in an array of pattern lists like that : 
There are 12 slots for each height and patterns will be added in each if their entry height is compatible with the index. For example in the 8th index, there will be patterns with an entry height of 7, 8 and 9. That way it isn't necessary to check if the randomly chosen pattern will fit the one before, this allow me to do fewer instructions each time I instanciate a new section, I juste have to do a random in the list for the layout.
Also in the topic of section creation, I resolved the little issue I had with the first three that could not fit sometimes.

Like I said at the beginning I added controller support to the game so the character can move with the left joystick or the Dpad and use the face buttons to jump and use weapons.

Big addition to the game, I created some enemies that are created with each new section, 3 at a time. For now they stay put where they appear and wait to detect the player in their area then proceed to pursue the player without ever stopping, they can even jump and fall to change their height in the level. The weapons can damage the enemies and kill them in which case they stand still. Enemies states transitions are possible thanks to a Finite-State Machine that we used in school on Warcreaft.

The next objectives would be to destroy the enemies when they die maybe after an animation (they are already destroyed if they're on a section that has passed the left border of the screen). Making them attack will be a good thing to do and hurting the character too. Also making the enemies walk when they do nothing would be nice so they don't stand still like billboards.

Like last time I leave you with a little progression video where we see the controller gameplay and the enemies.