Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Platformer Programing  (Read 1198 times)

0 Members and 1 Guest are viewing this topic.

Ryuza

That one guy
Platformer Programing
« on: July 27, 2010, 04:10:21 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
Hey all, I've been working on a platforming game for a while now and I've been looking over a couple different ways of doing collisions, gravity, friction. From what I've seen most people set up an object to object collision system with scripts for different types of collisions. Basically each object has some code or a script in it that is used to tell the object how to collide with other objects, and most objects also have some code for gravity, telling it when to fall and at what speed.

I recently thought up an idea which I haven't seen done yet and I was wondering if I could get a bit of feedback on it. My idea should cut out a lot of unneeded code, basically, have three main objects: ctrl_nature, par_active, par_solid.

  • Par_active would be a parent object for every object that can be moved, such as the player or a box you could push around.
  • Par_solid would be any other normal solid object.
  • Ctrl_nature would handle all the basic collisions between par_active and par_solid.

By putting "with (par_active)" in the step event of ctrl_nature you can put all the collision code or scripts you'd normally have in every object into one. As for gravity/friction you can simply create global variables for the two in ctrl_nature and have the basic code to control it in the step event within the "with (par_active)" section so that it applies to all the of objects with par_active as the parent.

So, does anyone know of any downsides to doing the collisions, gravity, etc. in this way? So far the engine I've been working on that uses this system for everything has been doing rather well, the only problems I'm having are normal bugs you'd have with any type of collisions. Any advice or suggestions on doing things this way?

Edit: Started a page under the projects and added a download for the basic movement, please let me know if there are any bugs or anything strange about the movement, so far it seems to work rather smoothly though.
« Last Edit: August 02, 2010, 07:08:55 pm by Ryuza »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube

Mamoruanime

@Mamoruanime
Re: Platformer Programing
« Reply #1 on: August 01, 2010, 05:04:55 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I don't really see how ctrl_nature would help any.

I typically have a parent object type (in GM it's the equiv. to the "parent" object) with generic collision detection responses for each type of collision data, and if I need to I make the children override specific responses.

In GM you cut down unneeded code by removing additional objects (as they take up an unneccessarily large amount of your filesize) and going a more scripted route :p

You can check out parent to child relationships in GM with my old pureLA engine floating around; it shows how to make a game in game maker with just a couple of objects.
Logged

Ryuza

That one guy
Re: Platformer Programing
« Reply #2 on: August 01, 2010, 11:04:54 pm »
  • RyuKage2007
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 290
A bit surprised anyone decided to post.

Anyway, I usually tend to have an object (such as ctrl_something) that handles a large amount of things throughout the game. I figured I'd have that same object handle all of the collisions too, but it probably would make sense to have it in the parent object. I just had the collisions in ctrl_nature with all the other stuff so I could go through that one object should I have any major problems with the game since it handled most everything, that way I wouldn't need to go through a lot of different objects.

I'll be sure give the pureLA engine a better look though, I had a look into it before but I didn't get too far into the code, just skimmed through a bit.

Edit: I added a small download that has a .exe to test the basic movement. So far everything seems to be running smooth and I have only a very small amount of code in the engine.
« Last Edit: August 02, 2010, 07:08:23 pm by Ryuza »
Logged
<- Koholint Island - MC Style  <- Link's Awakening Photo Recolors  <- Wind Waker 3D Resources <- Super Mario Bros Crossover
  • RyuKage2007's Youtube
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.034 seconds with 41 queries.

anything