Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Transport Tycoon goes Java  (Read 13586 times)
0 Members and 1 Guest are viewing this topic.
Offline Grand Poeba

Junior Member





« Posted 2006-01-12 23:39:24 »

Hi,

I am trying to make a java version of the very cool and addictive game Transport Tycoon (Deluxe)
But I am having trouble with the graphics as i dont get a high fps
so I look for ppl who want to help with me with the graphics engine bcz mine isnt so performant

If you would like to help you can post it here or send me a private message

thx alot

PS: if u dont know transport tycoon go to http://openttd.org for some screens and more
Offline hvor2

Junior Member




Beyond mind, there is an awareness...


« Reply #1 - Posted 2006-01-13 08:10:11 »

Wow! I liked TT very much. I was addicted to it.
What are you comparing your code with when you say your graphics engine isn't so performant?
Are you using Java2D, or some openGL bindings?
I have really little time nowdays, but maybe I could help with some issues.
cheers!

Offline Grand Poeba

Junior Member





« Reply #2 - Posted 2006-01-13 13:08:40 »

Wow! I liked TT very much. I was addicted to it.
What are you comparing your code with when you say your graphics engine isn't so performant?
Are you using Java2D, or some openGL bindings?
I have really little time nowdays, but maybe I could help with some issues.
cheers!

I am using full-screen exclusive awt mode at the moment but with that comes i have to redraw
my whole screen each frame. It can contain 1000 tiles ( at 1024*768) so this takes so much time
the game is beginning to run really slow and get only 30 fps orso.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline g666

Junior Member





« Reply #3 - Posted 2006-01-13 14:21:27 »

30fps is playable but if u want it to get faster then try switching to opengl thru lwjgl. It will be much faster.

desperately seeking sanity
Offline Grand Poeba

Junior Member





« Reply #4 - Posted 2006-01-13 15:02:47 »

30fps is playable but if u want it to get faster then try switching to opengl thru lwjgl. It will be much faster.

as i explained in another topic i tried using xith3d to opengl accelerate it but my images get screwed up
so my map looks so ugly. Java2d gives the best graphical result but it is very slow
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 802
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2006-01-13 16:13:45 »

Xith3D != LWJGL

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Grand Poeba

Junior Member





« Reply #6 - Posted 2006-01-13 16:37:27 »

Xith3D != LWJGL

it can use that renderer so in fact they use the same things. Same goes for jogl
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 802
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2006-01-13 17:08:49 »

if A uses B, then A is B? Roll Eyes

And if your images get screwed up, that's a bug in your code, that's not due to hardware acceleration.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Grand Poeba

Junior Member





« Reply #8 - Posted 2006-01-13 18:45:51 »

if A uses B, then A is B? Roll Eyes

And if your images get screwed up, that's a bug in your code, that's not due to hardware acceleration.

why would that be a bug in my code?

i just load the texture and display it not much more i can do with it

this is my java2D version  http://users.skynet.be/fa006997/Test.jar
it render 250 frames and then gives you the fps
Offline g666

Junior Member





« Reply #9 - Posted 2006-01-13 19:57:24 »

Xith3D != LWJGL

I didnt suggest that it was. but is Xith3D really suitable for what hes trying to do? just using ogl on its own would be simpler and probly faster i think.

desperately seeking sanity
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline g666

Junior Member





« Reply #10 - Posted 2006-01-13 19:59:14 »

And if your images get screwed up, that's a bug in your code, that's not due to hardware acceleration.

why would that be a bug in my code?

i just load the texture and display it not much more i can do with it


Maybe you arent loading it right?

desperately seeking sanity
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 802
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2006-01-13 20:25:25 »

Yes, JOGL/LWJGL is what he needs, not a scene-graph like Xith3D, but he seems stuck in the idea it's all the same.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Bombadil

Senior Member





« Reply #12 - Posted 2006-01-13 20:43:03 »

I run the test.jar and I think Java2D is capable of rendering many more sprites per frame.
There are some important points to note however, so for example to make them hardware accelerated by Java.
Many of these notes have been discuessed in the forum's 2D threads. I'm pretty sure some Java2D experts read so please: comment. :-) Thanks.
Kevin's currently moving, so we'll have to wait for his comments. Still his (?) FAQ is nice and helpful IMO: http://wiki.java.net/bin/view/Games/FAQ#2D_Rendering

Just in case the correct way to use Java2D doesn't bring the performance you need then I'd go the OpenGL route. However, I can't imagine you'd need the direct metal OpenGL way to do a isometric simulation.


P.S. Chris Sawyer rules. Together with D. Braben one of the - if not the - brightest minds in the entire video gaming industry. Man, he wrote the entire Rollercoaster Tycoon in Assembler. A real Scottish braveheart. :-)
Offline Grand Poeba

Junior Member





« Reply #13 - Posted 2006-01-13 22:52:26 »

I run the test.jar and I think Java2D is capable of rendering many more sprites per frame.
There are some important points to note however, so for example to make them hardware accelerated by Java.
Many of these notes have been discuessed in the forum's 2D threads. I'm pretty sure some Java2D experts read so please: comment. :-) Thanks.
Kevin's currently moving, so we'll have to wait for his comments. Still his (?) FAQ is nice and helpful IMO: http://wiki.java.net/bin/view/Games/FAQ#2D_Rendering

Just in case the correct way to use Java2D doesn't bring the performance you need then I'd go the OpenGL route. However, I can't imagine you'd need the direct metal OpenGL way to do a isometric simulation.


P.S. Chris Sawyer rules. Together with D. Braben one of the - if not the - brightest minds in the entire video gaming industry. Man, he wrote the entire Rollercoaster Tycoon in Assembler. A real Scottish braveheart. :-)

I have made some small apps with jogl before so i should try and do that then?

For what is worth the following code is used to make a tile texture i did in xith3d (maybe then you why its complety different output):
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  
   private Shape3D createTile (Point3f[] coords)
   {
       return new Shape3D(getGeometry(coords), getAppearance());
   }
   
   private Geometry getGeometry(Point3f[] coords)
   {
        // Define Texture coords for a square shape
       TexCoord2f[] texCoords = new TexCoord2f[] {
             new TexCoord2f(0f, 0f),
             new TexCoord2f(1f, 0f),
             new TexCoord2f(1f, 1f),
             new TexCoord2f(0f, 1f)
        };
       
        QuadArray g = new QuadArray(coords.length, GeometryArray.COORDINATES |
                                                GeometryArray.TEXTURE_COORDINATE_2);
        g.setCoordinates(0, coords);
        g.setTextureCoordinates(0, 0, texCoords);
         
        return g;
   }

    private Appearance getAppearance()
    {              
      BufferedImage bi = null;
         try {
         
         bi = ImageIO.read( new File( "./Images/tile3.png" ));
      }
      catch (java.io.IOException ioe) { ioe.printStackTrace(); }      
      Texture2D texture = (Texture2D)TextureLoader.getInstance().createTexture(bi, false);
     
         TransparencyAttributes transparencyAttributes = new TransparencyAttributes();
         transparencyAttributes.setTransparencyMode(transparencyAttributes.BLENDED);
         transparencyAttributes.setDstBlendFunction(transparencyAttributes.BLEND_ONE);
         transparencyAttributes.setSrcBlendFunction(transparencyAttributes.BLEND_SRC_ALPHA);

         RenderingAttributes renderingAttributes = new RenderingAttributes();
         renderingAttributes.setDepthBufferEnable(false);
         
         TextureAttributes textureAttributes = new TextureAttributes();
         textureAttributes.setTextureMode(textureAttributes.MODULATE);
         textureAttributes.setPerspectiveCorrectionMode(textureAttributes.NICEST);

         Appearance    texturedAppearance = new Appearance();
         texturedAppearance.setTexture(texture);
         texturedAppearance.setTextureAttributes(textureAttributes);
         texturedAppearance.setRenderingAttributes(renderingAttributes);
         texturedAppearance.setTransparencyAttributes(transparencyAttributes);

         return texturedAppearance;
    }



@  Chris Sawyer rules. Together with D. Braben one of the - if not the - brightest minds in the entire video gaming industry. Man, he wrote the entire Rollercoaster Tycoon in Assembler. A real Scottish braveheart. :-)

TT was completely written in assembler, dont know about rt but it is true he roels Smiley
Offline Grand Poeba

Junior Member





« Reply #14 - Posted 2006-01-14 01:48:28 »

I have uploaded a new java2d version which gives me a good 75 fps

1280 * 1024:http://users.skynet.be/fa006997/Test_1280.jar
1024 * 768: http://users.skynet.be/fa006997/Test_1024.jar

Let me know what ya think
Offline Grand Poeba

Junior Member





« Reply #15 - Posted 2006-01-14 23:45:38 »

also i am looking for ppl to help with the multiplayer part because i cant run any of those
netwerk appz :s

For any one who is interested  I will upload a newer version regullary on this site:

studweb.hogent.be/~032660sl/TTGJ/
Offline Bombadil

Senior Member





« Reply #16 - Posted 2006-01-16 09:11:24 »

I've tested the newer benchmarks and still think it's somewhat slow, but well, I'm no Java2D expert.
From what I've seen from Kevin's and other's Java2D examplesI think it should go much faster. Could any Java2D expert please comment?

My own hobby 2d project (a parallax side scroller) is being done in OpenGL (JOGL) with an 1:1 orthogonal view (so no scaling of the bitmap textures) but just because the game's main task (> 75%) is to move textures around on the screen and the whole point is smoothly moving tons of large sprites. :-)

This won't be the case for your Tycoon game, where just a small amount of the game's performance goes into drawing the graphics (25% maybe?).
So I wouldn't worry too much about graphics speed. Because by the time you finish the other parts of your game in Java you'll have evaluated a fast and neat way to plot them in Java2D.
And... of course it's a good idea to encapsulate your internal graphics system so that you can always decide to change the final plotting class(es) of the sprites.

Good luck with your project! There are many Tycoon fans out there.

Btw, I suggest to open another thread on the Java2D sub-forum here: http://www.java-gaming.org/forums/index.php?board=15.0
Not linked to the exact type of the game, but "just" something like: how to do fast isometric plotting with Java2D or such...
Offline Grand Poeba

Junior Member





« Reply #17 - Posted 2006-01-16 18:31:55 »

well it allways needs optimization but some ppl are against threading and other for but i dont know
how much they slow down the system

I will also uplad containing the source code as the current version
Offline Anon666

Junior Member




aka Abuse/AbU5e/TehJumpingJawa


« Reply #18 - Posted 2006-01-27 13:45:52 »

Had a look at the source to the first example, and have to say you are doing some things in very peculiar ways.

Your fps counting for starters is totally crazy, and inaccurate.

Creation of your images is odd too (Transparency class)
why not just load the images with ImageIO, and copy them to a BufferedImage [managed] returned from GraphicsConfiguration.createCompatibleImage.
You shouldn't need to use Toolkit.createImage(ImageProducer) *ever*.

your VolatileImages class is also fundamentally flawed, and quite useless.
Offline Schabby

Junior Member




The Receding Brow Worm will eat your code!


« Reply #19 - Posted 2006-01-28 04:07:43 »

now for something different...
TTD is indeed awesome! My friends and me play OpenTTD almost every evening on the Internet. So I find the idea to port it Java pretty cool and I would be happy to help you concerning the GUI, which makes a pretty big part of TTD. I could provide the in-game window frames, Widgets like tables, text fields, buttons etc.

However, OpenTTD is constantly enhanced and the OpenTTD-Guys drop builds like I change my shorts. Which is why I would like to ask on which version of OpenTTD you rely. And how do you intend to keep up with the enhancements? Or do you just fork from an old version?

Johannes

Offline Grand Poeba

Junior Member





« Reply #20 - Posted 2006-01-29 03:01:32 »

now for something different...
TTD is indeed awesome! My friends and me play OpenTTD almost every evening on the Internet. So I find the idea to port it Java pretty cool and I would be happy to help you concerning the GUI, which makes a pretty big part of TTD. I could provide the in-game window frames, Widgets like tables, text fields, buttons etc.

However, OpenTTD is constantly enhanced and the OpenTTD-Guys drop builds like I change my shorts. Which is why I would like to ask on which version of OpenTTD you rely. And how do you intend to keep up with the enhancements? Or do you just fork from an old version?

Johannes

My intentention is to base the game (GUI and graphics) part on the original TTD and then enhance the gameplay with some features of other sim games which i find more interesting and should have been in  TTD as well like bridge and tunnelbuilding.
Offline Grand Poeba

Junior Member





« Reply #21 - Posted 2006-01-29 03:04:02 »

Had a look at the source to the first example, and have to say you are doing some things in very peculiar ways.

Your fps counting for starters is totally crazy, and inaccurate.

Creation of your images is odd too (Transparency class)
why not just load the images with ImageIO, and copy them to a BufferedImage [managed] returned from GraphicsConfiguration.createCompatibleImage.
You shouldn't need to use Toolkit.createImage(ImageProducer) *ever*.

your VolatileImages class is also fundamentally flawed, and quite useless.

why would my fps counting be inaccurate? I just calculate the time neede to draw a frame so that should be accurate

the reason why i dont use imageio is because just slows down my game sooo much using toolkit is much beter and has the same output

my volatileimages class is idd useless but there are some other classe useless but i just included them because i might them later
Offline chaosdeathfish

Junior Member


Projects: 1



« Reply #22 - Posted 2006-02-07 17:12:49 »

I started writing a TTD clone in java a couple of years ago, but got distracted before I'd written much.. All I did was load the the TTD graphics and levels in and display the landscape.

Still, if you're interested I can dig out my code and send it to you, there might be something useful in there..
Offline Grand Poeba

Junior Member





« Reply #23 - Posted 2006-02-08 23:45:36 »

I started writing a TTD clone in java a couple of years ago, but got distracted before I'd written much.. All I did was load the the TTD graphics and levels in and display the landscape.

Still, if you're interested I can dig out my code and send it to you, there might be something useful in there..

that would be very kind of you for the moment i am a bit stuck with all the menus because i need to draw them myself and catch all the button events and so i am looking for a a way to still use the awt components so i dont have to all that myself
Offline kaffiene
« Reply #24 - Posted 2006-02-09 20:52:19 »

I've tested the newer benchmarks and still think it's somewhat slow, but well, I'm no Java2D expert.
From what I've seen from Kevin's and other's Java2D examplesI think it should go much faster. Could any Java2D expert please comment?

My own hobby 2d project (a parallax side scroller) is being done in OpenGL (JOGL) with an 1:1 orthogonal view (so no scaling of the bitmap textures) but just because the game's main task (> 75%) is to move textures around on the screen and the whole point is smoothly moving tons of large sprites. :-)

Yup, same here.  I started using Java2d, and I found it wasn't quite that smooth in operation, so I switched to JOGL which has worked out much better.  Although, I did also want to put large alpha blended textures into the game once the gameplay was sorted so j2d wasn't really an option for the rethought goals anyway.
Offline Quix0r

Junior Newbie





« Reply #25 - Posted 2007-10-20 10:43:29 »

Just a small question: is this project dead?
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (20 views)
2014-09-24 16:12:06

Grunnt (46 views)
2014-09-23 14:38:19

radar3301 (28 views)
2014-09-21 23:33:17

BurntPizza (64 views)
2014-09-21 02:42:18

BurntPizza (36 views)
2014-09-21 01:30:30

moogie (42 views)
2014-09-21 00:26:15

UprightPath (51 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!