2.5 D - The Beginning

0 favourites
  • 5 posts
  • Sorry to anyone that may be interested in this project in the future. Really, I was wanting to test the limits of Construct 2 on my own the way it is, and what I've deduced is that it's much more complicated than it needs to be to bring full Mode 7 implementation into Construct 2 the way that I'm doing it now. I'll work on a plugin instead that can do this. The reason why I want to do it is because, with Construct 2, there's almost limitless gamplay possibility. I want to harness what Construct 2 is normally capable of to control something a relatively three dimensional world. I don't plan on using Q3D for my implementation of such things, and will do the programming myself. If you want to check back on the status, just go to my website, where I will be releasing news of my projects : KiiraGames.weebly.com

    So, I've been working on some logic that when implemented, will efficiently display 2.5D graphics. Mixing this with the Mode7 effect makes some pretty good results, but I'm having some issues trying to figure it all out correctly. Right now, I have the camera, X, Y, and Z coordinates etc. worked out quite nicely, achieving smooth results for viewing the 2.5D world. The way I designed it should allow for some much more complex situations, so I'm hoping to mix the ideology on it with the polygon plugin to make actual objects in 3D space for better map designing (Right now I only have sprites displayed in the 2.5D world.

    Like I said, all has been going nicely, up until this point. I can't figure out what the issue is at all, but I know it's fixable with some modifications, I just have to figure out how.

    Right now, the rotation of the camera and positioning of objects according to the camera is based off the angle between the Player sprite and the Object sprite positions on a flat layer. The player moves the way I want him to, but the objects don't move at all, rather having sprites that are displayed according to if the object is within the player's viewing angle. This much is functional, and this is the line I used to calculate how it would be displayed:

    ViewportRight(0) - ((ViewportRight(0) * 2/360) * (anglediff(player.Angle, angle(ObjectGroup.X, ObjectGroup.Y, player.X, player.Y))*(distance(player.X, player.y, ObjectGroup.X, ObjectGroup.Y)/1000000)))

    To explain what this much does, basically, I take the width of the viewport (avoiding static numbers so I can change values without it breaking) and subtract it by half of the viewport divided by the maximum angle and multiplying all that to the angle difference between the angle from the Player to the Object, and multiplying that by the distance from the object to make a more realistic angle smoothing.

    I've got it set up so that if the object exits the limited x distance, it will disappear. Because of the way anglediff works, if the object is moved behind the player, it will begin to move to the center of the screen as you're looking around. So, basically if the angle difference between the player and the object is 90 degrees, it will be on the side of the viewport, and then I made it dissapear after that.

    Again, this is all fine, until the player begins to move forward.

    The way I fixed the incorrect x positioning based on calculating the distance between the displayed sprites previous X and it's current X, so if it's moving opposite of the direction it should be, it obviously isn't going the right way, and needs to go away.

    But when the player moves away from the object when looking away, the angle difference is actually increasing the way it should if the player was looking at it, because the player is looking away.

    So, maybe I could fix it by calculating the angle between the player and object? But that didn't work because of the latter line of calculations that positions the 3D object. It'd be easy if I could just say if it's not within the angles that are the limits for the objects rendering, it'd disappear, but this doesn't work.

    If anyone has done anything with 2.5 D to this point, please help me out with some idea of how to do this. I've tried my hands at 2.5 D already a couple times, but I've never came this far yet, so this is exciting me, and I don't want to get stuck. So if you have any ideas, please help.

    [EDIT] Okay, so my problem was in the player's rotation which I found out by displaying the look of the layout as it would be normally. The angles were off making it so you had to look at the objects from a side view in order for them to be centered on the screen. Simple fix, though it took a while to troubleshoot. It's working fine now, using relatively the same logic except that I changed the line posted above to:

    ((ViewportRight(0) * 2/180)) * (anglediff(player.Angle + 70, angle(ObjectGroup.X, ObjectGroup.Y, player.X, player.Y)))

    I didn't need to calculate distance for the viewing angle, so I took that out. It looks better this way, but I'm sure there's a smoother way.

    I also used Construct 2's normal Line of Sight behavior in order to check if the object in the world is visible, due to the fact that the angles were correct. Changed some Mode7 values, added depth of field and fog like effects. Now it's time to work on further implementing the Z axis.

    Thanks though, to any help offered! I actually tried following a Mode7 tutorial made in Construct Classic, but it wasn't giving me the results I wanted. I want legitimate X, Y, and Z axes. In combination with array I'm hoping to have a complete 3D engine specifically for Construct 2, furthering those goals depending how far I get. If it comes to the point that I can make modifiable points in 3D space, I will create a program that lets you make a Construct 2 3D object using array to JSON and back type of stuff.

  • This is brilliant ! You are brilliant ! Such amazing logic . Just Wow

  • Haha thanks! xD Oh and by the way, I actually got it figured out, I wasn't debugging well enough apparently.

  • Apparently if you don't handle the engine right it will make your computer crash. Bleh!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good luck on your work . I'm sure you will make it

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