Recently I visited a presentation about JavaFX and I got the impression, that this might be something which might be useful for my OpenPatrician project. Therefore I added a task to explore different aspects need for the game. In this first part I present two basic examples.
From web pages this is a well known issue: You have an image gallery with many rows of pictures. Only part of them are visible in the browser. So the first images that should be loaded are the ones that are visible. With the browser technology this is not a big deal, as each resource (image) is loaded in a separate request, so the images at the top are requested first and you can start looking at the images and, when you scroll down the ones below will be loaded already.
With a desktop application this is a bit different, as you have to do something to achieve reasonable loading times. With a desktop application the the user interface is completely defined before displaying. Imagine you have loads of images that are to be loaded: The loading from your drive takes time and consumes memory. The first issue can be resolved by loading the images asynchronously, so the UI is not blocked while the images are loaded. However you might also save memory by only keep the images that are displayed in memory. This article shows how I achieved this:
For my game project OpenPatrician I use rendered image which I created using the 3D software Blender. As it is the nature of things there are many different users out there and everyone has its own screen with its own resolution. Therefor the challenge lies therein to create a game screen that uses the available space on the screen in an optimal way.
The game has some informational parts which are constant in size, but the main screen – where the actual game is happening can vary in size. Therefor it is important to be able to use an image as optimal as possible.