Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  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 Smiley

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 Tongue
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 Grin
The models are made in code Smiley
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! Smiley

I get about 50-100 fps while running the game (I get about 30-200 fps in minecraft) Tongue
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 Smiley

this is a project I started, that was made with just Java (using Graphics2D for rendering):
5  Game Development / Newbie & Debugging Questions / Re: [JAVA2D] Texturing a trapezoid (fake 3d engine) on: 2012-07-05 23:20:38
My advice would be to render in scanline (horizontal) order.  Much simpler.
The camera can turn, there would be no difference.
6  Game Development / Newbie & Debugging Questions / Re: [JAVA2D] Texturing a trapezoid (fake 3d engine) on: 2012-07-05 15:10:32
Any help would be greatly appreciated!
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 Tongue! 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 Tongue) just a very slight amount of trigonometry (and I only just passed Geometry in school Cheesy). 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). Smiley
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 Tongue.
10  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-03 05:16:28
update Smiley
I worked on the guns a little bit, giving them better collisions and a simple smoke particle
press 1 for pistol
press 2 for flamethrower

you can also left click to fire guns
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); //quality of the texturing
           if (repeat <= 8)
               repeat = 8; //need at least 1 draw call per image!
           if (repeat > 32)
               repeat = 32;
           
            int cellwidth = (int) Math.ceil(  length/repeat  ); //width of each image part of the floor
           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++) { //amount of draw calls per image (the more, the better quality)
              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;// - (cellwidth);
              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 Smiley
12  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-03 00:45:55
AMD Brazos E-450
AMD Brazos E-450 1.65GHz? That one? The one with 2 cores?
Well that explains your 10 fps Tongue!
13  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-02 16:28:41
The game-jolt one indeed launches, and prints 'CLICK TO FOCUS' in screen.

Clicking it doesn't make the game start Sad
Works perfectly fine for me D:!
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)
16  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-02 03:58:17
Btw is Prelude Of The Chamber Java2D too ?
It is.
17  Game Development / Newbie & Debugging Questions / Re: Lock mouse in the center of an applet on: 2012-07-02 03:23:06
Google didn't help, how do I sign my applet? o:
Do I have to download a program to do that? At least, that's what I'm getting from a website-tutorial I found.
18  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-02 03:11:33
also writing a 3d shooter in java2D, I dont know if its really cool or really sad Grin
Can I see a demo/pic of yours? Cheesy
19  Game Development / Newbie & Debugging Questions / Lock mouse in the center of an applet on: 2012-07-02 03:10:57
How can I lock the users mouse coordinates in the center of my Japplet? I tried using the robot class (which works only for a JFrame [as a java application]), and it threw security errors.
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 Smiley
The reason it occurs is because of the really cheap trick I used to even allow floors to work Smiley
21  Discussions / General Discussions / Re: Java seems to be a lot slower on macs? on: 2012-07-01 22:33:44
Have you tried doing System.setProperty("sun.java2d.opengl","true");?
There doesn't seem to be a difference in speed when I do that.
22  Discussions / General Discussions / Re: Java seems to be a lot slower on macs? on: 2012-07-01 19:58:15
As far as I know, applets use some offscreen rendering through a compositing layer in OSX, maybe someone can explain it better. Does your game work faster as an application?
It's about the same as both an applet and an application.
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.
24  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-01 17:27:39
It would be useful, I started my own first person shooter by looking at the source code of something very similar in 2006.
What was the thing similar? If you don't mind my asking Smiley
25  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-01 16:54:36
Quote
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 Tongue
Though I doubt the source would be very useful.

Quote
Please can you deploy your game somewhere else?
Sure :3
26  Games Center / Showcase / Re: JGadget - fake 3d rendering in Java on: 2012-07-01 05:56:48
Added a fps counter :3
It's maxed out at 30, the fps.
What are your computers' specs, if you don't mind my asking?
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. Pointing



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 Smiley
(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
Smiley 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
29  Game Development / Newbie & Debugging Questions / Re: Texturing a polygon (Graphics 2d) on: 2011-09-04 22:44:16
So there's no way to UV map a texture to a polygon using Graphics2D?
30  Game Development / Newbie & Debugging Questions / Re: Texturing a polygon (Graphics 2d) on: 2011-09-04 18:31:54
That does what the code I gave before did, just more efficient I guess Tongue

the texture still isn't pinched at the end...
Pages: [1] 2
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
BrassApparatus (9 views)
2013-06-19 08:52:37

NegativeZero (14 views)
2013-06-19 03:31:52

NegativeZero (18 views)
2013-06-19 03:24:09

Jesse_Attard (20 views)
2013-06-18 22:03:02

HeroesGraveDev (62 views)
2013-06-15 23:35:23

Vermeer (61 views)
2013-06-14 20:08:06

davedes (61 views)
2013-06-14 16:03:55

alaslipknot (55 views)
2013-06-13 07:56:31

Roquen (77 views)
2013-06-12 04:12:32

alaslipknot (60 views)
2013-06-10 19:30:18
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!