I'm pretty much expirienced with C++ and C, and all my programming skill exsist only to create games.
could games be written in Java. I mean are they fast enough, I'm planning to use OpenGL with java.
For games? My opinion is stick with C/C++. Java is good for enterprise stuff, but for games, it's a bit slow. Oh, the Java fanbois will tell you that's not true, but in most people's experience, it is.
Don't throw Java away though, it's good for a bunch of other stuff. Amazon uses it, EBay uses it. I personally use it mainly for quick prototyping, then porting the final application to C/C++.
For simple games, Java is fine.
I wrote Tetris in about 2 days and implemented battle tetris over TCP/IP. A lot of things are happening and it runs fine on slow computers too.
for simple games, QBASIC is fine.
The OP automatically limited his responses by asking a question about Java on a board mainly for C/C++. I often wonder what the hell people expect when they ask questions about Java on this board.
As long as your not trying to do state of the art graphics java will be plenty fast, the C/C++ "fanboys" are just plain wrong if they say otherwise.
Using OpenGL with Java however, adds an extra layer of abstraction in addition to things like garbage collection. Performance will suffer with high end graphics, but simple things (even simple 3D things) will be fine.
Although, if you want ease of programming, and you don't mind that extra layer of abstraction, you should use python ;) They have a one-to-one binding for the OpenGL libraries.
Misuse it by trying to do high-end graphics.
Misuse it by writing code that runs as slow as Java.
So i started to learn Java, and i pretty much liked it. It seems logical and everything, So i'm wondering could games be written in Java. I mean are they fast enough, I'm planning to use OpenGL with java.
If most of the game execution is spent inside the OpenGL system, a Java game might be comparable to a C++ one. But otherwise, you'll either end up writing a porition of game code using C++ or your game will be slower than a C++ one.
Some of you who think a language is just more semantics, rules, etc. need to look at the assembly underneath of it all. After you learn assembly you will realize that C/C++ and assembly are very close, easy to mix, and you can do just about anything in both languages (except write bootstraps in C).
The way I see it from an assembly standpoint, I don't think you can get any closer to assembly performance wise than C/C++. The way C/C++ handles stacks, memory, pointers, objects, etc, etc. is very close to the way assembly does.
It just doesn't get any faster than C/C++ unless you use pure hand-optimized assembly (and not all asm is faster than C).
I don't see this changing and especially not from a language that has a virtual machine and even when compiled still does some odd stuff with memory and a lot of stuff behind the scenes that just slows everything down.
And if you look at the old C libraries you will see functions like setjmp, emit, etc, etc. You can see just by looking at some of the functions and what they do that C/C++ was intended to be a language that could do anything assembly could....and for the most part it has succeeded.
I've found no other language to date that I've had a more pleasant experience with. Normally I find that when some other language tries to simplify something complex, the underlying code is too slow to be of use, and that language often does too much for you resulting in a loss of control.
The reason they 'handle' things the same way is only due to how the compiler implements it, and as it stands now, most compiler creation follows a rather orthodox pattern in terms of how things like stacks and registers are handled. I could write a compiler that implemented things in ridiculously ........ed up ways if I wanted.
When you're in C, you need to divorce the actual implementation of the program from the lower levels. There's no such thing as a stack in C unless you're talking about a linked list, or you're just unashamedly technical all the time.
This doesn't make sense. A quicksort implementation will virtually always be faster and more efficient than a bubblesort, regardless if I program the Quicksort in Java and the Bubblesort in C.
Many times, it's not the compiler nor the virtual machine that causes the bottleneck. My friend had to write a java program to solve the n-queens problem for college, and while his algorithm was virtually the exact same, the person who had the second highest grade (he 'won' if you think of it that way,) his implementation was over twice as slow. What's the solution? That parts of the language could be constructed badly, he rewrote parts of Java's libraries and then implemented n-queens, and when he ported it to C and even Assembly, the speed difference was only a measily %15 difference, this was before Java even HAD a just in time compiler.
There's some things that I can't do in C that I have to handle with assembly, even if it is only inline assembly or a linked procedure from doing 'nasm -fwin32 test.asm', there are some things I just flat out cannot do in C or C++ natively. There's plenty of practical reason to use assembly these days, if you're going into a security profession and don't know assembly but only know C, you're already a joke.
Well, everybody has their own experiances and preferences with programming languages I suppose.
There's some things that I can't do in C that I have to handle with assembly, even if it is only inline assembly or a linked procedure from doing 'nasm -fwin32 test.asm', there are some things I just flat out cannot do in C or C++ natively.
Um...ok but isn't that what I just pointed out? You Java-ites surprise the hell out of me and why people ask about Java on a C board is beyond me. I've never seen any game in Java run faster than C/C++ unless of course the programmer is like most noobs on this board and use an (N^256) loop to perform even simple tasks.
Any language can be slow, but natively and when coded/used correctly - nothing is faster than C/C++ - besides pure asm or asm implemented in circuits - thus hardware.
Nothing. So you can have your coffee beans.
What is (N^256)? You talking about O(N^256)? I was reading about asymptotic analysis the other day (thanks Prelude) - what does the '^' mean?
While chossing the right algorytham has an affect on speed this dosen't negate the affect of language.
and when he ported it to C and even Assembly, the speed difference was only a measily %15 difference, this was before Java even HAD a just in time compiler.
15% Is a lot if applied to a routine that will be called thousands of times.
This dosen't have anything to do with one language being inherently faster then another. If you're going to get your machine into a state where nothing will run at an acceptable speed then maybe it dosen't matter what you coded your program in but when you want to play a game you shouldn't be running anything resource intensive.
The ^ symbol means to the power of.
Arguing on the Internet is like running in the special Olympics, even if you win you are still retarded*.
Ok so we are retarded.
But I think asking about Java continuously on a C/C++ board is moreso.
Oh god, someone please criminalize usage of this word now!