[java] Active Rendering Question

Started by
1 comment, last by Glass_Knife 16 years, 5 months ago
Hi. I want to make a game in Java, but I cannot really find any tutorials that explain this active rendering. http://www.gamedev.net/reference/programming/features/javarender/page3.asp I don't understand whether I should consider that stuff boiler-plate code or know whats going on. I looked through the API, but its very overwhelming and confusing. I'm really confused as to why its more efficient compared to the method explained on this site. http://www.javacooperation.gmxhome.de/TutorialStartEng.html It's all really confusing, last time I tried to make a game, I had to do random complicated stuff with Timers and stuff. I eventually managed to get it to work by trial and error, but now I wanna know whats the best way to display graphics in Java. Is there a right or best way? If the first article is the most efficient, what are the GraphicsConfiguration, Device, and Environment for? What's the purpose of this Buffered Image? // Create off-screen drawing surface BufferedImage bi = gc.createCompatibleImage( 640, 480 ); What's the point of buffer.show() and drawing the above image?
Advertisement
Quote:Is there a right or best way?


Everything is a compromise.

Quote:I'm really confused as to why its more efficient compared to the method explained on this site.


It's explained in the link from the article you posted.

Usual way to render things in Java's UI components is through response to events. Something happens -> trigger an event -> interested listeners will update display.

If you're doing game-like rendering, you do not care about various UI events - on every frame, you'll be repainting entire screen, drawing everything from scratch.

Quote:What's the purpose of this Buffered Image?


Due to several reasons, Java's graphic's systems are quite complex. Simply put: BufferedImage is a canvas on which you will draw things. This is the way rendering is usually done, you render everything onto some buffer, then tell the system to display that whole image.

Quote:what are the GraphicsConfiguration, Device, and Environment for?


Classes, related to rendering. Going through their respective JavaDoc may or may not explain their fuctions. Overall, they tie into the architecture of Java's graphics system.

Quote:I don't understand whether I should consider that stuff boiler-plate code or know whats going on. I looked through the API, but its very overwhelming and confusing.


You can consider most of the source on that page boiler-plate code. It's just setting up the window, allocating the graphics resources (Canvas and BufferedImage) and sets the appropriate parameters to disable events.

Everything else is usual game loop.
Hey ThatOtherGuy667, I just wanted to comment on my article. I wrote the "Java Games: Active Rendering" tutorial because I wanted a simple example of doing full-screen 2D games in Java.

I admit, it is not a beginning game programming tutorial. It assumes you already know how to make computer games in some other language. If you look at the links at the bottom of the article, you can learn more about what is going on.

I think Antheus answered all your questions very well. If you are new to game programming, then you are going through the same thing all of us went through when we first started learning about all the different things needed to program computer games. The more you learn, the more you realize you don't know. And while that is going on, new things are being created, discovered, improved, etc... Some times it seems like there is way too much stuff to learn.

The good news is that the core ideas and concepts, such as drawing to the screen, handling user input, and that kind of stuff, has not changed that much since the days of Space invaders. Sure, there are new APIs and input devices, cool new graphics hardware with pixel shaders, super 3D sound, but the core ideas remain the same.



I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

This topic is closed to new replies.

Advertisement