Show Posts
|
|
Pages: [1] 2 3 4
|
|
2
|
Java Game APIs & Engines / Java 2D / Re: Jpeg comments
|
on: 2006-12-01 12:06:03
|
well if exif headers were fixed length you could use RandomAccessFile to read and manipulate just the headers. if it is some random-length string, then you are forced to update the rest of the file as well since you can't just 'insert' bytes. (technically if you had access to the underlying filesystem, you could just update the file allocation tables)
|
|
|
|
|
3
|
Java Game APIs & Engines / Java 2D / Re: questions about modifying image (raster)
|
on: 2006-12-01 11:49:03
|
short answer: the int[] array is the final underlying array the bufferedimage ultimately uses. long answer: in BufferedImagein the constructor of BufferedImage: for RGB or RGBA images1 2
| colorModel = new DirectColorModel(... raster = colorModel.createCompatibleWritableRaster(width, height); |
for color bit depth > 16, in DirectColorModel.createCompatibleWritableRaster(width,height)1 2 3 4
| if (pixel_bits > 16) { return Raster.createPackedRaster(DataBuffer.TYPE_INT, w,h,bandmasks,null); } |
in Raster.createPackedRaster(DataBuffer.TYPE_INTnotice the DataBufferInt which is created here 1 2 3 4 5 6 7
| ... case DataBuffer.TYPE_INT: d = new DataBufferInt(w*h); ... SunWritableRaster raster = (SunWritableRaster) createPackedRaster(d, w, h, w, bandMasks, location); .... |
in Raster.createPackedRaster(DataBuffer buffer, ...1 2 3
| case DataBuffer.TYPE_INT: return new IntegerInterleavedRaster(sppsm, dataBuffer, location); .... |
finally, an IntegerInterleavedRaster is created, with the integer databuffer as basis.. now, in BufferedImage we can retrieve a reference to this raster. 1 2 3 4
| private WritableRaster raster; public WritableRaster getRaster() { return raster; } |
since IntegerInterleavedRaster ultimately extends WritableRaster, we can look at the method there 1 2 3
| public DataBuffer getDataBuffer() { return dataBuffer; } |
and finally, in DataBufferInt 1 2 3 4
| private int[] data; public int[] getData() { return data; } |
so the method outlined will get you a reference to the underlying int array, for INT_ RGB or ARGB images.
|
|
|
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: Questions about TGA Files
|
on: 2006-11-28 09:43:02
|
TBH, I don't really see the need to store my images as TGA. Loading times are trivial whichever format you use and it would make more sense in my mind (just a feeling) to use a more "advanced" format like PNG. For some reason, to me, a project feels more "robust" and "mature" when it uses PNGs instead of TGAs. silly ofcourse... oh well.. just my 2ct's 
|
|
|
|
|
9
|
Java Game APIs & Engines / Tools Discussion / Re: Creating my own 'pak' file creator
|
on: 2006-11-17 12:20:32
|
Who the hell would store ~40GB of data in ONE file?
Beside polygons, models, textures, i'm also storing point clouds, where a single point of such an cloud consist of an (x, y z ) (r, g, b) ( u,v ) and (normal.x, normal.y, normal.z) since this data is coming from a laser scanner it are billions of points(which are then divided in an octree) so 40 gig is not that much Perhaps it would make sense in this case to use a database instead of a file-structure?
|
|
|
|
|
11
|
Java Game APIs & Engines / Xith3D Forums / Re: Quality Code
|
on: 2006-11-15 16:05:51
|
|
disclaimer: I'm just another programmer who doesn't contribute anything to xith.
from my work experience in tons of java projects (brackets at the same line) and .NET projects (brackets at the next line) ...
it doesn't matter one bit. Readability of bracketplacing is as measurable and objective as your personal experience of the color blue.
Personally I prefer brackets at the same line, but only because I'm used to it. Decide on a contract, interface, design etc and let the coder do his thing.
At work we let the editor's "reformat' options (eclipse & visual studio) decide.
Readability is very subjective and never really worth it to debate/enforce it beyond "good enough".
|
|
|
|
|
13
|
Java Game APIs & Engines / JInput / Re: tablets & jinput
|
on: 2006-04-09 16:30:10
|
Thats odd. My touchpad on my laptop has a pressure reading  , although it's not listed as such. So using JInput, how would you get to that data, could you give an example?  (forgive my laziness)
|
|
|
|
|
14
|
Java Game APIs & Engines / JInput / Re: tablets & jinput
|
on: 2006-04-09 16:20:36
|
Hi I would *hope* these days, that directx exposes information on the tablets. Under linux the event API does it, and jinput sits right on that. So it *should* 'just work'. I have *no* idea how it would work on the DS, unless someone gets me one and a dev kit, I’ll never find out either  Endolf well the DS was just an example of a device which has great games using a pen.  To be honest I'm only really interested to get pressure data (and 'it would be nice' to be able to get other data such as tilt) from tablets on the 3 PC platforms (windows, mac, linux). With my tablet the stylus just appears as a regular mouse, I have no idea if it's possible to get the pressure out of it that way though.
well, the jinput api doc (don’t know about version 2 though) defines a 1
| Controller.Type.TRACKPAD |
which is described as "A trackpad, such as a tablet, touchpad, or glidepad; note that this may sometimes be treated as a type of mouse." I don't have a tablet right now (but I'm going to buy one next week) so I cannot test it right now, but I had some ideas I wanted to work on and I went on searching for information on tablets and java. I do believe JInput would benefit from exposing such information, but I don't know how hard it is to actually implement. (this remark is in case it is not possible, but perhaps it is... I'll go and poke around JInput 2, perhaps I can find some more clues there ^_^)
|
|
|
|
|
17
|
Game Development / Performance Tuning / Re: png reading
|
on: 2006-04-01 10:43:00
|
|
jpeg is lossy with no transparancy mask gif is 256 color only with a 1 bit mask
png is far more advanced than either format. How exactly are they 'recommended'?
also, the problem was about dynamic loading of map portions, not about image formats.
|
|
|
|
|
19
|
Discussions / Miscellaneous Topics / Re: Oblivious
|
on: 2006-03-26 15:44:31
|
|
6600GT, 1gb ram, 2.4 ghz P4. Settings on 'medium' and it runs as smooth as silk. It does crash sometimes... (every 5 hours ofzo). I love this game ^_^
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Re: Want to make some small games in Java, am I realistic? And need advice on JO
|
on: 2006-03-23 12:39:25
|
- Where can I find some free graphics and character animations? I am more into programming and do not like to spend too much time on the graphics, although I can do them pretty well if I have to well, you can look here: http://sprites.fireball20xl.com/and here: http://www.java-gaming.org/forums/index.php?topic=8246.0- Does anyone have a good tutorial on how to be able to make a little game with a network and internet (IP) interface, so online multiplaying can be achieved? Is this a realistic goal for me to try this out, or will this take way too long to accomplish? too long depends on what you want to do and what your definition of 'too long' is.  There are numerous threads on this forum about this subject, and basic client/server networking isn't that hard with java. Basically you have to ask yourself how 'synchronized' you want things to be. Personally I would recommend to assume the client has a crappy connection. Keep the game state on the server based on the input of the client, but on the client side interpolate between what you receive from the server. (and assume lost packets and long ping times) - I also want to make a few simple 3D games. However, I have tried out both JOGL and LWJGL. I like them both but they both seem to be pretty platform dependent as they need the native libraries. How exactly can I make it happen that any 3d game I make will work with JOGL/LWJGL on any platform? I am using Netbeans by the way. Can I just add jogl.jar or lwjgl.jar to my project and import them inherently? What do I then do with all the natives from all the different systems? If I link to them, will they also be compiled in my eventual jar file? So the person who tries to play my game will not need to habe jogl/lwjgl installed himself? Well, if you use java webstart for example, you can distribute both the lbrary as well as the native files (which are neccessary btw) and only the native files which the user needs through the specification of your webstart. I've stopped being afraid of native libraries. Its very easy. In your project, just import lwjgl or jogl. and have the native libraries available on your classpath. - I saw a GLUT class somewhere in net.games.jogl. but I didn't see the possibility to really use the glut API like I am used to in C++ for example, I didnt see the glut function to draw a sphere. I am pretty sure GLU has one too though right? Is GLUT still in development for JOGL? Well, for JOGL I'm not sure, but for LWJGL things have been shuffled around a bit. For example, there is a Sphere class, not a Sphere function. But I bet you can find most of the functionality of GLUT, their location, naming and implementation has just been shuffeled around. - Do you think it is realistic for me to make little games in my spare time using Java? With little games I mean small 2d games with the complexity of something like bomberman. I got some ideas of my own too and I want to try to make some original but simple games, such that I can make them on my own, or maybe in a small group of enthousiasts. With 3D I will try to make some simple games too, like a racing game, or a fighting game, maybe a small fps. I am pretty sure I can program it all, I just need to get my hands on some graphics! I'm pretty sure all of what you want can be done in your spare time. Especially the more simpler games can be done within a few weeks with only an hour a day. And since you already have that much experience with OpenGL and such it shouldn't be too much of a problem. Anyways, my main purpose of this post was to get active on these forums. I am looking around on the forums as we speak to find some answers on the questions I posted here. Looking forward to your contributions and games
|
|
|
|
|
21
|
Game Development / Performance Tuning / Re: A poor man's struct (err, MappedObject)
|
on: 2006-03-22 19:06:11
|
Here are my results for both benchmarks. (including suggested improvements) Benchy 1 2 3 4 5 6 7 8 9
| before FloatBuffer.allocate() float[]: 211ms unsafe: 218ms floatbuffer (direct): 304ms
after FloatBuffer.allocate() float[]: 249ms unsafe: 219ms floatbuffer (direct): 1150ms |
UnsafeDemo: 1 2 3 4 5 6 7 8
| Array time: 30.98215 ms x array= 1.24908006E9 unsafe time 52.641886 ms x unsafe= 1249216512 Floatbuffer time: 31.53641 ms x array= 1.24949581E9 Directbytebuffer2float time: 101.041054 ms x array= 1.14874189E9 |
|
|
|
|
|
22
|
Game Development / Shared Code / Re: Fastest get2fold algorithm
|
on: 2006-03-21 13:35:04
|
Interesting results. Here are my results of your (slightly tweaked) benchmark: (numbers in seconds, lower is better) 1 2 3 4
| Total Math.log method time: 35.26507531 Total Rolled out BS method time: 0.453305379 Total Shifty method time: 1.676443794 Total Logical method time: 0.957726191 |
(basically increased NUM to 5000000, changed System.currentTimeMillis() to System.nanoTime(), formatted the output to be in seconds and added all times from all runs of which you see the result here)
|
|
|
|
|
25
|
Discussions / Miscellaneous Topics / Re: SUN Starfire
|
on: 2006-03-17 23:08:26
|
|
One thing which I find funny is that when you look at "in-the-future" movies made in a few decades ago, is that the technological advances/dreams are there, but socialogical aspects always remain stuck in the 'then-current' timeframe. The way the woman and the men interact, the haircuts they have, the clothing, the language... everything still screams "1994! 1994! 1994!".
|
|
|
|
|
26
|
Discussions / General Discussions / Re: RuneScape is #1 on miniclip.com
|
on: 2006-03-17 22:24:48
|
* Markus_Persson fails to see the connection between those two statements. What I meant is that what ever the language/technologies used, what makes a game a success is the contents and game play more than the visuals. We have a live example here.  a good example of this is Dofus Online a quite successfull niche-MMORPG in *drumroll* stand-alone flash!. you can sign up for a trial account if you like.
|
|
|
|
|
28
|
Game Development / Shared Code / Re: MoreMath (FastMath)
|
on: 2006-03-15 19:51:51
|
...continued from post #1...1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
| public static int ceil(float f) { if (f > 0) { return (int)f + 1; } else { return (int)f; } }
public static int floor(float f) { if (f >= 0) { return (int)f; } else { return (int)f - 1; } } public static int round(float f) { return (int)MoreMath.floor(f+0.5f); }
public static boolean isPowerOfTwo(int n) { return ((n & (n-1)) == 0); } public static int getBitCount(int n) { int count = 0; while (n > 0) { count+=(n & 1); n>>=1; } return count; } public static float pow(float x,int n) { if(n == 0) { return 1; } else { float y = x; for(int i=1; i!=n; i++) { y *= x; } return y; } } public static int abs(int x) { if(x < 0) { return (-x); } return x; } public static float abs(float x) { if(x < 0) { return (-x); } return x; } public static int convertToARGB(int alpha,int c1,int c2,int c3) { return ((alpha << 24) | (c1 << 16) | (c2 << 8) | c3); } public static int convertToARGB(float alpha,float[] x) { return convertToARGB((int)(alpha*255),(int)(x[0]*255),(int)(x[1]*255),(int)(x[2]*255)); } public static int convertToRGB(int c1,int c2,int c3) { return ((c1 << 16) | (c2 << 8) | c3); } public static int convertToRGB(float[] x) { return convertToRGB((int)(x[0]*255),(int)(x[1]*255),(int)(x[2]*255)); } public static void convertFromRGB(int color,float[] dest) { dest[0] = (float)((color >> 16) & 0xFF) * ARGB_DECONVERT_SCALING; dest[1] = (float)((color >> 8) & 0xFF) * ARGB_DECONVERT_SCALING; dest[2] = (float)(color & 0xFF) * ARGB_DECONVERT_SCALING; } public static float[] convertFromRGB(int color) { float[] x = new float[3]; convertFromRGB(color,x); return x; } public static float getAlphaf(int color) { return (float)((color >> 24) & 0xFF) * ARGB_DECONVERT_SCALING; } public static float getRedf(int color) { return (float)((color >> 16) & 0xFF) * ARGB_DECONVERT_SCALING; } public static float getGreenf(int color) { return (float)((color >> 8) & 0xFF) * ARGB_DECONVERT_SCALING; } public static float getBluef(int color) { return (float)(color & 0xFF) * ARGB_DECONVERT_SCALING; } public static int getAlphai(int color) { return (int)((color >> 24) & 0xFF); } public static int getRedi(int color) { return ((color >> 16) & 0xFF); } public static int getGreeni(int color) { return ((color >> 8) & 0xFF); } public static int getBluei(int color) { return (color & 0xFF); } } |
|
|
|
|
|
29
|
Game Development / Shared Code / MoreMath (FastMath)
|
on: 2006-03-15 19:51:17
|
Hey, I found this in a realtime raytracing software thingie which I downloaded a long time ago. Could be interesting. Unfortunately there was no README or something in the package so I cannot give credit to the person who wrote this. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
| public class MoreMath { private static final int SIN_TABLE_SIZE_BITS = 12; private static final int SIN_TABLE_SIZE = 1 << SIN_TABLE_SIZE_BITS; private static final int SIN_TABLE_SIZE_MASK = SIN_TABLE_SIZE - 1; private static final int SIN_HALF_PI = SIN_TABLE_SIZE / 4; private static final float SIN_CONVERSION_FACTOR = (float)(SIN_TABLE_SIZE / (2*Math.PI)); private static float[] sinTable; private static final int ASIN_TABLE_SIZE = 2001; private static final float ASIN_CONVERSION_FACTOR = (float)((ASIN_TABLE_SIZE-1) / 2); private static float[] asinTable; private static final int SQRT_TABLE_SIZE = 1025; private static final float SQRT_CONVERSION_FACTOR = (float)((SQRT_TABLE_SIZE-1)); private static float[] sqrtTable; public static final float PI = (float)(Math.PI); public static final float HALF_PI = (float)(Math.PI / 2.0); public static final float TWO_PI = (float)(Math.PI * 2.0); public static final float PI_INV = (float)(1.0 / Math.PI); public static final float HALF_PI_INV = (float)(2.0 / Math.PI); public static final float TWO_PI_INV = (float)(1.0 / (Math.PI * 2.0)); private static final float ARGB_DECONVERT_SCALING = 1f / 255f; static { init(); } private static void init() { sinTable = new float[SIN_TABLE_SIZE]; for(int i=0; i<SIN_TABLE_SIZE; i++) { sinTable[i] = (float)Math.sin(i / SIN_CONVERSION_FACTOR); } asinTable = new float[ASIN_TABLE_SIZE]; for(int i=0; i<ASIN_TABLE_SIZE; i++) { asinTable[i] = (float)Math.asin((i / ASIN_CONVERSION_FACTOR) - 1); } sqrtTable = new float[SQRT_TABLE_SIZE]; for(int i=0; i<SQRT_TABLE_SIZE; i++) { sqrtTable[i] = (float)Math.sqrt(i / SQRT_CONVERSION_FACTOR); } } public static float sqrt(float x) { if(x>1) { return (float)Math.sqrt(x); } return sqrtTable[(int)(x*SQRT_CONVERSION_FACTOR)]; } public static float cos(float angle) { return sinTable[(SIN_HALF_PI-((int)(angle * SIN_CONVERSION_FACTOR))) & SIN_TABLE_SIZE_MASK]; } public static float sin(float angle) { return sinTable[((int)(angle * SIN_CONVERSION_FACTOR)) & SIN_TABLE_SIZE_MASK]; } public static float acos(float x) { if(x > 1) { x = 1; } else if(x < -1) { x = -1; } return (HALF_PI-asinTable[((int)((x+1) * ASIN_CONVERSION_FACTOR))]); } public static float asin(float x) { if(x > 1) { x = 1; } else if(x < -1) { x = -1; } return asinTable[((int)((x+1) * ASIN_CONVERSION_FACTOR))]; }
public static int sign(short v) { return (v>0)?1:(v<0)?-1:0; }
public static int sign(int v) { return (v>0)?1:(v<0)?-1:0; }
public static int sign(long v) { return (v>0)?1:(v<0)?-1:0; }
public static int sign(float v) { return (v>0)?1:(v<0)?-1:0; }
public static int sign(double v) { return (v>0)?1:(v<0)?-1:0; }
|
.. continued..
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|