I really have to ask you guys are there any performance reasons why JB can’t be used in games?
If not then why haven’t I seen anyone use JB in any Java game?
Is there a reason why JGD(Java Game Developers) haven’t picked up JB?
I really have to ask you guys are there any performance reasons why JB can’t be used in games?
If not then why haven’t I seen anyone use JB in any Java game?
Is there a reason why JGD(Java Game Developers) haven’t picked up JB?
we used JavaBeans in a university project… we had a game board given to us, and had to write javabeans to implement a timer, and a game of life ‘bean’ which used the board and timer…
but really, it’s like trying to crack a nut with a cannon. that’s why no one uses them for games.
Given the way JB have been used it could quite easily make development time far shorter.
I don’t understand why it’s like cracking a nut with a cannon.
Beans are all about reusable components, and convenience building bespoke applications out of commodity parts. Usually a sacrifice of convenience over performance in some measurement as well. However most games are bespoke applications composed of bespoke parts and there is usually some performance mandate as well. They’re not an ideal fit for games but some aspects of games could be well served by beans.
Cas
Do you mean JBs or EJBs?
Kev
JBs but would EJB be a good fit?
JBs, imho, are at best of misconception of what makes good reusable software and at worse a poorly designed naming convention. There arn’t a great deal of people using the Java Beans styling in the real world and actually claiming it as “JavaBeans” or as being clever or novel. Its just one of the options that most people bypass in concept phases as being far too abstract.
EJBs on the other hand are only let down by poor/inconsistent container implementations. EJBs potentially are a good match for certain types of games although I’ve not heard of anyone using them in that way. I know Endolf has started considering using them in his Dark Void project though I’m not sure how far he’s got.
Potentially, EJBs give you alot of what an online/web game needs - although most likely at either a financial or educational cost.
Obivously, just my opinion
Kev
So you recommend using EJB where I can fit it?
For some odd reason I’m scarred whenever it comes to using something that sacrifices performance.
I can’t really recommend it since I’ve not used it for games. However, it would seem to be a fairly good fit for online web games - sorta non performance critical stuff. Some of the stuff Endolf was talking about was to do with changing the transport layer going of the the beans and back - might even make it possible to use it for real time stuff.
It would potentially give you fault tolerance, clustering, abstracted directory and database access, logging and a stable platform to be serving on.
You’re right that it could result in poor performance, but I suppose like normal its a trade off between X and Y. In this case performance vs development time. Thats a pretty common one, the more abstract it is - the quicker it is to do generic things - the worse the performance in comparison to a bespoke solution. [infact, I think I posted the same thing about scenegraphs not long ago]
Kev
Hi
Yeah, so far I havn’t done anything on this yet, I’m trying to get some of the more simple aspects working so I can do some useful testing.
The idea is that I can plug a custom protocol into JBoss application server and then use EJB’s for all the reasons kevglass mentioned. It’s possible that this is completely the wrong course of action and that the performance will be really really awful. On the other hand, most performance details I’ve seen are when using HTTP for the transport, which I am specifically not doing.
It might turn out to be a major breakthrough, or a total lost cause.
Either way, no-one I know of has done it, and if we have an example somewhere with some real figures, we can judge for ourselves.
Endolf
If I put together a game using JBs and gave you guys the code to test along with doing my own little tests, would you guys make an actual decision based on the performance of my game?
Hi
If you are talking about implementing a custom TCP protocol handler for an application server, and utilising EJB’s with it, then I would certainly look at what you produced and the results you got.
If your just talking about standard beans, or using EJB’s normal mechanisms, then no. Normal JB’s are just POJO’s that adhere to a naming convention, and EJB’s themselves arn’t my worry, it’s the framework around them. For J2EE applications in the web applications space then I’ve used them before and am using them now.
I know that J2EE is being used for some real time applications already (SIP for one), so the potential exists for it to be fast enough, I think the key is the custom TCP/UDP protocol.
Endolf
IMHO there are a few big porblems with EJBs for games.
First is that EJB servers are tuned for the wrong metric. Games are usually concerned with worst case latency. EJB app servers are tuned for maximum average throughput/
Secondly the EJB modle is awfully complex and requrie yo uto take manuan control of things such as lockign rules to avoid deadlocks and race conditions.
I think Servlets have a place in slow paced web based games. EJBs really are the wrong tool for the job though if you alreadya re a wizard with that tool you might be tempted to try to use it anyway.
As for Beans. Really Beans are just a fromalized naming convention ontop of dynamic class loading and reflection. Dynamic class loading and reflection can be very useful for certain kinds of problems, but going all the qay to formally matching the Bean naming conventions and rules might not be terribly useful.
Hi
And this is exactly what I’m out to test. There are plenty of statements along those lines, but I’ve never seen any examples or numbers. Even if it doesn’t work out, I don’t think I will have wasted my time as I will have proven at least to my self, that this really is the no no everyone says it is, on the other hand, it may work
Endolf
Testing is allways the right thing to do but then its only good for the type of apps that fit your benchmark. The metrics used for games are not the same as the metrics used by the typical EJB app and that varies wildely on the type of game you are considering.
Just to give you an idea, i read somewhere that when making c++ games for consoles devs avoid using c++ interfaces (mostly classes with only pure virtual methods) becasue it poses a performance hit of 10%-20% caused by using too much virtual methods. I have an idea that EJB api will use interfaces and reflection too much.
I don’t know how much this would affect a java vm however as it may have better chances to optimize the code and not force developers to ommit good code for the sake of performance, which is the advantage adertised by java in relation to c++.
Hey go for it.
As I said IF you already know the model the the learning curve isnt an issue. I still don’t think you’ll get scalable real-time performance. Noone I know of who has tried this in the past has ever been terribly successful, but you may well be the exception
Don’t trust all that you merely read (hint: different language, totally different behaviour. Not relevant to java).
Thats what i said. Every game is a new app (unless we are reusing an engine with no modifications) and every language has huge differences in the way the compiler handles. Sometimes even huge differences from compiler to compiler and from vm to vm. The only way to see how a time critical app runs is to benchmark it. You can get a rought estimate of the potential frame increase by just analizing EJB source and documentation and understand how it works but nothing can say the compiler and the vm won’t optimize it to aceptable levels. If that was the case it would be very interesting indeed.
Its not a complier issue in regards to EJBs.
Its a container design and implementation issue.