View Full Version : Custom Components
DELOCH
12-01-2008, 10:24 PM
most games nowadays have custom components and it is assumed that if your game has swing components it isn't professional... plus (I have no checked this) I think that if you use swing components in a game, it takes focus off game panel/panel mouse handler which makes it tedious...
is there a way to make custom components such as those used in runescape? if so how?
Fou-Lu
12-02-2008, 12:26 AM
I think you misunderstand the purpose of the swing library. It is what is used to write gui's in Java; the AWT was hooked into the OS in a way that almost defeated the purpose of Java. I can't recall the exact specifics about it, but swing is what we generally use as the gui replacement to AWT. There are still aspects of the AWT that are in common use though.
What you're referring to I would assume is the way that the gui looks. And yes, you can change that. Its a pain, but you can paint any component you would like to, and override the default. However, making you're own components is a lot easier said than done.
Check out these links:
https://substance.dev.java.net/
http://javabyexample.wisdomplug.com/java-concepts/34-core-java/57-spice-up-your-swing-ui-with-substance.html
Using the substance library is easy to use if you're not a graphics artist (like me). There are tons of themes available in the substance library, so you'll likely find one you like. Worst case scenario, you'll see how much work it takes to make one and you can learn from it how to put you're own together (like my beautiful black and white one :D)
DELOCH
12-02-2008, 04:36 AM
Yeah I understand but it is pointless to copy others work as you learn nothing from it, I need this knowledge so in the future i can put together decent games... plus how much longer than a few houses of banging your head at the monitor could it take...?
Fou-Lu
12-02-2008, 04:50 AM
You'd be surprised. I'm not a graphics artist so it takes me forever to create custom images for the look and feel. Painting is not my friend.
This is a good starting point, I made my first theme starting from this article, and did tons of searches from that point:
http://java.sun.com/products/jfc/tsc/articles/sce/index.html
Funny enough, that article doesn't actually show you how to use a different look and feel. This one does:
http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html
I'm curious as to what your main goal is here. Are you simply trying to learn game programming and techniques or is there a specific reason why you want to make games in Java?
Java, by default, is my favourite programming language but I don't do any of my game projects in Java as I feel there are better resources and options out there for other languages.
It's true that it's important to understand and learn the various techniques, algorithms and design models that go in to making a game, however, "re-inventing the wheel" is not always the best option. Sometimes it's appropriate to use other's examples and packages. Of course if you do it's important to understand how things work and are implemented, but this can still save you time, money, headaches, etc.
On the theme of not reinventing the wheel, you may want to take a look at http://www.jmonkeyengine.com/ . I haven't used it personally, but it looks interesting and may allow you to make your game while not having to worry about some of the more complex things that make up an engine.
Food for thought.
DELOCH
12-02-2008, 10:26 PM
I prefer java over any other language for the following reasons
-runs everywhere theoretically (unlike c++/c needs to be recompiled)
-making a window is much simpler... the windows API is a killer...
-c++ runs on system directly thus making it easy to modify data of the game/or completely exploit the game/app.
-java can be run in a browser... making it more accessable to people...(especially since new games take a lot of space on a hard drive)
-java is not much different speed-wise than c++, sure c++ runs native on platforms but it's not very different with proper optimization
-memory is handled for you
-no need to use low level programming...
-a lot of things are premade for you, making programming faster.
That's comparing to c/c++... i honestly prefer java over other languages...
but that's off topic ...
If i begin working on my own serious game, I don't wanna use premade engines... perhaps take ideas off it but...
If you don't reinvent the wheel, you will never know how it truly works... you can easily explain something you don't understand...
Sorry for my bad grammar but... yeah
Either way that's my opinion... its a bit different than most developers but... I don't wanna be script-kiddieish :D
Fou-Lu
12-02-2008, 11:07 PM
-java is not much different speed-wise than c++, sure c++ runs native on platforms but it's not very different with proper optimization
Java will never compare to C from a speed point of view. Interpreted bytecode will always be slower than compiled machine code.
I agree with most of the others though.
Honestly, the type of game you're making would really drive you're choice of language. If you're doing desktop, I'd go with C/C++. If you're doing web-based I'd go with Java.
If you're doing an advanced game (3d and all that fun stuff), C++.
Fair enough, if Java's what you want to use to write your games I'm not going to try and convince you otherwise. However, there are reasons why almost all commercial games are written in c/c++. And I agree that writing your own engine is definitely a good learning experience (no matter what language).
If you don't reinvent the wheel, you will never know how it truly works...I don't wanna be script-kiddieish :D
A lot of game development studios don't write their own engines, but I don't think I'd call them script-kiddieish :)
I said I wasn't going to try and convince you to use another language, and I won't really, but I will point out another option which may be suitable to your list of requirements and provides many helpful classes.
That is Microsoft's XNA framework (http://creators.xna.com/en-US). It uses C# and provides many helpful classes/wrappers for DirectX calls, automatically sets up a game loop and window for you, integrates with XACT Audio, etc. Couple that with .net and you get a framework that to me looks and feels a lot like Java but takes care of a lot of low level stuff for you. A plus to XNA (for some people) is that it is advertised as a "write once, publish for PC, XBox360, and Zune". You can even publish your games on XBox Live Community Games Channel and set the price for your game if you're into that sort of thing.
The reason I mention this is because it's not a game engine. It gives you helpful routines for setting up your game window and loop but then leaves the rest up to you.
**This post is not meant to be an endorsement of XNA, or an attempt to convince you to use something other than Java, but rather to provide information on similar options so that you can decide for yourself.**
Gox
oracleguy
12-03-2008, 02:02 AM
That is Microsoft's XNA framework (http://creators.xna.com/en-US). It uses C# and provides many helpful classes/wrappers for DirectX calls, automatically sets up a game loop and window for you, integrates with XACT Audio, etc. Couple that with .net and you get a framework that to me looks and feels a lot like Java but takes care of a lot of low level stuff for you. A plus to XNA (for some people) is that it is advertised as a "write once, publish for PC, XBox360, and Zune". You can even publish your games on XBox Live Community Games Channel and set the price for your game if you're into that sort of thing.
The reason I mention this is because it's not a game engine. It gives you helpful routines for setting up your game window and loop but then leaves the rest up to you.
**This post is not meant to be an endorsement of XNA, or an attempt to convince you to use something other than Java, but rather to provide information on similar options so that you can decide for yourself.**
While this advice comes with a similar disclaimer, I will say that Microsoft does deserve some props for that XNA stuff. There is a pretty cool user contributed game on XBox live called "Braid" that someone wrote in XNA (I think) and is pretty awesome. They have made that XNA stuff pretty easy to use. It isn't the same as using C++ with DirectX directly but for more casual game design, it is pretty cool.
DELOCH
12-03-2008, 02:25 AM
sorry to continue a closed question thread but...
isn't C# also an interpreted bytecode -- .NET framework...
and Java3D + JOGL should be good enough to make any game ... after all Jagex' Runescape is an outstanding game, people blame java as the reason why they don't like it but... to be honest it wouldn't be too much different in c++ except it'd lose portability and would be a lot more exploitable(due to open-client), it would though be more optimizable in terms of speed(since you can easily make code weigh less or in worst case use assembly)...
another thing is that .NET is a huge thing you need to download to get it to run... java is installed quite simply... :|(though you gotta include all the unusual packages from your web server... which I have no clue how to do...)
If you can answer my last question please do so, do you have any idea what engine/ideas runescape uses?
Just a question I want answered... I am very sorry if I am not allowed to change topics on thread(please tell me if i'm not...)
Fou-Lu
12-03-2008, 07:20 AM
C# is compiled into MIL code, which is similar in concept to bytecode. Its how you can make things using different .NET languages and support them in other .NET languages. Its pretty sweet actually.
C++ is only as insecure as you're server side. Since you'll need to be making all of you're checks on the server side anyway, it doesn't matter which language you use. Java even as an applet is only in bytecode, and it is a lot easier to edit then pulling out the hex editor or assembler and watching/playing with the memory in a C or C++ program.
C++ is very portable though. The difference would be it would require a front end change. Slapping a Windows GUI on top of a C++ application is just as easy as doing the Linux or Mac one. Sure they have different libraries to use, but you should be putting you're program together to handle all the business rules independently of the OS. Its definitely harder in a language like C++ to predesign them to work this way (spanning multiple OS'), but in the long run its worth it.
I have no idea what runescape uses (never played it), but I'm about 70% certain its a web based game. That being said, either Flash or Java are likely in use, overlayed on either a Java, C++ or even PHP, ASP, JSP or Perl processing.
What I would do if I were you, is look into using Java as an RMI. This lets you bundle the entirety of the front end and distribute it as a desktop application. When played, it would link into the server side for its processing. This lets you store all of you're graphics on the client side, which will save you tons in bandwidth. You can technically do this with an applet as well, but you gotta sign it in order to access the client filesystem to load the images. I can't recall if the applet will let you write to the filesystem even with a signed applet.
All and all, in any language of choice, an n-tier approach is definitely advantageous (though not at all necessary). With the correct design, you can pull apart different layers and use different languages at any given time to integrate them flawlessly. This would let you use Java or Flash as you're front end, and C++ as you're backend for an example. This takes practice, and a lot of it.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.