Optimization for free

Discussion in 'Game Development (Technical)' started by princec, Jan 30, 2006.

Thread Status:
Not open for further replies.
  1. Mike D Smith

    Original Member

    Joined:
    Dec 31, 2004
    Messages:
    126
    Likes Received:
    0
    Generic programming

    How would you approach generic programming with Java? It's been a while since I've touched Java (didn't like that it wasn't as easily portable as I anticipated--mostly problems with Windoz), but does Java now support some form of templates? If not, then generic programming would be very difficult to do.

    If you want to talk about advancing programming, I believe that generic programming is where we should head after this Object Oriented phase we've been in.
     
  2. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    If they'd spent a bit longer on it, they'd have realised what I and Elias and various others realised: it can do the job, and get it done quicker. Now I know you're a diehard C++ junkie so I'm really talking to a brick wall so imagine I offer a pinch of salt you may take with my posts ;)

    Cas :)
     
  3. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Generics are now present in Java. The future however is with aspect-oriented programming (AOP). See AspectJ for the definitive implementation.

    Cas :)
     
  4. DangerCode

    Original Member

    Joined:
    Oct 10, 2004
    Messages:
    369
    Likes Received:
    0
    I think that's a pretty good argument in favor of Java, but I do wonder ... what games are you talking about?


    What do you mean by "Java-derived script language"?

    I think that may be an important shortcoming of the language then in a thread that praises the optimization, memory usage, speed, and general overhead of Java ... if we were talking about Java (but I don't think we are).

    Admittedly, I don't use Java, but I'm a big C# fan. And I certainly recommend a managed language for tools. I shy away from C# for downloadable games because I don't want to force players to have the .NET Framework on their machines (nor do I want to embedd a version of it in my app).

    Which reminds me ... how do Java developers handle this?
     
  5. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Just embed the VM in the game and then Molebox the lot up.

    Cas :)
     
  6. DangerCode

    Original Member

    Joined:
    Oct 10, 2004
    Messages:
    369
    Likes Received:
    0
    Okay, I figured as much. How does that affect the size of your download?
     
  7. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Another 3mb or so. Have a look at my games to see.

    Cas :)
     
  8. impossible

    Original Member

    Joined:
    Aug 9, 2004
    Messages:
    443
    Likes Received:
    0
    I think he's talking about Unreal Engine games? Because in his mind Unreal Script is equivalent to Java... Saying Unreal Script is a "Java derived scripting language" is like saying Java is a "C++ derived managed language." Unreal Script and Java are not the same thing.

    There's nothing wrong with using a high level scripting language to write game code, it can increase productivity and iteration times on non-performance critical tasks. The thing is, for low level game code Java and C# are not going to be faster than C or C++. And I also feel that writing code in Java or C# is not as productive or high level as using Lua (the current game industry favorite standard scripting language), Python, Ruby or another scripting language.

    Don't get me wrong, I have no problems with Java and it is definitely fast enough for all but performance critical parts of higher end games, but basically telling people "you're all wrong for using C++" and that Java will fix all of their problems is a little extreme...
     
  9. DangerCode

    Original Member

    Joined:
    Oct 10, 2004
    Messages:
    369
    Likes Received:
    0
    How can I tell?

    The download for Ultratron is 6mb. So half the size of your download is the virtual machine alone?
     
  10. HairyTroll

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    582
    Likes Received:
    0
    I'm waiting for the C64 versus 48K, and Amiga versus everything else to start. It's long overdue.
     
  11. HairyTroll

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    582
    Likes Received:
    0
    You have so lost me. SQL is about the best language to use for database work, but you wouldn't use SQL to write the database itself.
     
  12. HairyTroll

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    582
    Likes Received:
    0
    Are you making the assertion that re-inventing the wheel is somehow *good* programming practice? I would consider this the exact opposite.

    If someone has solid library that I can use you can bet that I will make use it. And I use Lisp so the work I have to go through to integrate an external library involves jumping though firey hoops, eating glass and walking on water.
     
  13. electronicStar

    Original Member

    Joined:
    Feb 28, 2005
    Messages:
    2,068
    Likes Received:
    0
    not at all, there a re a lot of indie game that use java VMs.
    CAS' games of course, tribal trouble, and several other that I don't remember right now.

    I know both languages very well. As I said, Unrealscript is 90% (or more) like JAVA, plus special additional functions. And the way it works is the same (bytecode+runtime interpreter with powerful GC).
    Both languages are very high level and very performant, that's what the discussion was about.
     
  14. Michael Flad

    Indie Author

    Joined:
    Aug 4, 2004
    Messages:
    190
    Likes Received:
    0
    Hehe what a funny thread ...

    Comparing only the *interpreted* part of Java would pretty much move it quite far away from any native compiled langauge - there are world between Java and UnrealScript (but of course as we all know, the JIT compiler is doing wonders by now).

    Unrealscript was meant to be a highlevel langauge for non performance critical parts, priority was given to topics as sandboxing, serialization and latent functions/methods (microthreads, coroutines) and all of those combined which is almost only possible in an easy to use way, using your own limited virtual machine - as done in UScript.

    One other very important part for using interpreted languages in non trivial game projects is turn around times vs performance. C++ as well as Java won't help you there - if you write your own vm or embedd f.i. Lua you can easily write/change/debug scripts on the fly and reload them during your debugging session or even let the game reaload/compile anything that changes during the game runs giving you almost instant feedback. But well, the discussion is based mostly on projects possible on midclass cellphones these days, so I really understand the different points of view :)
     
  15. Vorax

    Original Member

    Joined:
    Jan 21, 2005
    Messages:
    349
    Likes Received:
    0
    Err.. you can do that in Java - several ways actually. Yes I mean run interrpreted code or relaod it at runtime on the fly. Java can also compile code at run-time and reload that if you like and JIT it too.

    Cellphones? Who's talking about cellphones?
     
  16. Mike D Smith

    Original Member

    Joined:
    Dec 31, 2004
    Messages:
    126
    Likes Received:
    0
    Aspect programming

    Yup, that sounds like generic programming. I'm not sure what you meant by a generic type though. I'll look into it some more, but I believe that what you are calling aspect programming is in fact generic programming. IE just sticking together the behaviors and attributes of your modules.

    Thanks.

    BTW your games rock.
     
  17. luggage

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    2,132
    Likes Received:
    0
    Well that was easy...

    How about...

    Would you use Java for writing a full screen hardware intensive game?

    Why didn't Unreal folk? Especially as they're being held up as a reason FOR java.
     
  18. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    6
    Generics and aspects are different things. Generics, or metaprogramming, is what C++ has had for ages known as templates; of course if it's a C++ feature it's "obscure" and "messy" but if it's the inefficient Java implementation (AFAIK generics in Java are just syntactic sugar, ie they do the casts for you, but don't actually generate specific code) it's suddenly cool.

    Aspect-oriented programming on the other hand is a buzzword that XML-and-Service-Oriented-Architecture-because-it's-cool fans love. It involves defining chunks of code and insertion points and having the compiler integrate the code transparently at compile time, so your source code isn't what you read on the source files. It is supposed to solve some kind of inexistent problem.
     
  19. HairyTroll

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    582
    Likes Received:
    0
    Of course not, I would use Lisp and take the rest of the afternoon off. ;)

    Because they didn't use Java. They implemented their own scripting language that is similar to the syntax and symantics of Java but totally different under the hood. Their scripting language is probably about as fast as interpreted Java.
     
  20. HairyTroll

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    582
    Likes Received:
    0
    Try add/delete methods/variables to existing instantiated objects in Java.
    Or redefine the base class for an entire class heirarchy and have these changes ripple across already existing objects.
    Or when Java throws an exception, enter the debugger, move back up the stack change variables/functions, move back down the stack to the exception and then continue execution.
     
Thread Status:
Not open for further replies.

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer