Is there much of a difference between 5 and 6 for games? because Windows XP comes with 5 I think.
When we’re talking about memory, that doesn’t include images right? That’s just stored in your video card memory correct?
Is there much of a difference between 5 and 6 for games? because Windows XP comes with 5 I think.
When we’re talking about memory, that doesn’t include images right? That’s just stored in your video card memory correct?
5 or 6 what?
IE5/6 ? or Java 5/6?
WinXP (without service packs) comes with IE 6, and the crappy 1.1x M$ JVM.
Regarding memory, because graphics memory is considered to be volatile and apparently can lose it’s contents at any point; images always have a backup of their contents in heap memory also, so if the vram cache of the image does become invalid, it can be restored.
Theoretically you could have a VolatileImage that was backed by a file containing the image data (rather than an in-memory representation), but it would have the potencial of being hideously slowly. (as there are no guarantees made on the frequency at which an image in vram might have to have its contents restored)
Java 5/6 (browser makes no difference “for games”)
So no matter what the applet is using the 125MB ram allowed as backup images for the vram?
That’s horrible for 2D games, images take up too much memory for me to be using my 125MB ram on them.
So what the hell… if I store an image (say jpeg) to a variable in the 125MB ram, and render it, then does the video card in turn make a backup on the 125MB ram again? ???
If no, then what if I store the image in a byte array and create the image?
If vram really does use part of my 125MB ram as backup then there’s no way an applet is capable for a 2D game of that magnitude. :-\
Thanks
With sun.misc.Unsafe (insert horror-tune here) you can malloc ‘unlimited’ amounts of direct-memory. Wrap your own ByteBuffer around it and you’re done.
You’ll need a signed applet though.
sun.misc.Unsafe… All I’ve read is, essentially, it is the devil. LOL. People seem really scared. I welcome a nice little hack, but I’m used to C/C++. I don’t care if it’s undocumented or changes in future versions. As long as it works and isn’t full of bugs. Is it that there’s no ‘bugs’ in Sun’s code, but you have to be careful or your script could have bugs?
Are there any wrappers, examples, or tutorials for this? In my case more memory is worth requiring it signed.
Check your private messages. Use at your own risk.
No, there are no tutorials, no official wrappers, no support, highly discouraged.
It basicly lets you use pointers. Nothing more, nothing less.
Well, it looks like C, which is safe if you’re very careful.
[quote]Regarding memory, because graphics memory is considered to be volatile and apparently can lose it’s contents at any point; images always have a backup of their contents in heap memory also, so if the vram cache of the image does become invalid, it can be restored.
[/quote]
I tried googling this and no luck. Could someone please elaborate on vram backups on ram? Is that part of my applets allocated memory? If I already have the image stored in memory will it still backup? Thank you very much
Yes, you have to copy the data in the image yourself and put it somewhere, where you can retreive it and use it to restore the image in vram.
that ‘somewhere’ can be anywhere (if you’re working with a byte[] to hold the data)
I gave you some code to put it in your own malloc-ed memory block, where it shouldn’t take any heap-space.
The byte[] will be garbage collected eventually, so your heap stays relativly small.
[sub]P.S.
Your mailbox is full.[sub]
Very nice, thanks again, Riven.
Unless anyone has more unsafe information, could someone please direct me to a decent server/client tutorial for Java 5.0/6.0?
[sub]P.S.
Weird, I only had 1 message, lol. I deleted it. ^_^[sub]
Thanks Anymore? Is there like a useful links thread around here? ;D
Unfortunatly there aren’t many tutorials and books about java NIO. I’ve struggled to learn it long time. Very good help I got is from reading O’Reilly’s Java NIO, excellent book, and in combination with some “make a simple server” tutorial type I’ve learned how to do it and built it little by little.
Of course, you could always use already built libraries, such as sunset’s JGN (java game network).
most of them are pretty old. I canalised the following links from a poorly written document i had laying around.
if you take the above as an guide into nio you should be ok. I also have the ebook of the book mentioned above I don’t think I can am allowed to redistribute it.
http://www.oreilly.com/catalog/javanio/
http://javanio.info/
Most of those target 1.4 as that’s wenn nio was introduced. however 1.5 featured:
http://java.sun.com/j2se/1.5.0/docs/api/index.html?java/util/concurrent/package-summary.html
ExecutorServices are quite nice