Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

110 Neutral

About Kugelschreiber

  • Rank
  1. Kugelschreiber

    Pseudo 3D screen projection issue

    Such an incredible relief to finally have this sorted. I don't think I can thank you enough. Works perfectly with my other scenes as well, of course (that is, after I noticed the numerators for A & C had to be negated).
  2. Kugelschreiber

    Pseudo 3D screen projection issue

    That too! Originally the world size was 1600 and I forgot to mention it, but it seems I did got the range right when I drew the triangle somehow.   Anyway, it works perfectly now. I couldn't have done this myself obviously. Thanks! How would the equivalent look in Wolfram Alpha after you adjusted it according to my coordinates?
  3. Kugelschreiber

    Pseudo 3D screen projection issue

    I need to apologize for goofing around about this so much. I was so eager to try your method, not reading the post properly, and I originally tried it on the background shown in the video, as I've been jumping between the two.   So, the first method ended up inverted, and the character started from the bottom of the chessboard surface and moved to the top.   The new one gets the direction right, but when he's midway through the world (at 1600), he's already at the bottom of the surface and moves out of the screen.
  4. Kugelschreiber

    Pseudo 3D screen projection issue

    Edit: Nevermind, I was using the old background. I'll try again and see how it goes.
  5. Kugelschreiber

    Pseudo 3D screen projection issue

    After initially giving up, I decided to just focus on the screen Y-position. I broke things down to find out what the result of my calculation needed to be, to show I was on the right track. I measured the height of each square and drew a triangle showing where each square on the screen is, and where the player should appear on the screen depending on where he is in the game world.  Drawing the red line inside the triangle shows that it checks out, but I'll be damned if I can get my malfunctioning brain around how to calculate it. Here's the triangle:   [attachment=24925:stoopid.png] The triangle's sides can't change I assume. So, what I need to figure out is how to get the height between the "adjacent" and "hypoteneuse" from this triangle, depending on where the player is in the real world.
  6. Kugelschreiber

    Pseudo 3D screen projection issue

    Well, I rendered the image in blender and use it as a background, so the chessboard isn't drawn in code.
  7. Kugelschreiber

    Pseudo 3D screen projection issue

    I'm afraid I'm not sure what you mean. The game isn't real 3d. Also, disregard the rotation, as that was just something I figured would affect the perspective. I started over and rendered the image again without the camera rotated (see example below). As you say though, I wonder if I'm not trying to overdo it as well and if I actually have to use trigonometry here.   My previous code for positioning the sprite on the board, when coordinates x:0,y:0 were counting from top-left, looked like this (roughly): Sprite Y = Chessboard Top-Edge Y + (Chessboard Surface Height * (Character.Y / World Y-Size)) Sprite Scale = Sprite Minimum Scale + (Sprite Max Scale * (Character.Y / World Y-Size)) Sprite X = Screen Center -(World X-Size / 2) * Sprite Scale) +((World X-Size * Sprite Scale) * (Character.X / World X-Size ))     Here's what the new screen looks like. [attachment=24910:chessboard3Dworld.png]   The Red lines would be X, Green Y and Blue Z, the depth.
  8. Kugelschreiber

    Pseudo 3D screen projection issue

    Hi there!   I'm in need of assistance in calculating display-coordinates. The problem I've run into is trying to get the illusion of 3d. To be exact, projecting sprites on a 3d-rendered image based on the characters "real world" locations in a 1600x1600 game world. I don't know much about trigonometry and I got my current results pretty much just by dumb luck. I even thought I'd gotten it right the first time before I noticed that the sprite locations didn't match the objects real world coordinates. I created a chessboard scene and an overhead minimap, displaying the objects real world location, to make sure the coordinates matched. It was quite a bit off. Here's a video showing the problem (there's also some further info in the vid descripion):       I've since had the problem explained to me and now realise the depth is wrong and also that the x-coordinates of the sprites just appear to be correct, due to the squares having the same width.   In my game world, the coordinates start in the top left corner, while in a 3d scene they would be in the center of the scene, so I've adjusted that. I also looked up a guide on using trigonometry to get the correct 3d effect. While I managed to follow it and made the sprites display as in the guide, I couldn't figure out how to apply it to my scene.   The effect I want is for the chessboard surface to act as the full 3d world, and for the sprites to be displayed on it exactly corresponding to the real world coordinates. The camera in this scene was rotated slightly downward when I rendered the image, which might have been dumb as I guess I'll have to account for that angle too.   Thanks for reading! Hoping someone can guide me through this.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!