![]() |
| | #1 |
| Woof, woof! Join Date: Mar 2007 Location: Australia
Posts: 3,297
| Java for real-time applications Since there are a lot of C++ programmers on here (who, stereotypically hate java) I thought I'd ask... Background: I've been playing around with C for a couple of years, currently almost at the end of my first of four years in a Software Engineering degree having only used Java since the start of 2008. And getting rather competent in it, possibly thanks to my C background. I've been reading several real-time application development books, some game related, others not -- in this context by real-time I mean things like games etc. Since I've only really played around with C++ for a little while, I can easily read it and reproduce it just there are some several 'dark areas' I'd need to brush up on. I've decided to try make some sort of 3D game engine in Java ... for those of you who have used Java you'll notice how much you get for how little typing you do! I've also looked in to various benchmarks of C/C++ vs Java. And I've looked at the quake2 Java re-write "jake2". I just love the fact it's portable, and that I don't have to do anything for some platform I've never heard of to play! Granted some JVM emulation to ensure consistancy (such as floats) is going to incur a speed cost as are JNI calls to OpenGL. It should also be taken into account that computer horseys are getting cheaper, and this would definatly not be class as "industrial grade" by todays standards. Basically I want peoples' thoughts/ideas, such as potential security or performance issues (I've been benchmarking various style of Java coding such as static methods vs instance methods -- the results are a surprise!)... and things I might need to watch for. Sorry for the long post ![]() I've attached the first iteration of the class diagram (sorry it's hard to read, the diagram is rather big dimension wise and had to be scaled back) , still a lot of classes to add; including various spatial partitioning -- so far an Octree but further research / reading could change that. It's not complete, comments on that as well as the diagram itself (part of my coursework) are appreciated! Note the shaded areas are the 'binaries' where execution starts (2 binaries). Last edited by zacs7; 08-25-2008 at 06:41 AM. |
| zacs7 is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Obviously, each persons thoughts of what "real-time" is and what it should encompass. There is certainly a possibility to use Java for some things that can be considered Real-Time (such as games - they are hardly what I would call "Hard Realtime"). Designing applications in Java or C++ for real-time is more a case of using appropriate algorithms and make sure that you make the best possible use of the system, than a consideration of what language is being used. As we all know, 90% of the code corresponds to 10% of the exucution time, and 10% of the code does 90% of the execution time. So making sure you do the right things in those 10% of the code is the key to making it run fast, not what you do (or what language you use) in the other 90%. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #3 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| Java has come far enough that you can use it for games, as long as you're not on the cutting edge of technology. However, "real-time" is usually used for applications that have hard deadlines to meet, typically in controller systems.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #4 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
Worst part was that some programmers tried to use floating point calculations (on an integer only processor), and the floating point emulation library would disable interrupts [for valid reasons in itself - they used some special registers in the processor that was customarily used for interrupt and trap handling] - so a large amount of time was spent hunting down calls to the FP emulation to avoid those things. Also there were pieces of code that disabled and enabled interrupts here and there - again, some programmers had little idea of how long something would take, and disabled interrupts for far longer than was a good idea in such a system. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
| | #5 |
| Registered User Join Date: Jun 2008
Posts: 266
| I would like to point out the game runescape which is actually written in java and my little cousin is crazy about that game. The game doesn't have the best graphics but it is still quite popular. I could see a game written in java a better light mmorpg than I could a CPU intense first-person shooter. |
| lruc is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Representing floats with color? | DrSnuggles | C++ Programming | 113 | 12-30-2008 09:11 AM |
| Using pointers | Big_0_72 | C Programming | 3 | 10-28-2008 07:51 PM |
| Read and set\change system time | Hexxx | C++ Programming | 9 | 01-02-2006 07:11 AM |
| The Timing is incorret | Drew | C++ Programming | 5 | 08-28-2003 04:57 PM |
| relating date.... | Prakash | C Programming | 3 | 09-19-2001 09:08 AM |