Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 129
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: Stairway solution, is there any?  (Read 2891 times)

0 Members and 1 Guest are viewing this topic.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Stairway solution, is there any?
« on: May 16, 2011, 09:49:56 pm »
I mean 45 degree stairways connect 2 floors, like those in Castlevania.

For example, when the character is near the stair, press up arrow and the character will star climbing. He can stop on the stairway, but will fall if an enemy hits him. If he jumps, he can land on the stairs instead of falling through.

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: Stairway solution, is there any?
« Reply #1 on: May 16, 2011, 10:07:29 pm »
I don't know of any, and I would like for there to be one.

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Stairway solution, is there any?
« Reply #2 on: May 16, 2011, 10:44:40 pm »
I posted on outline on how to do this (or ladders) but I'm pretty sure it got wiped. Maybe Bloodbane has it.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Stairway solution, is there any?
« Reply #3 on: May 17, 2011, 06:29:38 pm »
 Sorry, I don't have that. But you posted how to detect ladders (not stairs) in Double Dragon mod thread by alemasper.

Quote
If he jumps, he can land on the stairs instead of falling through.

 I'm really lost on how to make that. IIRC in Castlevania, players just fall through if trying to jump on stairs.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Stairway solution, is there any?
« Reply #4 on: May 18, 2011, 11:27:07 am »
IIRC in Castlevania, players just fall through if trying to jump on stairs.
Hmm, press up while falling and you stay on the stairs. :laughing:
Maybe this kind of object detects your key input.

Offline NickyP

  • Hero Member
  • *****
  • Posts: 2772
  • You know, that guy with the pet drum?
    • Personal OpenBOR site.
Re: Stairway solution, is there any?
« Reply #5 on: May 18, 2011, 03:18:18 pm »
The only thing I can think of is having a 3D stage made 2D using walls, then having like a break in the walls where the ladders are. Something like this...

--walkable area----walkable area--

[wall][wall][wall]  [wall][wall][wall]

--walkable area----walkable area--

The player would be spawned and basically trapped on the bottom part of the walkable area. Then they move "up" in where there's a space between the walls. Basically, you use the Z plane to create the illusion of a top floor. Of course, this method is by no means foolproof, and probably more of a headache than anything...

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: Stairway solution, is there any?
« Reply #6 on: May 18, 2011, 08:22:18 pm »
It would be best if the engine just supported sloped surfaces.  There could be an "interval" of 1+ pixels, which would be the minimum vertical step.  So an interval of 1 would be a slope, >1 would be a staircase.

Of course, I'm not volunteering to implement this; I'm not familiar enough with that part of the engine. ;D

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Stairway solution, is there any?
« Reply #7 on: May 18, 2011, 09:23:35 pm »
 :laughing:

Yeah, slopes were something I was after but never wanted to finish.

If you merge the feature with wall code, then a lot of changes need to be made into the wall detection. If you made the slot a stand alone feature, then a lot of new commands and functions have to be made.

The worst side effect would be endless bug fixing loops.

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: Stairway solution, is there any?
« Reply #8 on: May 18, 2011, 10:45:39 pm »
In my opinion, we should modularize the game physics, collision detection, etc. and put it in a separate file from openbor.c.  If it could actually be done, then that could save some of the "endless bug fixing loops".  The biggest problem with maintenance and scope creep in OpenBOR is how interconnected all of the game mechanics are - it doesn't help that it's all lumped into one source file.
« Last Edit: May 18, 2011, 10:47:20 pm by Plombo »

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Stairway solution, is there any?
« Reply #9 on: May 19, 2011, 12:35:03 am »
Here's two solutions.

1. The new wall model with a slope face on top.

2. A standalone slope model.


Other models might be too complex for a 2D engine. But new ideas area always welcome. Hmm, maybe this should go to the coding section, though it will probably not be developed too soon.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Stairway solution, is there any?
« Reply #10 on: May 19, 2011, 01:33:41 am »
Having slopes would be pretty cool.

I did a little hack with my last stage where I used the walls around the slope to give the illusion of a slope (check attachment).

Offline NickyP

  • Hero Member
  • *****
  • Posts: 2772
  • You know, that guy with the pet drum?
    • Personal OpenBOR site.
Re: Stairway solution, is there any?
« Reply #11 on: May 19, 2011, 01:47:04 am »
I did a little hack with my last stage where I used the walls around the slope to give the illusion of a slope (check attachment).

Yeah, that's sort of the method I posted. And just like I said, it looks like a huge headache.

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: Stairway solution, is there any?
« Reply #12 on: May 19, 2011, 03:31:30 pm »
Here's two solutions.

1. The new wall model with a slope face on top.

2. A standalone slope model.


Other models might be too complex for a 2D engine. But new ideas area always welcome. Hmm, maybe this should go to the coding section, though it will probably not be developed too soon.

As an extension of both solutions, how about making a standalone combined slope+wall model, then using it to implement the existing wall model and scrapping the existing wall code?

It could even be put into a new file separate from openbor.c, like I was suggesting earlier. :)



I'm thinking now about possibly implementing slopes myself (i.e. not a guarantee).  Here's my unfinished, tentative idea of what I would do if I were to implement slopes (thinking out loud here):
  • Create a new source file separate from openbor.c, for all wall/platform/slope code.
  • In pseudo-OOP style, create a platform "class" with the following attributes:
    • X and Y (A) coordinates of the 4 corners
    • depth
  • Implement separate collision detection functions for each side depending on the direction the side is facing (both left/right/horizontal and up/down/vertical alignment).
  • Write a method for the platform "class" that takes an entity's current position and velocity as parameters, and returns the new position and velocity (unchanged if no collision). (FIXME: handling of multiple walls/platforms/slopes that are close together, or for very high entity velocities, where an entity collides with >1 platform in the same update; need to make sure the entity is stopped at the correct position!)
  • Implement walls using new code, and remove existing wall code from engine.
  • Create a new platform command that takes as parameters the X and Y coordinates of each of the 4 XY points, and the Z depth of the platform.  In the wall/platform source file, implement a function to take these coordinates and construct the specified platform by calculating the slopes of the top and bottom.  If either side is also sloped, create a separate sloped platform object for that side, adjacent to the main object.

*To be finished and modified...*
« Last Edit: May 24, 2011, 04:05:05 pm by Plombo »

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Stairway solution, is there any?
« Reply #13 on: May 23, 2011, 05:38:58 am »
OK, I see you are still editing, but I'd like to point out something:

Quote
X and Y (A) coordinates of the 4 corners
We'll probably need x, y and z for each point, if you want the new model to compact with the old wall logic.

Maybe the slope ( or wall+slope) model's front face is smaller than the one in the back, like a wall.

Instead of letting this idea leads us to the 3d nightmare, I think we need to find some example games that use slopes (2D games of course).


Quote
Write a method for the platform "class" that takes an entity's current position and velocity as parameters, and returns the new position and velocity (unchanged if no collision).

Sounds good. Current wall code is just acting too solid.  For example, if a player walks against a wall, he will be blocked completely despite the shape of the wall.

*-----------------------------
Edit-
*------------------------------

The 3D solution could simplify the system if you code it properly, but I'm afraid it'll mess up current wall system (mostly script compatible issues).

That is, drop the wall model completely and use face model instead. A wall is technologically 6 faces, or 5 if you don't count the bottom one, but a platform should have 6 nonetheless. A face can be single sided, for example, some platforms can only be passed from below.

If you like, the ground can also be a face, and thus you don't even need the hole logic.

Code: [Select]
typedef struct
{
  float x;
  float y;
  float z;
}s_vert;

typedef struct
{
  s_vert verts[4];
  int single_sided;   //for platform logic, see above
  s_vect normal;     //normal of the face if necessary
  float slide_factor;    //friction
} s_face;
« Last Edit: May 23, 2011, 08:16:19 am by utunnels »

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: Stairway solution, is there any?
« Reply #14 on: May 23, 2011, 11:18:28 pm »
OK, I see you are still editing, but I'd like to point out something:

Actually, I'd forgotten about that post. :-[

Quote
X and Y (A) coordinates of the 4 corners
We'll probably need x, y and z for each point, if you want the new model to compact with the old wall logic.

Maybe the slope ( or wall+slope) model's front face is smaller than the one in the back, like a wall.

I was mostly thinking of 2D walls and platforms when designing this, since the visibility of the Z dimension is impaired somewhat by OpenBOR's semi-2D view, and I couldn't think of any practical uses for a Z-slope.  Maybe Z slopes could be added when XY slopes are finished, since they would add more complexity to the collision detection functions.

Aren't walls in OpenBOR rectangular prisms, where the front and back faces are the same size?

Quote
Write a method for the platform "class" that takes an entity's current position and velocity as parameters, and returns the new position and velocity (unchanged if no collision).

Sounds good. Current wall code is just acting too solid.  For example, if a player walks against a wall, he will be blocked completely despite the shape of the wall.

Yeah, the Newtonian normal force is needed for slopes. :)

*-----------------------------
Edit-
*------------------------------

The 3D solution could simplify the system if you code it properly, but I'm afraid it'll mess up current wall system (mostly script compatible issues).

Oh...I wasn't thinking about script.  I forgot wall properties could be accessed through script.  Will need to come up with a backwards compatibility layer somehow without overcomplicating things.

That is, drop the wall model completely and use face model instead. A wall is technologically 6 faces, or 5 if you don't count the bottom one, but a platform should have 6 nonetheless. A face can be single sided, for example, some platforms can only be passed from below.

Why not make all faces one-sided?  If we already have a top, bottom, left, right, front, and back face for every platform, then each face will only need to detect collisions from the direction it is facing.  Top-only platforms could then be implemented by adding a "solid" flag to your s_face struct, where if it's unset the collision detection for that face is disabled completely.  So a top-only platform would have every face except the top be non-solid.

If you like, the ground can also be a face, and thus you don't even need the hole logic.

Sounds good.

Code: [Select]
typedef struct
{
  float x;
  float y;
  float z;
}s_vert;

typedef struct
{
  s_vert verts[4];
  int single_sided;   //for platform logic, see above
  s_vect normal;     //normal of the face if necessary
  float slide_factor;    //friction
} s_face;

In addition to the "solid" flag I mentioned above, s_face would also need flags to specify the X/Y/Z direction it is facing, to avoid recalculating it before every collision detection.  On second thought, I guess that information could be determined by checking the +/- direction of the components of the normal vector.
« Last Edit: May 23, 2011, 11:20:21 pm by Plombo »

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal