Creating a Tycoon Game Part 1 - Writing the ISO engine

For that Business Simulation Game I am working on, I decided to go with an isometric view of the buildings. 3D would have been possible too - especially since I am also working on that 3D game engine - but I think it is much easier to place buildings and have a nice overview with an isometric 2D view.

Programming wise, it is a mixture of 2D and 3D, and you have a combination of the disadvantages and benefits of both: Mostly everything is nearly in screen coordinates but you still need to do some z-sorting and clipping. It's easy to implement, even calculating the position of an iso-tile is very easy (pseudo language):

getIsoTileScreenPosition(x, y)
{
   var tileWidthHalf =  isoTileWidth  * 0.5 * zoom;
   var tileHeightHalf = isoTileHeight * 0.5 * zoom;
   
   return position2D( x * tileWidthHalf  - y * tileWidthHalf, 
                      x * tileHeightHalf + y * tileHeightHalf );		
}

I've written about 5 isometric engines during the last 20 years, in Delphi, Basic, C, ActionScript and C++. But none of these had zoom, which I definately need for this game. I experimented a bit, and after a while I felt that I found a very nice way to do it: The engine is able to zoom smoothly, but the user only can switch between 5 or 6 fixed zoom steps. This makes the world and game feel very responsive: It looks very nice when zooming is moving between two fixed steps, and the user is still quickly able to switch between two or more of his preferred zoomed views:

I'm satisfied with how this worked out so far. I'll post a new update next week.
If you want to get a mail once the game is playable, you can subscribe to the games newsletter on its website.

five comments, already:

But where are the zoom buttons in that gif?
erik - 23 10 18 - 07:32

I was zooming with the mouse wheel, but yes, zoom buttons should be added there, right.
niko - 23 10 18 - 08:26

I like these short technical updates! The game looks very polished already.
Lenx - 23 10 18 - 10:17

I love the art! Did you made it by yourself?
JaK (link) - 23 10 18 - 11:15

No, I’m pretty bad at Art, unfortunately :/
The last game where I made the Art myself was PostCollapse (when it was early access still), and people hated it because of that.
niko - 23 10 18 - 11:40


Displayed name:  
Remember personal info?
yes
no
Website (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

 


Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.