Pseudo-3D games.

4

Index

Attached Files

The following files have been attached to this tutorial:

.capx

Stats

15,114 visits, 40,567 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

I know some people are interest in 3D games, and I've been thinking about trying Pseudo-3D games in Construct. First of all, you may be wondering what this has to do with Construct, since it's a 2D focused gaming engine (at least at the time of this writing). Well, a few years back I created some sprites for a simple experiment, and using billboard effects, and scaling, I could create a 3D-like feel for walking around an area. I think some games like this might be kinda cool. I just never did one, but thought someone might like to give it a whirl for fun! ;) I'll do a screencast of this as well shortly. Here's an example of what I mean:

The first concept to understand is perspective and Field Of View (FOV).

The human field of view is around 180°, but Usually, the FOV angle used for games is around 90° (give or take 5-15°) because of the screen distance. The angle chosen depends on how close a person is to the screen. For PC games the player is close to the screen, so you should go with a larger FOV angle. For console games where the player is usually on a couch looking at a TV screen, the FOV should be smaller. It's like looking through a window at some distance - the closer you are, the more you can see.

Anyhow, let's dive into this! The only requirement is a bit on knowledge of basic trigonometry. Okay, so let's say you have this view ...

I'm using a FOV of 90°. You may have noticed that the line that says "Monitor/TV" is not at the point of sight, and there's a good reason. Let's take your PC monitor for example, which is represented by the blue line. Your monitor has MANY points ("pixels") and each one you turn your eyes to look at must represent an angle of view for THAT pixel. If your monitor was at position 0 (the starting point, keeping the FOV at 90°) then everything would render to one pixel in the center of your monitor. ;) 3D GPUs translate each 2D screen pixel (x,y) into a 3D vector (x,y,z) in 3D space using what's called a "transformation/translation matrix" (but we don't need to get into that for this basic tutorial).

For true 3D, a "ray" is cast from a 2D screen point along a 3D vector towards a 3D object, and the polygon that intersects the line is chosen, then a texture, and so on. A PC screen has many pixels, so the GPU ray-casts thousands of times to determine pixel colors for that ray. The arrow in the image above represent this "ray" in 2D space (top down, which is why you see 'x' [horizontal] and 'z' [depth] axis').

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!