Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a GUI #30

Open
piegamesde opened this issue Jun 2, 2017 · 8 comments
Open

Adding a GUI #30

piegamesde opened this issue Jun 2, 2017 · 8 comments

Comments

@piegamesde
Copy link
Contributor

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?

@LigH-de
Copy link
Contributor

LigH-de commented Jun 2, 2017

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)

@piegamesde
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@LigH-de
Copy link
Contributor

LigH-de commented Jun 7, 2017

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.

@piegamesde
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@LigH-de
Copy link
Contributor

LigH-de commented Aug 8, 2017

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...

@piegamesde
Copy link
Contributor Author

piegamesde commented Aug 8, 2017

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants