Implementing Circular Gravity

 

Hi All

So i released this video online and received a question from youtuber anic99a asking how i achieved this cool effect. Let me begin to elaborate the demo was produced using game maker studio for rapid prototyping i’m still deciding if i should finish it up and release it as some kind of game.

The basics of the algorithm are not complected at all while the effect is very intriguing i have a player object and a planet object each planet has a mass value which determines the size and gravity pull.

In the players Step Event (Per Frame)
we loop through all the planets and apply force based on the players distance and angle to that planet

GMCode

Firstly we get the distance between the player and the planet, then we get the direction of the player relative to the planet in question.

If the distance is less than 250 (arbitrary number) then we set dx and dy (direction x, direction y) 150 pixels away from the player in the direction of the planet.

Finally we apply physics to the player in that direction. I’m cheating using Box2D to handle collisions between the player and the planet but you can implement this into any engine.

The code is a bit messy and not optimized at all but for a quick 15 minute demo it works well. You can optimize this by making a generic script to be applied to any objects to handle planet gravity.

 

The Best Tips For Game Developers

Hello All!
This is a collection of my thoughts… raw and unedited after watching this you will come out a better developer i promise. I go over how to teach yourself to think for yourself how to solve your own problems and not get stuck while your developing.

I try my hardest to explain how to free yourself from the limitations of ‘what you know’ and become a problem solving developer who can make anything.

The video is structured as follows:

My introduction and ramblings
00:00 – Greetings
01:05 – Developing Tile Consistency
03:35 – The Best Advice Ever
04:53 – How to Learn

Examples and lessons
09:00 – Breaking Down 2D Collisions
13:03 – Breaking Down Monster AI
15:50 – Breaking Down Monster AI Part 2
17:05 – Breaking Down Attack Mechanics
21:15 – My Experiences
24:00 – Judgement Calls
26:00 – Conclusions

Game Design – Pay Attention To Detail

PolishingHello everyone today i want to talk to you about attention to detail. this is the simplest technique we as developers can use to improve the quality of our games.

Lets first define what attention to detail is. According to a website attention to detail is “thorough in accomplishing a task with concern for all the areas involved, no matter how small” now everyone i want you to read this three times 😛 because its one of the things we often forget easiest.

Mario Old Vs New

So lets begin by paying attention to the details of something lets take a level from a popular game and analyze the subtle details.

I’ve attached two screenshots of Mario here one from the 90’s and one from not much has changed right? the graphics appear sharper we can attribute this to the  massive increase in resolution and content design tools and obviously there’s a lot of changes to the internal engine of this game as its now presented in 3D but fundamentally not much has changed. So what do we see here that is common to both games.

Layered Backgrounds
Vivid Color Schemes
Unobtrusive GUI Elements
Clear Indication of Direction
Foreground Elements
Reused Elements (Land masses, Goombas, Pipes and Bricks)

So these are the details that make these games visually amazing. now i want to first state that there is absolutely nothing wrong with the games i am about to show. I have just found a few indie games by some random developers on Google images im sure their games are fantastic but we will be using them for analyses purpose.

Indie Games

If we look at these games under a microscope and compare their elements to list of elements i extracted from the Mario games you’ll notice that they all lack the same things.

The backgrounds are static.
They don’t have a matching color scheme.
There is no clear indication of direction.
There’s no foreground elements.

Now i don’t mean to criticize these games at all i merely state this in the interest of improvement so what could these developers have done to improve the quality of their games.

Parallax

lets talk about the backgrounds first a lot of platform style games employ a technique called parallax scrolling for their backgrounds. take the image to the right it is composed of 5 layers each moving independently of each other at different speeds the further back the image is the slower it moves and this gives you a real sense of depth to any game that scrolls but fear not, this technique is also use able in top down games and isometric games and even 3D games check out diablo 3 to see how parallax backgrounds are used.

diablo paralax

as you can see more clearly after i outline the geometry with blue there is a background drawn in perspective with the game and placed in the background with a very slow parallax speed to give you the feeling of height over something. this also reduces the amount of geometry to be drawn to the screen by the gpu and makes diablo run buttery smooth on even lower spec pc’s.

So now lets talk about color schemes and general game tone most games all follow one theme and color scheme if you look at Mario you can see all the colors are bright and vivid but if you look at that diablo screenshot above you’ll see its a brown and yellow them indicating we are in some sort of desert city. I think the problem a lot of beginner developers and indies face is not knowing what colors work. I think i have a tool that can help you http://colorschemedesigner.com/ this is a fantastic website that i use all the time.

Zombie MarioAlso please don’t be afraid to recolor your sprites lets say we are in a post apocalyptic scenario and we are using Mario sprites recolor them to match the theme of your game. This is my interpretation of what yoshi’s house would look like in a post apocalyptic version of Mario? So if your making that game desaturate your images and make the colors slightly warmer this is not necessarily the best example as I did it in 30 seconds but it shows you the idea sprites can be matched and the tone can be changed with simple color tinting

I cant explain GUI design in a short blog post as its an entire best of its own so all I will say on that is keep it minimal, use clear fonts, and only show the user what they need to see?

mzl.vbndvzpr.320x480-75Here is the interface from one of my latest games “Just Drift” its ultra minimal, pause button on the top right, and at first the text makes no sense whatsoever but after playing the game for 30 seconds you realize instantly from top to bottom it is Score, Speed and Remaining Time

So lets spend a little bit of time talking about clear direction in your games this is more of a level design topic and i personally fall victim to this every time. not that many people know this but the coins in Mario were originally there to give the player a hint on where they should be going and why did they use coins? well apparently miyamoto stated that he was going to use fruits and other objects but it might confuse the player and make them worried of taking damage so he decided to use coins! because everybody wants more money and its abundantly clear that money is not going to cause your character any damage. It is this kind of attention to small details that helps turn a game into an icon.

And since foreground objects and reusable objects fall similarly into the section about backgrounds i will end this article with some advice for you all.

Think in great detail about your players, look at every object you add to your game and ask yourself the question why is this object here what purpose does it serve and if you cannot come up with a reasonable explanation for this then remove it or find something that fits better.

Creating Polished Games Part 2 – Cameras

Polishing

Okay guys so I’ve recorded the second in my series of polishing your games without the assistance of an artist.

In this video i talk about in game cameras. why having a camera that follows your player is not good enough and how we can make it better.

The technique i explane here is something that has been used in classic retro games for decades and it makes a static moving camera feel just a bit better by having it slow behind your character. youll notice this in old school classics platformers like mario, sonic, megaman and tonns of other classic games.

the function “Lerp” is easily ported to any language here is some pseudo code

return (start + percent*(end - start));

the function “lengthdir_x & lengthdir_y” are easily ported to any language here is some pseudo code

lengthdir_x is  len * cos(degreestoradians(direction));
lengthdir_y is -len * sin(degreestoradians(direction));

Creating Polished Games Part 1 – Sprites and Inputs

Polishing

Okay guys so I’ve recorded the first in my series of polishing your games without the assistance of an artist.

In this video i talk about re sizing sprites, anti aliasing, and linear interpolation for your input mechanisms.

Three techniques that when used correctly can help to improve the quality of your visuals, and your users input without the assistance of an artist. As you will see in my demonstration from the demo at the start compared with the demo at the end the game becomes much more fluid and natural feeling.

The function “Angle Difference” is easily ported to any language here is some pseudo code.

return ((((angle1 - angle2) mod 360) + 540) mod 360) - 180;


the function “Lerp” is easily ported to any language here is some pseudo code

return (start + percent*(end - start));