•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Game Development section within the Software Development category of DaniWeb, a massive community of 456,594 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,499 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Game Development advertiser: Programming Forums
Views: 8970 | Replies: 74
![]() |
| |
•
•
Join Date: Apr 2005
Location: Dundee, Scotland
Posts: 12,883
Reputation:
Rep Power: 32
Solved Threads: 305
Java game engine = slow by the way
Game engine modules usually are:
File I/O (saving,loading)
hard I/O (keyboard/mouse input)
Event handling
AI
Graphics (drawing it)
Resource management (loading the data e.g levels, graphics files, music)
The actual plot etc... is not a part of the engine. e.g one game engine (for example, the unreal engine) powers about 50 different games.
Dont use java though. 99% of game engines are C++ (and maybe a little assembley for the graphics)
Game engine modules usually are:
File I/O (saving,loading)
hard I/O (keyboard/mouse input)
Event handling
AI
Graphics (drawing it)
Resource management (loading the data e.g levels, graphics files, music)
The actual plot etc... is not a part of the engine. e.g one game engine (for example, the unreal engine) powers about 50 different games.
Dont use java though. 99% of game engines are C++ (and maybe a little assembley for the graphics)
TRY MY SUGGESTIONS AT YOUR OWN RISK
Master of puppets Im pulling your strings, blinded by me, you cant see a thing. Master! Master!
Master of puppets Im pulling your strings, blinded by me, you cant see a thing. Master! Master!
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation:
Rep Power: 5
Solved Threads: 48
I can't see any gain in using Java over C++ in games unless it was always much faster in execution speed than C++, or provided some functionality or freedom that C++ doesn't; which it isn't, and doesn't. Like C++, Java can only ever hope to equal the speed of optimized machine code, and if it met the speed of machine code generated from C++ :- so what, it doesn't have the same existing 3rd party useful-for-games libs as C++ does at the moment, the standard library isn't as good ( I like simple and general rather than complex and all-encompasing ) all acccess to the OS/videocard is via a higher abstraction layer as exists in C++, garbage collection is a problem I suppose ( but the same strategy VeAr just outlined - minimizing collection, should be employed for C++ games anyway, i.e. minimizing allocations/deallocations on the heap during time-critical periods of runtime- even pre-arranging heap objects using estimated usage frequency/order, but you couldn't hope to do that in the Java as I know it ), the language architecture just isn't optimum anyway beyond prototyping - if I know the lifetime of an object, and that it should be stack allocated, I want to specify that explicitly in the code, not perhaps imply it in the design.
There's nothing special in Java that doesn't exist in C++, thread stuff is arguably made simpler across different platforms, and the general multiplatform aspect is a good thing - but this doesn't matter if you're releasing for a number of specific platforms. C++ can easily be written in a write once/compile anywhere way, and optimized for either platform at compilation - which is as good as compile once run anywhere in any case I can think of. The only other possible benefit for using one language over another is flexibility, and there's not much between the two, especially in terms of what most games require. A better model IMO is to use C++ and/or C for the raw engine and embed to or call from a very dynamic interpretted language, one that is significantly different to C++, either in terms of capabilities, application scope, or simplicity. Think Lisp, Prolog, Python, Lua or ECMAScript << none of these are 'C++ like', and all have different usefulness/simplicity/structure/writing-style scope. What's the scope of Java that falls outside that of C++???
There are certainly good places to use Java - server applications, mobile phone/web-based games, etc. But not for the client end of a 3D FPS engine on PC/console with hot physics, graphics and the rest. Why even try? You'd have little to rely on in terms of existing libraries, you wouldn't be able to hand optimize the code as far as you can in C++, you'd have to adopt OO religiously and be unable to use an 'objects are laid-out memory' approach anywhere, you'd have to wrestle with a garbage collector and have no idea where allocated objects 'go' rather than being able to just allocate in one place and remember to clean up; and for those setbacks, all you'd potentially gain is speed in that you'd only be writing network/thread code once rather than n times ( where n is the number of target platforms ), and a reflection system which honestly isn't very appropriate during realtime, nor particularly special.
C++ provides all a game developer really needs for the rawest part of the engine; perhaps a scripting framework ( inside or outside ) could augment that, but Java as the scripting language? Might aswell write the whole game in C++.
There's nothing special in Java that doesn't exist in C++, thread stuff is arguably made simpler across different platforms, and the general multiplatform aspect is a good thing - but this doesn't matter if you're releasing for a number of specific platforms. C++ can easily be written in a write once/compile anywhere way, and optimized for either platform at compilation - which is as good as compile once run anywhere in any case I can think of. The only other possible benefit for using one language over another is flexibility, and there's not much between the two, especially in terms of what most games require. A better model IMO is to use C++ and/or C for the raw engine and embed to or call from a very dynamic interpretted language, one that is significantly different to C++, either in terms of capabilities, application scope, or simplicity. Think Lisp, Prolog, Python, Lua or ECMAScript << none of these are 'C++ like', and all have different usefulness/simplicity/structure/writing-style scope. What's the scope of Java that falls outside that of C++???
There are certainly good places to use Java - server applications, mobile phone/web-based games, etc. But not for the client end of a 3D FPS engine on PC/console with hot physics, graphics and the rest. Why even try? You'd have little to rely on in terms of existing libraries, you wouldn't be able to hand optimize the code as far as you can in C++, you'd have to adopt OO religiously and be unable to use an 'objects are laid-out memory' approach anywhere, you'd have to wrestle with a garbage collector and have no idea where allocated objects 'go' rather than being able to just allocate in one place and remember to clean up; and for those setbacks, all you'd potentially gain is speed in that you'd only be writing network/thread code once rather than n times ( where n is the number of target platforms ), and a reflection system which honestly isn't very appropriate during realtime, nor particularly special.
C++ provides all a game developer really needs for the rawest part of the engine; perhaps a scripting framework ( inside or outside ) could augment that, but Java as the scripting language? Might aswell write the whole game in C++.
Last edited by MattEvans : Oct 30th, 2007 at 11:14 pm.
Plato forgot the nullahedron..
•
•
Join Date: Jun 2007
Posts: 32
Reputation:
Rep Power: 0
Solved Threads: 2
well this could go half and half. if your looking to make a shitty browser based game that ever one seems to love like runescape. go with java and java your heart out. if your looking to make a good game engine that makes a good game that everyone loves, go with c++. thats what i think atleast. as far the whole java speed compared to c++ i don't know what my opion is on that. i'll have to look in on it and let you go. but for now i'm saying c++ is faster.
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation:
Rep Power: 19
Solved Threads: 200
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation:
Rep Power: 5
Solved Threads: 48
I'll agree, from experience, for most individual tasks, there's not much speed difference between C++ and Java. However; the rigid paradigm inflicted by Java sometimes restricts certain approaches to problems, approaches which, in some cases, could be faster ( or more memory efficient ) than those afforded by sandboxed pure OO... That still stands today.
Last edited by MattEvans : Sep 12th, 2007 at 1:49 pm.
Plato forgot the nullahedron..
I disagree. Even after all these years, Java still has to go a long way when compared to C++, at least in terms of Game Development. The kind of raw power achieved by C / C++ _can't_ be offered by Java.
Compare and contrast the implementation of different languages in C and Java and you would know what I am talking about (Rhino v/s SpiderMonkey). Although this _slow_ term isn't really justified in normal application development, it stands out when developing games. Plus the inclination of the industry to still use C as the core language to develop the game / graphics engine, regardless of what they use for scripting is enough proof in itself.
But I don't question the theory that the future holds a lot for newer langauges like Java, Ruby, Python but that time is yet to come.
Compare and contrast the implementation of different languages in C and Java and you would know what I am talking about (Rhino v/s SpiderMonkey). Although this _slow_ term isn't really justified in normal application development, it stands out when developing games. Plus the inclination of the industry to still use C as the core language to develop the game / graphics engine, regardless of what they use for scripting is enough proof in itself.
But I don't question the theory that the future holds a lot for newer langauges like Java, Ruby, Python but that time is yet to come.
I don't accept change. I don't deserve to live.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Game Development Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
advertising ajax asp blogging browser business code console development engine firefox game games google hardware intel internet java linux marketing math microsoft mozilla msdn news nintendo playstation programming ps3 revenue rss search security seo software sony stocks technology video video game vista w3c web web development wii wiki windows xbox 360 xml yahoo
- Java Game Engine for a Game called "Attaxx". (Game Development)
- Game engine for car engine (Game Development)
- Game engine (C++)
- Game Engine Code [Help] (Game Development)
- Game Engine (C++)
Other Threads in the Game Development Forum
- Previous Thread: Help me whit algorithm for my web-based game
- Next Thread: Can you have a look to my game?



Hybrid Mode