Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1402046 Posts in 68028 Topics- by 61611 Members - Latest Member: Zoteling

August 11, 2022, 03:56:14 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Tuning GameMaker for Platformers
Pages: [1] 2
Print
Author Topic: Tuning GameMaker for Platformers  (Read 8693 times)
Brackhar
Level 0
**


I'll give you a definite maybe


View Profile WWW
« on: January 14, 2009, 02:37:56 AM »

So tomorrow I'm planning on starting work on a new platformer in GameMaker, and I was wondering if I could get some bits of advice from you guys on how to make a platforming engine in GM that "feels right".  My last two attempts always seemed a bit finicky at times, particularly when dealing with complex maneuvers like wall-jumping and such.  What have you guys found that works really well?  I'm interested in any sort of advice you might be able to provide, from whether to use move_to vs x/yspeed to how to best build levels to handle sloped surfaces.  Are any of the GM physics engines even workable with GM7? 
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #1 on: January 14, 2009, 05:21:36 PM »

First let me just say great thread man, we really need a discussion like this as there are so many ways to approach this.

OK, so the platformers I've made (yet never completed) in GM are all "precise; MEGA MAN" style, not "slippy; Mario" style.  Because of that I'll usually check for a collision, and if there isn't one simply go x+distance for horizontal moving.  I was more or less sure about all that, but then I saw ChevyRay's platform engine awhile back (you can download it from his thread in the Tutorials section) and, it being so incredibly different from my method (way more simple and robust), I lost a bit of confidence in my methods.  Anyway, I got 90% through understanding how he did it over the holidays, but I never finished, so there are a few aspects of that I'm unsure about.  I also seemed to experience slowdown occasionally, which really shouldn't have happened (I've got a good computer, and none of my engines have ever produced that feeling).  It wasn't that constant, but I did notice it, and slowdown is something I don't want anywhere near my GM games (as it gives trolls more reasons to hate on GM, which really pisses me off).

So yeah, I don't think that really answered your questions, but do check out Chevy's engine and make sure to let me know if you sense a slight occasional slowdown (I noticed it when jumping from a high altitude while moving, then landing on a sloped surface).

And anyone who knows ANYTHING about this, PLEASE post, as I'm probably about as curious as Brackhar is about this.  Plus, this would become a really good resource quite quickly.
Logged
Xion
Pixelhead
Level 10
******



View Profile WWW
« Reply #2 on: January 14, 2009, 05:26:27 PM »

[do] you sense a slight occasional slowdown[?]
yes.
Logged

The-Imp
Guest
« Reply #3 on: January 14, 2009, 05:36:42 PM »

It's all I ever try to make.
 Sad
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #4 on: January 14, 2009, 07:48:20 PM »

[do] you sense a slight occasional slowdown[?]
yes.
OK, that's good to hear; I was wondering if I was just imagining it or something.  While digging through the engine I found some for and while loops, and I think that may be what's causing it.  Either that, or else it's not really slowdown and it just has something to do with the way movement is calculated/executed.

Other than that, it's a pretty interesting/different way to set up a platform engine in GM; hopefully Chevy can fix this and keep the engine intact (I'm thinking he probably hasn't experienced it himself and doesn't know about it).
Logged
Brackhar
Level 0
**


I'll give you a definite maybe


View Profile WWW
« Reply #5 on: January 14, 2009, 08:41:37 PM »

Architekt, would you post a link to that tutorial here?
Logged
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #6 on: January 14, 2009, 08:44:59 PM »

You can check out the engine I'm using for Indie Brawl. It's geared more towards platform/fighting than pure platforming, but there's probably something there you can use. There's a lot of irrelevant code there, though (for you, at least), and it's not 100% finished.
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #7 on: January 14, 2009, 10:03:36 PM »

Here's Chevy's thread; sorry, I don't remember the exact page the download shows up on, and I really need to go to bed (it's only 7 pages long though).

Thanks a lot Nightshade; I wasn't sure whether or not that was released (and really should have just looked anyway).

Given the type of game there's probably a lot of useful stuff in there (at least in my case).  Probably won't get a good look at it until Reading Week in February though.
Logged
Brackhar
Level 0
**


I'll give you a definite maybe


View Profile WWW
« Reply #8 on: January 15, 2009, 04:25:51 AM »

You forgot to put the lionk in Architekt.  Smiley
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #9 on: January 15, 2009, 10:06:41 AM »

Yes, yes I did.  I copied but didn't paste.  Here's the exact post with the download link to make up for the mistake: http://forums.tigsource.com/index.php?topic=3142.msg88177#msg88177  Smiley

I'd say treat it as a grain of salt until we've figured out the cause of the slowdown, because I'm sure none of us want to be using an engine with that.  Hopefully though, there's a way to fix it; I'm just not sure what that would be yet.
Logged
Matt Thorson
Level 7
**

c'est la vie


View Profile WWW
« Reply #10 on: January 15, 2009, 10:38:23 AM »

Yeah, for FLaiL and Jumper Three I didn't use hspeed or vspeed.

I wrote my own movement engine (a lot easier and less impressive then it sounds), similar to Chevy's.

Here's how I do the movement.  hspd is the horizontal speed variable.
Code:
var a,c;
a = round( hspd );
c = false;
while (a != 0)
{
    if place_free( x+a, y )
    {
        x += a;
        a = 0;
    }
    else
    {
        a -= sign( a );
        c = true;
    }
}

if (c)
    event_perform( ev_other, ev_user0 );  //This event is your "horizontal collision w/ solid" event

Using a while loop is a bit of a trade-off.  I could use a for-loop and step through each pixel at a time, and stop when I hit something (I think I did this in FLaiL).  That way would technically be more complete because the player wouldn't be able to go right through thin walls or floors if they're traveling too fast.  But because this loop is happening every frame and my games run at 60 fps, I use this slightly modified method.  Basically it checks if the final target is empty and if so moves there, working its way back if it isn't.

Also, using this method the player object will always have a whole number for its x co-ordinate (since the speed is rounded before it is used).
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #11 on: January 15, 2009, 11:52:22 AM »

Cool, that's pretty similar to some of my "engines," but definitely that next level up.  I've always used that whole number thing too, as most of my engines were for very low res games, and it looks weird when pixels deviate from the grid.

A lot of that looks like Chevy's, actually, so I'm betting it's his use of for loops that causes the occasional slowdown.  His engine does 60fps too, so that's probably why.
Logged
salade
Level 4
****



View Profile
« Reply #12 on: January 15, 2009, 02:10:07 PM »

I've been playing around gamemaker for a platform game, although i'm thinking of ditching it and using it as a mockup for something done in Open GL or the like. the hardest part about platforming in gamemaker is the animation. working around the draw event and animation length was harder than it should have been. of course I was still learning how gamemaker worked.

That's pretty cool YMM. Never considered writing my own movement engine.
Logged
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #13 on: January 15, 2009, 03:09:17 PM »

For Indie Brawl, I used a movement engine similar to YMM's. I'd definately recommend going that route. You'll have much more control than you'd get from using GM's default movement and collision functions.
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #14 on: January 15, 2009, 03:48:43 PM »

Yeah, I haven't used GM's movement functions in a very long time, but I had been using some of the collision checking functions like collision_rectangle() etc.

So just out of curiosity, what is the big disadvantage to using them?  (I'm not doubting that there is one, I just don't know what it is...processing power maybe?  Degree of precision?)
Logged
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #15 on: January 15, 2009, 04:06:40 PM »

It's just more difficult to get the program to do exactly what you want. With GM's default movement functions, you could probably make a great platform engine, but it would be a lot more complicated.
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #16 on: January 15, 2009, 04:20:35 PM »

OK, I think I see what you're talking about.  YMM's and Chevy's code is a lot smaller and cleaner.

Oh, and for those interested check out Derek's new GM tutorial as it deals with views (which is pretty damn important to platformers) and has a very useful tidbit about activating and deactivating instances outside of the view.  So, for example, the enemies won't start moving until you can see them on the screen (or, even better, until you can almost see them on the screen).
Logged
Brackhar
Level 0
**


I'll give you a definite maybe


View Profile WWW
« Reply #17 on: January 15, 2009, 04:26:25 PM »

What about world generation?  Have you guys found a nice way to handle sloped surfaces, and is the best way to handle world building to use invisible bounding objects and just tile over them with pretty graphics?
Logged
___
Vice President of Marketing, Romeo Pie Software
Level 10
*


View Profile
« Reply #18 on: January 15, 2009, 04:36:13 PM »

My platforming engine in Verge does pixel by pixel movement based on the object's speed.  This is probably stupid because of all the collision checks I do before moving an object one pixel, but it seemed to work out pretty good and I was able to do slopes relatively easily.

As for the world building, this is where I feel GM falls short of what I expected.  I made 9 different solid objects and created the level with them, and then painted tiles over them.  I really wish there was a way to just mark certain tiles as solid and use them as a collision mask, but I think the objects with tiles over them is the only good way to do it.
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #19 on: January 15, 2009, 05:06:08 PM »

What about world generation?  Have you guys found a nice way to handle sloped surfaces, and is the best way to handle world building to use invisible bounding objects and just tile over them with pretty graphics?
Xerus is right in saying GM falls short here.  The old tiles method is the best, and for animated things just put a pointless object there.*  Chevy's engine has slopes in it, so I'd take a look at how he did it.

*I suppose technically you could create some code to constantly swap a tile between the frames of that square's animation, but that may be as much of a memory hog (or even worse) as the usual "use objects for animated things" option.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic