TMCMR icon indicating copy to clipboard operation
TMCMR copied to clipboard

Adding a GUI

Open piegamesde opened this issue 7 years ago • 8 comments

I'd like to use TMCMR in my projects and will write a GUI for it and start programming in the next weeks. It will require some major changes and refactoring, but I think it will be worth it. What has to be done:

  • Extract the rendering core and make it usable as a library generating BufferedImages.
  • Separate the command line from the rendering core and make it use that rendering core.
  • Create a custom Swing component that can display the world using the core for generating the images and LWJGL3/OpenGL for rendering them. That component might be used like a library in projects as well.
  • Create a standalone GUI using the Swing component the user will be able to use instead of the command line.

But before I start, I'd like to hear your opinion on it, because I won't waste my time coding something for nothing. So, what do you think?

piegamesde avatar Jun 02 '17 14:06 piegamesde

I'd be curious about it. But expect troubles caused by partially filled huge images (I hope you can imagine an efficient way to display possibly sparse tiles in a large scrollable canvas)

LigH-de avatar Jun 02 '17 14:06 LigH-de

So my implementation idea for faster rendering: heavy use of mipmaps.

For every power of 2 scale, there is a complete render of the map in form of images in the memory. The images are constantly generated in background, beginning with the smallest resolution and going up steadily. If the user zooms in on a part that hasn't been generated yet, lower resolutions will be shown until the high-res is calculated. Images that aren't needed currently get cached to disk to save RAM and reloaded again dynamically.

The tiling will probably be 512x512 images, each rendered on a quad. Only tiles in the viewport get rendered. I'd like to have 512px sized images, because:

  • that's the size of a region file at max resolution
  • most graphics card have a max image size that's larger than that
  • they are still large enough that you don't need a bazillion of slow glBindTexture calls for filling the screen.

piegamesde avatar Jun 02 '17 14:06 piegamesde

One last thing before I start:

I set up Eclipse to do automatic code formatting, organizing imports and some other stuff automatically on every saving. Each file I change even a little bit will probably be totally different due to different formatting, making code comparison and such difficult. To avoid this, please tell me the code formatting settings I should use for that project so that everything is unified and nice and tidy. I you don't care, it's fine too, but I need to know.

piegamesde avatar Jun 06 '17 20:06 piegamesde

I am no developer, so I won't tell you how to format the source. And the original author may have lost most of his interest in this project, I believe (unanswered question in my pull request).

If you are interested in a more powerful alternative to compare sources, you may try "Beyond Compare" (Scooter Software), it is able to "ignore" minor differences (e.g. indenting); it's commercial, though.

LigH-de avatar Jun 07 '17 06:06 LigH-de

I got some basic OpenGL prototype running using LWJGL 3, but it sadly is not compatible with standard GUI systems. What should I do? Here some possibilities I see:

  • Go back to Swing and rewrite rendering in Java2D (slower, but the whole is not resource intensive so it might work as fine as in OpenGL)
  • Make it OpenGL only and don't provide any compatibility
  • Rewrite the thing in JavaFX
  • Use JavaFX with JFXGL
  • If the solution involves JavaFX, try to make Swing working on top of that
  • Go back to LWJGL 2 and use Swing

piegamesde avatar Jun 12 '17 11:06 piegamesde

So I finally got something to show you: https://github.com/piegamesde/TMCMR/

Please try it out (and see if it works) and tell me what you think of it

piegamesde avatar Aug 07 '17 21:08 piegamesde

Do you provide a jar as "release" too, or would I have to install a JDK to compile it myself? Usually, I am only a user...

LigH-de avatar Aug 08 '17 06:08 LigH-de

In the end it will be a in a jar, of course, but this is still in development. But I'll deal with that later - the biggest problem for now is that it can't merge for some reasons (see #32), so you'll have to make it running on your own.

If you use eclipse, it's easy: just download and import the project folder and it'll be ready to run (you might need the m2e plugin for the dependencies).

piegamesde avatar Aug 08 '17 07:08 piegamesde