[java] java tile engine

Started by
6 comments, last by deakin 23 years, 3 months ago
Recently I''ve been working on a simple tile engine in Java. The basics of it are as follows: Tile images are stored in an array Map contains array of ints referencing to images Screen draws only the tiles on screen While this is relatively simple, scrolling around the map is quite slow. I''m running the application in a JFrame, would using Swing cause much of a slowdown? Thanks, - Daniel My homepage
- DanielMy homepage
Advertisement
Yes, the middle name of Swing is "slowness". Avoid Swing in high performance games.

BTW, I am writting a 3d tiled engine in Java. It is 3D texture mapped and currently scrolls at around 60 frames per second (depending on how much geometry you put on screen). See *early* screen shots at www.rolemaker.dk and go to the screen shots section.

Jacob Marner
Jacob Marner, M.Sc.Console Programmer, Deadline Games
Thanks - I started using multiple JPanels in the game''s main window today and started getting major problems, so I''ve changed it all to use the AWT.

Is your game engine running under a JRE, or is has it been compiled to a native executable format? I imagine that 60 frames per second would be very good for an engine running under a JRE.

- Daniel
My homepage
- DanielMy homepage
The 60 fps is while running under JDK 1.2 interpreted. I intend later to use my native compiler (supports only JDK 1.2) so that is why I am using JDK 1.2 instead of 1.3 which is faster.

A large part of the engine is written in C++ and that keeps the frame rate up, but most of the code that is part of the game is written in Java.

Read about the principle I am using here:

http://www.rolemaker.dk/articles/WhyJavaCanBeUsedForGames/index.htm

All the C++ parts are isolated in seperate libraries that is open source:

http://www.rolemaker.dk/JWindows/index.htm
and
http://www.rolemaker.dk/JWindows/6DX/index.htm

And will only run on a system with a 3D card and directX 7 support.

Jacob Marner
Jacob Marner, M.Sc.Console Programmer, Deadline Games
Felonius, i really didnt understand why you are using java for your game...What''s the real advantage respect an implementation using C++ only?
i think you "write many times to run in a single place"... sigh..
koatto,

Did you read the article I referred to above?

To summarize, the point is that Java is a language that is easier to use than C++ and gives the programmer a higher productivity. This is documented through several reports.

I cannot write my game fully in Java because that will be to limited so I split it up and write some things in C++ (those running most often and doing low level stuff) and the rest in Java. This way I can get the best of both worlds.

I am quite proficient in both Java and C++, and if it wasn''t for the speed difference and the fact that not all APIs are available directly to Java I would you 100% Java.

The fact that Java is fully portable makes it easier to port between compilers on the Windows platform, but that it doesn''t work outside the Windows platform is none of my concern. I really don''t care that Java is cross platform - I like it as a language.

I hope that answers your question.

Jacob Marner
Jacob Marner, M.Sc.Console Programmer, Deadline Games
The moral of this story, deakin... You can''t make decent games with java unless you pump it up with c.
quote:Original post by Jim_Ross

The moral of this story, deakin... You can''t make decent games with java unless you pump it up with c.


Or rather, you can''t do Java at all without C. Most of the standard libraries and the Java VM itself is written in C.

The point in using Java is that C is being hidden so many things become easier. Whether some C module is written by a 3rd party developer or is part of the Java standard doesn''t really change anything (except if you are concerned about portability).

If you want speed and don''t care that your productivity might be low then C is the solution - or even "better" use assembler for your full game.

Jacob Marner
Jacob Marner, M.Sc.Console Programmer, Deadline Games

This topic is closed to new replies.

Advertisement