Showing posts with label platform games. Show all posts
Showing posts with label platform games. Show all posts

Saturday, 5 May 2012

Swift slope movement in platform games...

Introduction:

This is the first useful tutorial in the series of Jumbo Platform Tutorial.. Evolve from a noob to pro .
I have selected one of the topics marked Very Advanced to prove that this blog isn't just all about bragging,
So, let's start the real thingy ...

What is this all about and why is it marked 'very advanced'?

 

Ok, let's start with a image...

A screenshot from my example game at Game design Practical .. Part1


See those green shining things - yup, those are slopes ... you got it right...
Actually, it shows two types of slopes to be technical...

1. Steps (marked 1 in violet)


[ Many would suggest that the idea of steps and slopes are not identical in terms of physics ... 
That is undoubtedly true..
But when you look at a game, they both serve the same purpose ..
 Move vertically and horizontally at the same time...

 So, in terms of our game world, both can be handled similarly even though slopes are not continuous..]

2. Inclined planes(marked 2 in yellow)


[Slopes, as you know them...]

 [Just to add, straight and sloped surfaces are not distinguished in my approach..
 So, plane surface also fall in this category...]

Clearly, you knew about slopes, but I just revised them to make sure we are on the same page ....

Now, about being hard and marked 'Very advanced' .....

First of all, its better to know how I mark the hardness level of every tutorial..
The ones marked in Red are those which haunted me for about a week
and I spend hours achieving those results with little or no success at all.... 


So, these are like the special ones for me....

One of them is this one...


 Though I believe that it is quite possible for others to achieve this results within hours and with a different approach, I can guarantee can you one thing...


All these approaches are self-thought, original
and hence it is highly probable that it will never match with any other approach of the same problem you have ever known ...

So, it is suggested that you go through the Theoretical Approach section even
 if you already know how to solve this problem ...

Theoretical Approach



It is quite hard to explain it without this edited version of the previous image ..

Note: All the X-axis and Y-axis referred here considers the image displayed above to be in the first quadrant.. This is not similar to the representation of  x-position and y-position in Gamemaker where every object is considered to be in the 4th quadrant..

So, now my approach is:
For. eg. when right key is pressed:
Check the height of the slope in the next x-position you want the player to move, when the motion is possible ...

The checking should be done in this order ->

Start checking from a y-position somewhat below the current y-position of the player whether it is collision-free when the player sprite is placed at that point.

(this 'somewhat' value should be about 5 times the height of the slope sprite)

and continue checking vertically upright (for eg. bottom to top along the blue line in this pic)

until you are equally 'somewhat' above the y-position of the player...
If any check returns true ,

instantly snap the player to that position

and stop the loop..

I have tried to put up a pseudo-code representation here with the concept of maximum slope:


1.Max_Slope=Define the maximum slope that  the player will be able to move up along (0 to 90 degrees)
2.Max_Hor=Define the number of horizontal units that the player moves in each step (Usually, 5 is a good value in GM)
3.Height=Using any loop find the height  in next adjoining area
 (specifically the height of the (x+Max_Hor) position where it is collision-free when a player sprite is placed at that position [where x is the x-position of the player]...
 the place_meeting function of Gamemaker can be used)
(It can be negative or positive)
4. Find  Slope_obtained=Height/Max_Hor
5. If Slope_obtained<Max_Slope, move the player to (Max_Hor, Height) relative to the player's current position...

Example game:

I've avoided the maximum slope concept in the example game to keep it simple...
Controls: Use right and left arrow keys for movement..

If it appears a bit complicated, read it again slowly and try to understand it...


If still some of the discussions appear unclear to you, feel free to comment... I'm there to help you...


 


Friday, 4 May 2012

Jumbo Platform tutorial.... Evolve from a noob to a pro

Everything you'll ever need to know to make a cool platformer

Introduction:

So, you have decided to make a good platform game? Well, why not make it great!
You have probably heard that platform games are the easiest genre of games to make and it is undoubtedly quite true. Though this blog is inclined towards the "Gamemaker" software, and all the experience I gathered is from the GMC forum, all the discussions (except the GM-specific programming) here is applicable towards game design as a whole....
So, lets turn our head towards platform games again..
The first platform game I remember playing is Dave, though others may relate themselves with  Mario...
But the truth is that inspite of being the most ancient genres in the history of gaming, they remain one of the most discussed genre in every game design forum. This is probably because they still remain the ABC of game design ..... Every game designer starts his journey learning the basics of game programming and design .. and what's better than a classic platformer ??? Every game design forum (and specifically the GMC forum ) is full with "How to"  questions on platform games ...
A typical question starts like ->
" I am a noob in GM forum. I started making a platformer a few days back and now I'm stuck in a problem.
 PLEASE HELP ME ...
*The problem goes below*  "
So, does it prove that platform games are very tough?
No, it just proves that everyone typically starts with a platformer and they need a bit more help to evolve as a better game designer. Most of these so-called "newbies" starts  googling "Platform Game Tutorial" and no doubt, there exists a lot of good ones... But the problem surfaces when these tutorials end and they suggest you to try some advanced concepts like knock-back, springs, water physics, AI enemies or even slope movements..
Most of the noobs can understand what they have learned till now,
but these new things appear alien to them .....
They try to use real physics laws, which are impractical in this case.. So, I'll try to streamline this self-learning process for the future ones and tell them which tweaks are important for a good game..
Every advanced concept of platformer-cum-fighting game that I can think of will be present in my Blog.
Head over to the To Do list to see what will be added next.

Head over to the Available Tutorial list to see which tutorials have been added.

So where do I start?

Let me suggest you this tutorial page: Tutorials by Mark Overmars
1.You should read the first tutorial  there to get a good idea of what a good game is and how to make sure yours is too.
2.You may read the second and third tutorial if you are not adept with the basics of a game.
3. You must read the platform game tutorial before you continue reading this. This tutorial covers the basics of a platform game in general, and also tells you about its programming aspect in Game Maker 8.
*If the links are ever down, inform me. I have them safe in my hard disk*
This blog post can be considered a direct continuation of this tutorial.
Every advanced topic that is listed at the end for the reader to try out will be present here, but that is not all.
Read the To Do list and Available tutorial list to see what they are.
I can assure you even a Pro in game maker will find something of his interest in those list.

To Do List

All this topics will be added as tutorials very soon...
Technically, 1 (or, sometimes even more) every day....
 Use Atom Feed at the top-right or bottom of the page to stay updated...
And rest assured you'll never miss one..
*Technical information about the Atom feed*
{
 Atom feed on the top-right -> Feedburner feed
Atom feed on the bottom -> Blogger feed
Choose the one which suits you... 
And if you'll like a RSS feed, tell me through the comment section...
}
1.AI enemy
(Can be very easy, as well as very complex.. But the one here is mediocre... After all, AI is a vast topic)
2.Spring (Can be used as trampoline similarly)
3.Moving platforms
(To quote Mark Overmars, the creator of Game Maker ->"this is not easy!"
But, personally I think, it wasn't that hard either.. Atleast it was a lot easier than the next one...)
4.Water physics
(I hate to break the truth.. This isn't fluid simulation... But it's better than the water used in the "Bounce" game, commonly found in Nokia mobile phones... This one really wasn't easy to come up with...)
5.Advanced push-back function 
 (This one isn't really as simple as it appears. For eg. even if 2 objects undergo oblique collision in the air, this push-back will work perfectly. Also, this is achieved through an external update function. Just for your info, all the in-built variables of any instance in game maker are updated through an internal updated function.. This is one of my favourite..)
6. Double jump and run
(Maybe only beginners will need it...Commonly asked question on GMC forum)
7.Awesome Dragon-ball style projectile..
(Similar effect as energy balls in Dragon Ball Z(DBZ), if you know what I mean.. It looks very cool...)
8.Swift slope movement
9. *Your request here*

Colour coding-> Red -Very advanced  Blue -Bit advanced Green -Quite easy
Also, you can request anything related to platform games here and if it's good enough, it'll be listed here alongwith your name and ofcourse, an awesome solution...
If you know about a really advanced topic (not only platform games) and how to implement in Game Maker, tell me about it. If it's hard enough (I'll take a 2-day time about learn about it and if I can't find any solution), you can be a prestigious co-writer or guest writer in this blog ....

Available tutorials

1. Swift slope movement

(This is a very popular question in GMC forum ... How can I make the player move swiftly up and down along a slope?? ... The solution will work like a breeze ... Move smoothly along any rough slopes or planes)
2.(To be added soon...) 

One  topic will be discussed from the TO DO List every day..
You can request a topic from this list to be discussed soon by posting the name of the topic and a +1.
For e.g. Double jump and Run +1.
Your vote for a topic counts.. The one with the highest vote is discussed first....
If a topic lingers in the To Do list for more than 10 days, it'll be discussed as a special extra blog on the 11th day, in addition to the one Voted favourite....In this way, there won't be any backlog...