One Step Forward, Two Steps Back!

Emberex

Member
I have an issue and I don't know if it's normal. I am trying my hardest to learn GameMaker and I see that I have improved, but I can not finish even a simple game idea for nothing. Every time I try to make one, I come across a key mechanic that prevents me from doing so, and I can't find it on the web. One example is how I tried to make a top down shooter. I have the player, he can shoot and move, I have the enemies who follow the player, but they stack, and I can't find how to make them stay off of each other. Is this normal to always run into these problems and not complete games?
 

kburkhart84

Firehammer Games
FrostyCat has it right. There is nothing wrong with learning off of tutorials...but you have to actually LEARN how the code you see in them works, what every single line does, etc... then, you will understand how trying to simply combine copypasted code simply doesn't work, and you will be able to code your own things based on what you have learned. There isn't any way around that except for practice and learning. The other thing to remember is to always keep things small until you are ready for bigger projects. Even something like Pac-Man is deceptively complex when you don't understand the basic code first.
 

Yal

šŸ§ *penguin noises*
GMC Elder
I usually design games around only things I know how to implement, rather than trying to do something I'm not sure whether I can do or not. Planning stuff like this out with a mix of doodling ideas on paper - screens are too distracting - and reading the manual to learn about what functions you can choose from is my favorite way to learn new stuff.

To avoid enemies stacking up on each other, here's some ideas:
  • First approach a random point near the player (use a random direction + a random length which is set in the enemy's create event), and once you're close enough to THAT point, move towards the player directly. So enemies now try to surround the player from all directions.
  • Use mp_potential_step and make the enemies avoid each other while stepping towards the player
  • In the collision event with each other, make enemies bounce away for 1 second, and while bouncing, they won't follow the player.
 

Khao

Member
Another thing I did once to avoid enemies stacking, was for them to just very slightly push each other when colliding. Like, collision event, every single step, they would be moved one pixel away from whoever they're colliding with. I swear it looks smoother than it sounds. I liked it because when I had big masses of enemies, they would look a little bit chaotic and somewhat... stretchy as a whole. When they stop moving they'll still continue pushing eachother until everyone stops colliding. It's fun because you can just tell they're trying to stack up on eachother and will slightly press into eachother while they continue moving, but as soon as they stop moving, they'll naturally come apart.

The only issue with this is that because this doesn't outright prevent stacking, it's possible for two enemies to end up in the exact same position at some point, which means that they'll both be pushed in the exact same direction constantly forever. To avoid that, just add an exception for when their Xs and Ys are in the same position and make the direction random. It'll only be random for one step, as in the next their positions will be different already and they'll just push naturally.
 

woods

Member
trying my hardest to learn GameMaker
Is this normal to always run into these problems
short answer ... yes of course its hard to learn things we dont know ;o) thats the whole point of learning.


you know how to make the enemy go somewhere..(follow the player)
adapt that code to make them NOT go somewhere (not go where other enemy is)

there are countless ways to make a thing happen.. in the past month alone ive found over 45 different ways to make my player move... and it looks exactly the same on screen... just totally different in the code.

@Khao
im imagining 1k slimes mashing into eachother trying to chase my player and they all piling up into one giant maga-slime
hahah nvr thought of having them push eachother around like that ;o)
 

HalcyonFlux

Member
Another thing I did once to avoid enemies stacking, was for them to just very slightly push each other when colliding. Like, collision event, every single step, they would be moved one pixel away from whoever they're colliding with.
This is a good idea. I always like to add "impactx/impacty" variables where the impact is equal to the velocity of the other instances colliding with the object.

I also use mp_potential, change the direction by -+45Ā°, and throw in a while loop to check for wall collisions. Presto.
 

Joe Ellis

Member
The type of problems you're talking about are really common, they're kind of when you get to intermediate level, which most people get to
after some point when they start trying to make real games.
All of these problems have solutions which experienced programmers (if they've dealt with that particular problem) know how to handle.
You just have to be prepared to learn whatever you need to know (learn how to learn)
But the intermediate stage is the hardest stage IMO, because you have to learn whatever is necessary to overcome all the problems you have, but it's also the most interesting and exciting.

You could also make ai for the enemies, their goal is to reach the player, but they will also check if the place they're about to move to each step, or a certain amount of steps in front of it has an enemy there, then if there is, they choose a spot that is randomly offset from the original planned spot, repeat this until it finds an empty spot. It shouldn't take too long for it to find one, and this is kind of quite close to how real brains work, they'll see that a spot is taken, then glance about randomly and in a stressful situation they'd normally pick the first free slot they find. You could also, to improve the intelligence of some enemies make them sum up which empty spot is best out of several ones that they find, a simple decider would be to pick which one is closest to the player. You could go further and do something that sums up which spot has the best shot at the player, etc.
 

Emberex

Member
The type of problems you're talking about are really common, they're kind of when you get to intermediate level, which most people get to
after some point when they start trying to make real games.
All of these problems have solutions which experienced programmers (if they've dealt with that particular problem) know how to handle.
You just have to be prepared to learn whatever you need to know (learn how to learn)
But the intermediate stage is the hardest stage IMO, because you have to learn whatever is necessary to overcome all the problems you have, but it's also the most interesting and exciting.

You could also make ai for the enemies, their goal is to reach the player, but they will also check if the place they're about to move to each step, or a certain amount of steps in front of it has an enemy there, then if there is, they choose a spot that is randomly offset from the original planned spot, repeat this until it finds an empty spot. It shouldn't take too long for it to find one, and this is kind of quite close to how real brains work, they'll see that a spot is taken, then glance about randomly and in a stressful situation they'd normally pick the first free slot they find. You could also, to improve the intelligence of some enemies make them sum up which empty spot is best out of several ones that they find, a simple decider would be to pick which one is closest to the player. You could go further and do something that sums up which spot has the best shot at the player, etc.
I've gotten a lot of replies and most are good and helpful. This reply seems to go a little beyond that and inspire me to put more thought into my programming. Thank you.
 

curato

Member
yeah I always like to set states for my ai like waiting searching attacking fleeing. you attacking approaching the player and you check if and enemy there and there is one you could just have them stop a moment to space them out or have them branch off one direction or maybe a ranged attack that general direction. Having all the enemies relentlessly chase you is an efficient way to kill a player but if you add a few different behaviors it can make them a little harder to predict and add depth and make it a little easier on the player at the same time. It is pretty easy to write a relentless ai enemy but to do be able to dial the difficult so player has a change to use strategy to survive is much more difficult.
 

Rob

Member
I have an issue and I don't know if it's normal. I am trying my hardest to learn GameMaker and I see that I have improved, but I can not finish even a simple game idea for nothing. Every time I try to make one, I come across a key mechanic that prevents me from doing so, and I can't find it on the web. One example is how I tried to make a top down shooter. I have the player, he can shoot and move, I have the enemies who follow the player, but they stack, and I can't find how to make them stay off of each other. Is this normal to always run into these problems and not complete games?
This is going to be like collision detection for the player, but for the enemies instead and how you're going to solve it depends on how you're doing movement at the moment.
If you have collision detection for your player then you may already have the groundwork for collision detection for your enemies.
 

otterZ

Member
Every time I try to make one, I come across a key mechanic that prevents me from doing so . . .
One idea is to change your mindset from there being a key mechanic that crashes and burns your project, to just a challenge that needs hurdling.

When I come up against a brick wall, I make a small test project to try ideas out. Such as a very simplified version of your game just using a few coloured blocks as enemies to try different approaches to stop enemies stacking. There are even plenty of ideas above to try out in a small test project.

Sometimes I get stuck for days on something, like when my game hit the 2GB ram limit and wouldn't allow me to add any more sprites to my game, entirely my own fault for not remembering that there was a limit lol. I'd promised new content to players and I couldn't even add anything. I'm still pushing through this problem by learning to externally load sprites and optimise files / texture pages etc even now and have had to re-write a lot of code. In these times it is REALLY tempting to throw the towel in, but if you are tenacious and really stubborn as in thinking 'I don't know how to do this, but I'm going to learn, because if someone else like me can do it, then I can (insert swear word here) do it too!' you can push through each barrier or even learn how to get round the barrier - even if it takes you hours, or even days.

So in a nutshell, hitting a brick wall is normal, but pushing through setbacks is where you can learn so much, and is the key to finishing projects, especially during the notorious last 10 percent of work needed before you release your game. Or when you newly release a game and there's a nasty bug that needs fixing asap.

The good news is, the more mini projects you complete and the more setbacks you push through, the less setbacks come up in the future as you've already hurdled half of them or similar ones.

That top down shooter you are making might turn out to be a gem of a game that players will love - so please don't give up on your project - use tenacity and just stubbornly push through all the barriers.
 
Top