Post news RSS A Quick Preview of the Isometric Engine

Here is a brief overview of how the Isometric Engine will work graphically.

Posted by on

In the isometric engine, everything but the walls (since we haven't actually stored them in their 4 isometric views) and the Sims is drawn on top of each other, just by a simple stream copy from the source bitmap to the screen, starting from the back (the tile farthest away in space, meaning, the tile highest up) and rendering each object up to the front. Walls are the only things which we have to transform before displaying: we simply need to skew them before drawing them on to the walls.

As far as "isometry" goes, an isometric view is where the horizontal and vertical rotation of the camera is aligned so that if you were looking at a cube, the vertex closest to you is right in the center of what you see.

Posted Image

To start, you would take a square grass texture and tile it (repeat it) so that it becomes the size that you want. (We don't know this size yet. We'll have to take a screenshot from The Sims 1 and find the exact pixel size per game tile)

The game doesn't actually use this texture for the lots, but, it works since I can't find the actual one.
Posted Image
From: &#xPr;ogramFiles(x86)%\Maxis\The Sims Online\TSOClient\gamedata\terrain\newformat\gr.tga

To create the playable area from this image, again, no transformations to it are required. Once it is tiled to fit the size that you want (in this case, I have tiled it to 768x768), you mask it to the shape of an isometric rectangle laid in front of you, which, as I demonstrated above, has top and bottom angles of 120 degrees each and left and right angles of 60 degrees each.

Here I calculate the exact pixel coordinates for this.
Posted Image

After the mask is created and applied, the image now becomes:Posted Image

And we can start writing images on to it.

We will need to keep track of 3 types of coordinates.

Local screen coordinates are where the user clicks on the screen (just on his monitor).

Global screen coordinates are where the user clicks on the world. If he/she clicks on the very top left pixel of the world, then it's (0,0). We'll make the y value increase as the user moves his mouse down so that it'll match the fact that objects are drawn on top as they are closer to the user, and down is always closer to the user. Also, instead of making the top middle (0,0) and having negative values for x, we're making the top left (0,0) because we always need to know the width of the image to create the mask image, and OpenGL itself refers to the top left as (0,0) anyway.

Global tile coordinates are what tile on the grid the user clicked on. And again, to match the fact that the farther down something is the more "on top" it is, we'll make the y value increase as it goes down, and make the x axis start right next to it.

To sum it up,
Posted Image

And next, we will consider "precision" for these coordinates. The local screen coordinates always have 100% precision. If the user moves his mouse 4 pixels, the local screen coordinates are changed by 4 pixels too. The global screen coordinates match the precision of the zoom level. So, at 100% zoom (the closest zoom), the precision is 100%. When you zoom out, however, the precision will be lower (we don't know how much lower, yet: we'll have to find these values from The Sims 1), so if it were 50% precision, then moving your mouse 4 pixels would change the global screen coordinates by 8 pixels. The global tile coordinates are really the same thing, just at a bigger scale.

I googled about OpenGL projections, since that's what Bob was using. Because I don't have any experience, I don't know what's right and wrong. Right now I need to know if it's okay to have every object on its own "projection", whatever that really is. As far as I know, that might be the fastest (most efficient) way to do it, or that might actually be the absolute worst way to do it. We have to make sure we are using enough cache. What if the user removes an object? Are we going to be constantly redrawing everything each frame anyway? And is that a bad thing? Like, can we keep each tile on its own OpenGL projection?

We will just need more developers experienced with OpenGL to answer these questions.

(Original update written by X-Fi6)
Read the rest of the update at Tsorestoration.com

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.