2.5D platform

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Wanting to do a Shot n Run game easily? Here is your chance!
  • Okay, I finally have some time to get this done (2.5D platform plugin, for RPGs, brawlers and whatnot).

    EDIT: The latest demo will always be at http://octavoarte.cl/25d_concept.exe while I'm working on this.

    Since this time is limited to about a month TOTAL, I figure I'd better throw ideas and get feedback right before even starting.

    My first idea would work something like this:

    • Everything (with the behavior) is a cylindrical platform with a sloped top. This means players could stand on top of each other if desired.
    • The top has the same profile as the base (regardless of slope) and profile needs to be specified separately (Feedback here: separate objects? frames? collision mask?).
    • Everything on top of something stays there unless moved, regardless of slope.

    I've settled on the following attributes:

    • W=faux height
    • RY=real y.
    • RX=real x.
    • DyDt=real y speed.
    • DxDt=real x speed.
    • DwDt=w speed.
    • DwDx=top slope on real x
    • DwDy=top slope on real y
    • T=W Climbing Threshold, for stairs and such.
    • WY= offset on Y for each unit of W
    • WX= offset on X for each unit of W
    • Ignore collision= toggles whether the object will react to collision or its absence.
    • Player= sets the player that controls this object.
    • Unmovable= toggles whether the object is controlled by a player (Feedback: is this needed?)

    Collision would be as follows:

    IF platform profiles collide at equal W AND platforms sprite collide, THEN platforms are colliding.

    Movement would be as follows:

    • Y=RY+(WY*W)
    • X=RX+(WX*W)
    • Falling modifies W only.
    • Sprites are sorted according to RY and its sign.
    • On collision, an object is placed on top of another object only if doing so doesn't move the object more than T. Otherwise it gets pushed out in the angle of its speed. If speed is 0, nothing happens. Height is determined by measuring the distance between the profile aligned at the bottom and at the top of the sprite.

    Expressions would be as follows:

    • Is above
    • Is below
    • Is falling
    • is on top of
    • get (any) attribute

    Actions would be as follows:

    • Set position to (real x, real y,w)
    • get/set attributes

    So far the only undecided issues are:

    • Profile storage. Where to store the profile image for a platform?
    • Are slopes necessary? They could bring issues in the math for movement.
    • Controls by multiple players. I don't know how this works. Is a separate toggle needed for objects that are not player-controlled?

    Feedback and implementation tips are very welcome! This will be my first plugin, only done fx so far.

  • What about z displays? Like if player goes behind an obstacle.

  • object_depth = -object_x

  • Very cool Madster, can't wait.

  • Are slopes necessary? They could bring issues in the math for movement.

    aybe they could be turned off?

  • Well distort maps are tilable now. I haven't checked but it might be possible to use the z heights for slopes. Course you cant get collision detection from that, but would it actually be needed?

  • I haven't checked but it might be possible to use the z heights for slopes. Course you cant get collision detection from that, but would it actually be needed?

    Yes, collision detection would be needed. And z height for slopes isn't a very good idea. No one should be forced to use z height.

    And Madster, I'd like a bit more clarification on what exactly your plugin does. Are we talking battletoads style 2.5d, or isometric platforming? You didn't really explain.

  • Are we talking battletoads style 2.5d, or isometric platforming? You didn't really explain.

    True, I didn't. This should cover both, as the difference between them (AFAIK) is just the controls and shape of the platforms. Also, there's control over how height is represented, so you could adapt to many styles.

    No, there are no plans to involve z or distort maps. This is not 3D, it's 2.5D as seen in Golden Axe, Cadillacs & Dinosaurs, Final Fantasy III (american) and other 2D games that allowed you to walk in 8 directions and also jump on top of stuff.

    To turn off slope you'd just leave the default 0 values for dwdx and dwdy. Slopes are useful for marble-madness type games and any others that may need sloped platforms. (most 2.5D games have only flat planes).

  • I've been scouring the nets for info on how other games do it.

    Has anyone any kind of reference?

  • So this came up while chatting... I'll write it down for later when I can work on this thing.

    Collisions: use the mask editor to create a mask for the base of the object. Objects are assumed cylinders, so the same mask is used for both top and base, only displaced by a new object_height parameter.

    Hotspot: the hotspot would be the measured position of the object in the base plane. This would be the point used for setting height according to slope.

    W versus height: when setting W, you'd be setting the faux-vertical distance from the zero plane to the base of the object. When setting height, you'd be setting the faux-vertical distance from the base of the object to its top.

    Slopes: With all of the prior, height in a slope is calculated around the hotspot, displaced by w and height, using dwdx and dwdy and the w-displaced hotspot of the object on top.

    wheeee! sounds doable now!

  • http://octavoarte.cl/25d_concept.exe

    Just a concept. No slopes. Seems to work allright, you may even stretch objects and they still work

    There's a marker for the player's ground level (w = 0)

    Platforms can be moved vertically (not done in demo)

    Edit: here it's sorting by basal y (ry) only. Final sorting must involve height somehow, haven't figured it out yet. In this demo, if you go towards the back of a platform, you'll be drawn behind it. A temporary workaround was to set the hotspot to the top of the base collision mask.


    -falling faster than maxclimb on a platform lets you through it

    -platforms below others don't let you step on the top one

    -there's no hitting walls yet

    -integrator is very naive. Go Verlet.

    -consider having the mask at the top instead of the bottom--> easier to draw

    -move platforms on rx or ry, with other objects resting on them?

  • sweet!

  • Well looks like you got 45 degree moves covered.

    For the platforms are you going to have a depth setting as well as height?

  • So far, you have to place the object in the layout as it would look resting on the zero plane, then it will get moved to its proper height on startup.

    if by depth you mean the depth of the surface, that's done drawing a collision mask so yeah, it can be whatever you want.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • http://octavoarte.cl/25d_concept.exe

    I updated the demo. Raised platforms work now, woohoo! In this demo there's a spiral staircase.... with platforms one above the other! And one big flat platform below the others!

    There's a flag marking what you're standing on now, this should allow me to implement moving platforms later.

    Still no blocking from walls (any help on the push-off code? please? should be pushout in 2D)

    Also, I could do with some pretty platforms for testing... any takers? my drawings are terrible.

    Edit: added crappy shadow, disappears when not touching any platforms. Any thoughts on how to have a shadow that stays on the nearest platform directly below?

    Also, space key resets height, to avoid restarting endlessly.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)