Show Posts
|
|
Pages: [1] 2
|
|
1
|
Java Game APIs & Engines / Java 2D / Re: Isometric 2.5d transformations
|
on: 2012-10-10 20:15:14
|
You might consider doing this.
I think minecraft stores blocks as either int, or short or char at runtime. (I think it saves as byte, but I'm not sure...)
They are. The block id's are stored as bytes in a byte array in the chunk. I also store the entire model of the chunk so I can loop through that array every frame update to draw the chunk, rather than recreate all the polygons every step (which would be MUCH slower).
|
|
|
|
|
2
|
Java Game APIs & Engines / Java 2D / Re: Isometric 2.5d transformations
|
on: 2012-10-10 00:00:41
|
Notice the view-distance; about the length of an arm. =S
In that picture, the view distance is about the same as Minecrafts "short" render distance, perhaps slightly farther. The lag isn't from drawing, but inefficiencies in the code. I can get almost double that rendering distance (which is about a little farther than minecrafts "normal" rendering distance), and get 30-50 fps  The problem is that each block is stored as a Model object, and each Model has polygon objects, and each polygon has Vertex objects. If I can completely get rid of the vertices, and have them as variables inside the polygon, then I could potentially get a much higher frame rate. However, this is a really impractical thing to do 
|
|
|
|
|
3
|
Java Game APIs & Engines / Java 2D / Re: Isometric 2.5d transformations
|
on: 2012-10-07 15:57:38
|
... ... Seriously, did you REALLY create that? (Where did you get those models, btw) And how fast was it running? I'm skeptical. But cool stuff, bro  The models are made in code  I used a little bit of Notches code (from his old player running animation applet used for testing minecraft skins) in order to learn how polygonal rendering worked. Then I made a running character in java, then a block, then a chunk, then multiple chunks, then I created my own frustum culling, then I made random terrain, then I started some simple player physics, and viola!  I get about 50-100 fps while running the game (I get about 30-200 fps in minecraft) 
|
|
|
|
|
4
|
Java Game APIs & Engines / Java 2D / Re: Isometric 2.5d transformations
|
on: 2012-10-07 00:19:18
|
You can't do much more than wireframe and/or opaque, solid colored surfaces, with isometric projection in Java2D.
Though, you can still make some pretty cool 3d stuff with just Graphics2D  this is a project I started, that was made with just Java (using Graphics2D for rendering): 
|
|
|
|
|
7
|
Games Center / Showcase / Re: JGadget - fake 3d rendering in Java
|
on: 2012-07-05 04:46:12
|
He uses volatile images and he probably enables Java2D OpenGL pipeline. In my humble opinion, he should use spatial subdivision and various culling methods to improve the performance of JGadget.
Well, If I were better at math, I would figure out which walls in the players view can't actually be seen (behind other walls) and then not draw them  ! However, Math isn't my strongest of subjects.
|
|
|
|
|
8
|
Games Center / Showcase / Re: JGadget - fake 3d rendering in Java
|
on: 2012-07-04 06:04:55
|
Do what? Calculating the points was the hardest thing to do in this engine (and it still wasn't even that complicated  ) just a very slight amount of trigonometry (and I only just passed Geometry in school  ). Once you have all the points, texturing is as simple as drawing vertical images that are of different sizes, and only draw part of a whole texture (to get that skewed texture effect). 
|
|
|
|
|
9
|
Games Center / Showcase / Re: JGadget - fake 3d rendering in Java
|
on: 2012-07-04 00:27:59
|
It could really need some (i.e. a lot of!) optimizations...i tried it on an old AthlonX2 @ 2.4Ghz and the fps display never exceeded 5fps...and it felt even slower.
There isn't a lot of optimizations I can do for the engine, except change what is used to draw all the graphics  .
|
|
|
|
|
11
|
Game Development / Newbie & Debugging Questions / [JAVA2D] Texturing a trapezoid (fake 3d engine)
|
on: 2012-07-03 01:26:12
|
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
| double top1 = Math.round(this.tempy + (this.newCamera.camz - this.z * 9.0D) * this.scale1); double top2 = Math.round(this.tempy + (this.newCamera.camz - this.z * 9.0D) * this.scale2); double bottom1 = Math.round(this.tempy + (this.newCamera.camz - this.z * 9.0D) * this.scale3); double bottom2 = Math.round(this.tempy + (this.newCamera.camz - this.z * 9.0D) * this.scale4); if ( (point1 > view_width && point2 > view_width && point3 > view_width && point4 > view_width) || (top1 > view_height && top2 > view_height && bottom1 > view_height && bottom2 > view_height) || (top1 <= 0 && top2 <= 0 && bottom1 <= 0 && bottom2 <= 0) || (point1 <= 0 && point2 <= 0 && point3 <= 0 && point4 <= 0) ){ return; }
double length = point_distance(point1, top1, point2, top2); double dist1 = point_distance(point1, top1, point3, bottom1); double dist2 = point_distance(point2, top2, point4, bottom2); double direction1 = point_direction(point1, top1, point3, bottom1); double direction2 = point_direction(point2, top2, point4, bottom2); if (Math.abs(direction2 - direction1) > 180) { if (direction2 < direction1) { direction2 = 360; }else{ direction1 = 360; }
} double repeat = (int) Math.ceil(length / 3.5D); if (repeat <= 8) repeat = 8; if (repeat > 32) repeat = 32; int cellwidth = (int) Math.ceil( length/repeat ); Graphics2D g2d = (Graphics2D)g; double number = point2 - point1; double changex = number / repeat; double changey = (top2 - top1) / repeat; double changedir = (direction2 - direction1) / repeat; double changedist = (dist2 - dist1) / repeat; double cellwidthintex = sprite_height/repeat; for (int ii = 1; ii <= repeat+1; ii++) { int i = ii; if (x >= newCamera.getX()) { i = (int) (repeat + 2 - ii); } double dx = point1 + (changex * i); double dy = top1 + (changey * i); double rx = dx; double ry = dy; double dir = direction1 + (changedir * i);
draw_set_rotation(g2d, dir, rx, ry); double dist = dist1 + (changedist * i);
int sy1 = (int) (cellwidthintex * (i - 1)); int sx1 = 0; int sy2 = (int) (sy1 + cellwidthintex); int sx2 = this.sprite_width; g.drawImage(this.sprite_index, (int)dx, (int)dy, (int)dx + (int)dist, (int)dy + (int)cellwidth + 1, sx1, sy1, sx2, sy2, null);
draw_set_removerot(g2d, dir, rx, ry); } |
What the above code does, can be slightly explained from this picture:  If you need me to explain anything else, please ask 
|
|
|
|
|
14
|
Discussions / General Discussions / Re: [Java2D] slower on macs?
|
on: 2012-07-02 16:27:48
|
Also begs the question: is this the old Apple JDK or is it the new Oracle JDK 7 Mac release?
Although the Oracle version seems to have most of the stuff from the old Apple JDK ported over.
New one. It's also slow with just a plain install of Java (not the jdk).
|
|
|
|
|
15
|
Games Center / Showcase / Re: JGadget - fake 3d rendering in Java
|
on: 2012-07-02 06:39:42
|
1 2 3 4 5 6 7 8 9
| java.security.AccessControlException: access denied ("java.util.PropertyPermission" "sun.java2d.opengl" "write") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.System.setProperty(Unknown Source) at engine.WebLauncher.init(WebLauncher.java:43) at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) |
Should be fixed now (on the gamejolt one)
|
|
|
|
|
20
|
Games Center / Showcase / Re: JGadget - fake 3d rendering in Java
|
on: 2012-07-01 22:43:37
|
I like the retro feel of it, but it has some rendering flaws. It seems to lack perspective correction and at some angles, it renders...this...  Ultra, far, and fog... 30 fps? Your hardware rocks O: I'll try to fix that  The reason it occurs is because of the really cheap trick I used to even allow floors to work 
|
|
|
|
|
23
|
Discussions / General Discussions / [Java2D] slower on macs?
|
on: 2012-07-01 19:12:41
|
|
Java seems to be a lot slower on the mac OS, or at least when I use Java2D with it. Is this normal? or just the computer? A game I made awhile ago, called Mineblock, ran perfectly on my laptop (with windows). When that computer broke, I continued to develop it on my dads computer, a 27 inch mac desktop[size=6pt][3.3 GHz quad core processor][/size] (with much better hardware than my laptop [size=6pt][2.13 GHz dual core processor][/size]), however the frame rate in it was MUCH slower.
|
|
|
|
|
25
|
Games Center / Showcase / Re: JGadget - fake 3d rendering in Java
|
on: 2012-07-01 16:54:36
|
Pretty nice, applet was focusable for me (Vista, FF13). Any plans to actually release the source, or actually make a mini-game out of it? yes and yes  Though I doubt the source would be very useful. Please can you deploy your game somewhere else? Sure :3
|
|
|
|
|
27
|
Games Center / Showcase / JGadget - fake 3d rendering in Java
|
on: 2012-07-01 03:14:06
|
Gadget3D, which was originally created for Game Maker (during Game Maker 4 [so I would assume 2004-ish]), was the game engine's first "3d" engine, before they had support for directX. I found an old copy of it on my computer some months ago, and decided to recreate it in java, only adding more abilities to it. Basically, all this engine is, is a bunch of textured rectangles that are drawn at specific points (which are positioned by using simple trig.), and are sorted by depth.   Controls: WSAD = move Space = jump Ctrl = crouch 1 = pistol 2 = flamethrower LMB = fire Q/E = turn G = change quality H = change render distance F = turn off/on fog. http://gamejolt.com/online/games/other/jgadget-2-0/8323/or http://globalanarchy.net84.net/Java/JGadget/It may be a little slow, not only because I use Java2D, but also because I don't use it efficiently  (feel free to decompile the source, and give me some pointers on how to make my draw calls more efficient).
|
|
|
|
|
28
|
Game Development / Newbie & Debugging Questions / Re: Texturing a polygon (Graphics 2d)
|
on: 2011-09-05 02:42:34
|
 I got it working 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
| double ntop = top * 9.0; double nbottom = bottom * 9.0; int basey = (view_height/2); double top1=basey+(newCamera.z-ntop)*scale1; double top2=basey+(newCamera.z-ntop)*scale2; double bottom1=basey+(newCamera.z-nbottom)*scale1; double bottom2=basey+(newCamera.z-nbottom)*scale2; double difBot=bottom2-bottom1; double difTop=top2-top1;
int current=0; double res=Math.floor((scale1+scale2)/4)+1; double number=point2-point1; for (int i = 0; i <= Math.floor((number+res)/res); i += 1) { double curTop=current/number*difTop+top1; double curBot=current/number*difBot+bottom1; int dx1 = (int) (point1 + current); int dy1 = (int) curTop; int dx2 = dx1 + (int)res; int dy2 = dy1 + (int) Math.ceil((curBot-curTop)); int sx1 = (int) Math.round(Math.floor((double)current/number*((double)sprite_width-1.0))); int sy1 = 0; int sx2 = sx1 + 1; int sy2 = sprite_height; g.drawImage(sprite_index, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); current+=res; } |
if anyone wants to know
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|