has anyone tried this for a camera

This idea is for relatively small areas to be drawn since it entails drawing to offscreen portions which is normally very frowned upon. However it might have its uses.

The idea is to draw offscreen everything you need drawn say a background and character able to move freely changing its x and y coordinate. Then instead of a camera entity copy the immediate area around the character or scene you want displayed to the immediate clipping area repeatedly.

I still havnt tried this but plan too soon. Any thoughts on how effective or ineffective it will be. Keep in mind this is inteded for relatively small spacesso it hopefully wont be too straining

Im currently searching the forums for many ideas on creating a simple system using only tools already built into java. If this fails im thinking of creating a system of using camera coordinates as an offset for everything that is drawn. Any suggestions or advice is welcome, except for the graphics.translate() I tried using this and it was madness.

I’m not sure what you mean exactly, but it sounds like you may be talking about having a potentially gigantic offscreen map of your area (whatever it may be), and then drawing portions of it to the screen? This makes sense if you have a very customized image for your game-area or background, sure, but if you use any tiles at all, a more traditional tile scheme would probably be more effective.

It’s not necessarily the best way, but what I usually do is have a tile map (array of tiles) in memory, and I have information about the screen dimension and where the current offset of the screen is, as well as tile size. Taking all of this, you perform some simple addition/multiplication (both of which are REALLY cheap when it comes to computers), and find out which TILES are visible on your screen, then just draw those.

If you’re REALLY concerned about rendering times (which you probably shouldn’t be in this day and age, if you’re using J2D and not OpenGL more directly), you could create a dirty rectangle drawing system that only redraws PARTS of the screen as needed, say, the rectangle ocupied by both where your character WAS and where it NOW is, so you avoid redrawing the ENTIRE screen each frame, but that’s going to involve you maintaining your own offscreen buffer.

Again, I probably just didn’t follow what you were trying to say in your first message, so feel free to disregard this reply and offer a correction to my misunderstandings. :wink: