ram ever better than vram? + accing drawString?

I’m making a 2d mmorpg, and when I load the map, i have to load to sets of tiles: the first layer and the second (obstructions) layer. These each are 10001000 now and will vary later (i hope to have really realy big maps! this one is tiny). Anyway, I immediately load it into vram, break it into tiles, and throw it away. the accelerated tiles are drawn on the fly, and work great, but the loading process takes FOREVER on systems with low vram. Then while the display process is so-so with lowvram systems (since the tiles are only displayed within the viewable camera portion), it’s TOO fast on systems with high vram. I know i can make my render loops based on time to even it out, but I’m thinking, since this isn’t 3d (and therefore people might want to play it for the sole reason that they don’t have a graphics card) might it be better to load everything into ram? after all, when i start doing 10,00010,000 pics, that won’t even load into most cards anyway?
Also, while the normal displaying process is so-so, when I Graphics.drawString() or Graphics.fillRoundRect(), it gets REALLY slow (since it’s mmo, you press enter to talk and it shows the string in a word bubble above your sprite, hence round rect). is there a way to accelerate strings and shapes? or does that mean hoppin the ogl bandwagon?

Hi there!

Hmm, your post isn’t easy to understand, I’ll try to answer the stuff I understood.

1.) I do not understand why you load the whole map into vram and break it into tiles from VRAM. It would be much cheaper to just load them as BufferedImages and after this spilt them.

I am even in doubt if its a good idea to create 10000*10000 maps? Re-think your design!

2.) ALWAYS calculate movment etc. time-based. Lessons learned 15y ago when writing dos games :wink:

3.)

Why in hell do you need 10000*100000 pics that are accerlated. Many cards are’nt even able to handle 4096 textures, like ATI, their chips are limited to 2048. Again, its a really bad design if you need to draw such big images!

4.)

It really depends where you are rendering to. DrawString is optimized using the OGL pipeline, and the whole shape-operations should be optimized nearly everywhere as long as you do not use AA or alpha blending.
But when painting to Surface or VolatileImage you should get pretty good performane anyway (of course not if you paint to your 10000*10000 images :wink: )

5.)

Well, I would at least check if my code is compatible against the OGl pipeline. I found out that this thing is rather picky about which operations it accerlated. User -Dsun.java2d.trace=log to see whats going on in the pipelines…

Hope that helps, lg Clemens

[quote] Why in hell do you need 10000100000 pics that are accerlated. Many cards are’nt even able to handle 4096 textures, like ATI, their chips are limited to 2048. Again, its a really bad design if you need to draw such big images!
[/quote]
That’s what i mean, the graphics card might not be able to handle it.
my regular ol’ 1,000
1,000 is puney! I want fields and towns that mmoers can walk through, and really the 1k*1k is only able to sport 2 houses and look alright. 10k isnt’ all that unreasonable, at least from my experience with every 2d rpg i’ve every played. I guess I could make a million rooms and be unique… :s

[quote] It really depends where you are rendering to. DrawString is optimized using the OGL pipeline, and the whole shape-operations should be optimized nearly everywhere as long as you do not use AA or alpha blending.
But when painting to Surface or VolatileImage you should get pretty good performane anyway
[/quote]
What’s Surface? Presently I’m painting to the bufferStrategy graphics context, without AA or alpha (though bufferedimages painted to this context do contain both, will that cancel out the optimization?)
Thanks for the advice on loading the images w/o accing them, i’ll change that.

Well, I don’t know how your design looks - but usually this isn’t nescessary.
I’ve never coded 2d games with maps, but why don’t you split your whole map in 1000x1000 images and re-load them at runtime with intelligent caching algorythms? This would really help speeding everything up and would also help java with accerlation…

lg Clemens

aha! brilliant! that would actually work great based on how i’m doing things, thanks!
ps, intelligent caching algorythms… like besides the ol’

GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
            bimage = gc.createCompatibleImage(width, height,Transparency.TRANSLUCENT);
            Graphics2D gTile = (Graphics2D) bimage.getGraphics();
            gTile.setComposite(AlphaComposite.Src);
            gTile.drawImage(subImage, 0, 0, null);
            gTile.dispose();

? If so, do you by chance have any links or good search keywords on such a topic? thanks again for all the help.

Does that mean you want 10k*10k=100k unique tiles? Most 2D RPGs would have large maps, but only have a few hundred unique tiles.

I think he ment he has a map which could be 10000x10000px under extreme situations, so with 100x100 tiles, he has 100X100 tiles, which is quite a lot but not such extreme :wink:

Another thing that came into my mind:

  • Why not save the map-tiles pre-split, because with 10.000x10.000 map-splitting in memory youÄll soon run out of ram, even if you only use BufferedImages.

?? - not native speaker so I’ve quite some problems understanding you :wink:

But a simple idea:
If you show 1024x769 with 100x100 tiles, you know you need 12 tiles horizontally and 9 tiles vertically. For more speed you could also hold +3 tiles in every direction in ram.
All other tiles could be loaded in another low-priority thread while the game runs and scrolling occurs -> scrolling would ge very smooth since +3 tiles are cached in RAM. Only if loading is too slow, a small scroll-pause could occur waiting for the loading thread to fill up the +3 tiles.
The only problem I can thing of are the GC pauses during image-loading, but with a small heap this should be tolerable…

lg Clemens

I would like to use a small number of reusable tiles for constructing my maps, like CaptainJester mentioned; however, pre-splitting that image into 3232px pngs might be REALLY tedious… I like that idea, linux… i’m just trying to think of a way i might do that programatically.
Actually, after all is said and done I might HAVE to do something to that effect anyway, because I really want to make a gui for making my own maps with which i can select from 32
32 portions of a tile template to drag and drop onto the saveable map canvas. When I’m done creating that map and want to play my game, the game could load the created map in portions, which maybe I’ll have SAVED in portions when i save the map that i’m working on.
Hmm… what do you think? Do you think there’s a way to split the map into portions like you’d mentioned, prior to loading it, but without doing that manually through mspaint?
BTW linux, good job for english not being your native language, and sorry about my horrible grammar… i do a terrible job at conveying my messages (i’m pretty scatterbrained… :frowning: ). Thanks guys