I wonder what languages are used in robots and electronics. Is it low level languages like Java, C, C++ etc?
And if these robots and electronics could be controlled from another place, what protocol is used?
It couldn't be HTTP Rest, could it? :)
Ada is also becoming a viable choice for programming language even for smaller platform. Ada has very good support for low-level operations, as well as high-level things.
As examples of smaller platforms, Ada is available for the Atmel AVR (8-bit) as AVR-Ada. See http://sourceforge.net/apps/mediawiki/avr-ada/index.php?title=Main_Page
For LEGO MindStorms, Ada is available from GNAT as GPL version, which also support the Ravenscar tasking profile. Hence you can easily create multitasking applications on the MindStorms platform. See http://libre.adacore.com/libre/tools/mindstorms/
How about LEGO Mindstorms? Unless you have specific requirements regarding the physical properties of the robot that would rule out Mindstorms/NXT, you can do a lot with it. And it's a serious piece of kit - don't be fooled by the "LEGO" brand.
http://mindstorms.lego.com/en-us/Default.aspx
In addition to shipping with its own programming language, it is also supported by Microsoft Robotics Developer Studio - so you can use .Net to code for it.
http://msdn.microsoft.com/en-us/robotics/default
The great thing about it is that it is actually LEGO, with its inherently modular brick system for constructing the robot itself, and so allows for a lot of rapid prototyping and experimenting, without having to buy specialized parts.
It has built in Bluetooth, allowing for remote control. You can also download your compiled program code to it, so that it operates autonomously, either through USB or Bluetooth.
I bought the previous version back in 2008, and expanded with some regular Technics models for parts. It includes stuff like touch sensors, sound sensors, ultrasonic sensors, light / colour sensors and (two way) servo motors, and you can get third party add-ons like gyroscope, accelerometer, compass etc. Great fun.
I would say that it depends on your project. I've used C/Assembler to program an electronic microprocessor, but I know that you can use high-level programming languages as well for some projects, if your robots operating system allows it. Such as Java/C# and so on.
There are a variety of protocols used to connect to an instrument, and my believe is that TCP/IP or UDP/IP is the most common. But some people prefer to write/program their own protocols.
Most of the robots I built were built with Lego Mindstorms. There are a few languages you can use, but the default language is a visual workbench. You can remotely control the robot via Bluetooth or IR (and Lego includes a USB-connected IR transmitter)
C/C++, Java and Python.
I would say C/C++ are more widely used than languages like Java and Python for programming robots, simply because there is so much stuff already out there. And C is also a very commonly used language for embedded applications. Many people I know in industry use C as the means for controlling robots and hardware like RS-232, UARTs, stepper motors etc.
When I was working in academic research, my German colleagues used Java almost exclusively on autonomous robots, with satisfactory results. If you use Java you simply have to abstract the hardware when you are using it, which can be done with Player / Stage or ROS.
It all depends on what you want to do, I guess. In my particular area (Mitsubishi PLCs) C++ is the language of choice. Other industries use C++ to program robotics, such as Honda ASIMO. AMD ATi use Python to program their Graphic Accelerators. Pretty much any language that can talk to a communications port can be used for robotics.
As for controlling them remotely, Battlebots would probably be a sterling example:
Whichever language you choose, you will soon find that you will need to speak in terms of zeroes and ones ;)
I recent made a simple remote controlled robot programmed in Java with the help of this book
http://www.google.co.uk/products/catalog?q=build+java+robots&hl=en&cid=346434932749925759&ei=WATITISGE5_g2ASm_tilCQ&sa=title&ved=0CAcQ8wIwADgA#p
This book showed me how to talk to the robot using bluetooth.
I've also read that BASIC is a good language to get started with, when build your first robot.
Disclaimer: I'm no expert.
I only really have experience with Arduino, which can be programmed with assembly or C (the AVR-GCC toolchain). However, if the target environment is sufficiently powerful or has enough memory, there's nothing to stop one from using a higher level language -- aside from other technical constraints such as, say, a hard realtime requirement -- such as, say, Lua or something even higher-level.
As for communications, it depends on the final transport medium as well. For, say, Bluetooth, Zigbee, just digital radio communication, or maybe, you know, a couple of wires (or even one wire) or whatever, it'd be some sufficiently low-bandwidth serial protocol... But of course, it all depends on the target platform.
For what it's worth, regarding HTTP -- I built an HTTP controllable RGB moodlight (that smoothly fades between colors! :P) using Arduino and the Ethernet Shield available for it. The HTTP server runs on the Arduino.
You can control Robots and electronic gadgets with different type of languages in which you are most comfortable .But it also depends on the type of the gadgets you are trying to control i.e if you are developing a robot or gadget from scratch you can program it with the language of your choice like C ,C++. Python ,Java etc .You can also use the the Embedded language to program the controller with your choice of language there are many different compilers available only to compile your program form the controller for example MicroC is one of them which I use often use to compile my Embedded code for microcontrollers .If you are programming some kind of board like Arduino then you can use its own IDE where you can program it . To control the the Robots and gadgets remotely you can use many different ways i.e .:
Internet : You can use internet to control them by integrating them with modules like ESP8266 , NodeMcu , GSM modules etc and use a custom web application ,Mobile app to control them.This comes under Internet Of Things (IOT).
2.Bluetooth : You can even use Bluetooth to control the devices by integrating a bluetooth module with your device but the range of bluetooth is low .
Radio Frequency RF: You can also use radio frequency RF modules to control robots in remote areas but the cost of implementation is higher than rest of the cases .
Related
I am trying to write my own DAW, mostly just to learn about the mathematics of how signals are processed to get effects, but also for fun. (A rather large undertaking, but I have the time at the moment). I would like for it to work something like Propellerhead's Record as in the rack especially.
I'm running on a Mac, so I'm thinking of using Audio Units for the different parts, then Core Audio for the scaffolding parts. So, the whole thing would be written in C or Obj-C.
However, I haven't used either Audio Units or Core-Audio before, and the internet hasn't been any help for learning.
Does anyone know where I could learn about these?
Or would Java (The only other language I'd feel comfortable using) be better, or is there something I've completely missed while trying to find the "easy" way to do this?
Thanks,
Jon
if you want to write a DAW:
at minimum, get your feet wet with an existing project. if i were to personally choose a project, i'd contribute to Ardour.
the signal processing in a DAW is relatively simple. you'll have to work with mixers, files, and graphics. if you're already comfortable writing apps, then you probably won't learn much (beyond the basics). of course, you could find an existing project and extend it with features which relate to what you want to learn; you could write plugs or visualizations for it.
if prefer to work with signal processing:
AU or VST plugins will be a good intro - there are many existing projects which you may reference. eventually, you'll get tired of waiting for a host to load to test your program.
language:
objc is not usable for realtime audio rendering.
java is very unusual for this application. there are actually wrappers for AUs and CoreAudio... but can't name one commercial Java AU for OS X.
most audio shops (that I know of) are using C++ - not C. (Hardware is different). this really seems like an odd omission from your list - most DAWs and plugins use C++, and that is the language you'd find the most examples in. if you're already comfortable with C and Java, I'd recommend coming to terms with C++ because that's the standard language in the industry when targeting desktops.
Look at the cross platform C++ library JUCE, it is open source with the option to license the code (price isn't bad).
Plenty of professional DAW and VST developers use it, I'm one of em.
https://www.juce.com/
Warning, this library is a lot of fun to play with. It renewed my interest in C++, which was no small feat.
you are right-on in assuming that core-audio and audiounits could form the basis for a system (that may not need to be a fully-fledged DAW but may have some combination of multi-track audio recording, editing, playback, etc...) much easier than worrying about cross-platform concerns, massive all-encompassing frameworks like Juce, or ASIO and other os-bypassing hacks. i think you will find that audio programming is a specialized discipline and most folks here on stackoverflow are ill prepared to offer useful advice.
Java is rather unsuitable, as is C#, as are interpreted languages FOR AUDIO, in particular for multichannel audio, DSP, etc. due to time contraints and the need to work on a rather low-level for many critical loops.
you will find the documents you need on developer.apple.com (you'll have to make a login) and you can find shell-examples for your interest directly inside of xcode examples...
good luck
I am writing a desktop application and trying to decide between using AIR (FLex) or Java. Some of the requirements for the application are:
needing to securely connect to web
services and JMS
have a very interactive UI (lots of
little and big features)
displaying video
Communicate with a C++ application
To implement the web services and JMS for Flex we were thinking of using Merapi to communicate with a Java application. Does this mean we should probably go with Java or does the better graphics capabilities of Flex still make it a better choice?
Which language would you choose?
I'll try to address each of your points below:
needing to securely connect to web services and JMS
Flex/AIR supports SOAP although it does not support most (any?) of the WS-standards, such as WS-Security. Flex/AIR cannot directly communicate with JMS however you can add the Blaze DS Java component to the backend, which can adapt a JMS endpoint for use with Flex/AIR's Consumer/Producer messaging architecture.
have a very interactive UI (lots of little and big features)
I think overall Flex/AIR wins here. Not that you can't do cool UI's in Java / JavaFX but Flex/AIR will let you build a cool UI with significantly less code / effort.
displaying video
I haven't worked with video much in Java but it's easy to do video in any Flash environment. You probably want to consider which formats you need to support to help steer your decision.
Communicate with a C++ application
AIR 2.0 will allow for direct communication with native processes, so depending on your timeline you might be able to use native AIR functionality instead of Merapi. Java obviously has this capability already.
I'm a partial fan of AIR having done a rather large "flashy" UI on-top of a bunch of XML based REST services. Flex has numerous issues, but it has come a long way. It's performance as of 1.5.x is good and it's garbage collector is finally getting better to.
AIR Points:
Good but not great documentation
Fair amount of libraries
Great video support
Great for snazzy layouts
Good but weird CSS support
Good community
Growing base framework (Adobe is actually pushing it)
AIR framework doesn't have to be installed by Adobe's installer
Pseudo one-click browser based "Badge" installer
Java Points:
Good but not great documentation
Tons of libraries
Decent video support
Okay for layouts (very old-school - even SWT)
Solid community
Framework is relatively stagnant (I don't personally feel Java being pushed. Once corporations latched on Sun stopped growing the language until .NET and other dynamic languages started going after their market-space.)
Java applications almost always require specific JRE versions
Java, much like AIR, requires the JRE but you can't install it yourself (silently).
When you get to choose like this there is never the "right" answer, only the one that makes sense to you and your team. Everyone's got differing opinions and all languages have drawbacks. And no matter what you pick, there will always be a point (if not many) when you double guess yourself.
Good luck!
I think both technologies handle most of your requirements well, but in my opinion, Flash/Flex is the easiest way to deal with video. AIR applications are a little annoying in that they're AIR applications and you can't just install them without the AIR runtime. That said, AIR provides a lot of nice features like installation, auto-updating, etc.
I'm not sure how easy it will be to use JMS with Flex, although if there aren't already AS3 libraries to handle it, I don't think it would be too hard to write one. That would be my biggest concern in using Flex. Otherwise, it does UI and video well.
If you're going to use Merapi to communicate with Java, you have to remember the limitations of AIR. AIR can't start any system processes on its own, so if you want to communicate via Merapi to Java, you need to have the Java process started before your AIR application is started. There isn't really another way around this, yet.
AIR 2.0 will be able to launch processes, but until it's released, we're stuck waiting around.
Personally, I like the way UI is designed in Flex. I'm not sure if Java has something that is equivalent.
I know that Flex/Air can connect to normal web services (and I believe you can wrap something for JMS support as it works over HTTP?).
Not sure about video compatibility though, if that is an issue for you.
I assume performance is not a primary issue.
Hi guys does anyone know why the programming language C++ is used more widely in biometric security applications compared to the programming language Java? The answers that I have collected so far are 1) Virtual Compilers 2) OpenCV Library provided by C++. Can anyone help with this question??
Maybe it's the hardware support: I wrote an app that uses a fingerprint sensor. The library support for the device is C++, so I wrote the app in C++. Now they have a .NET version, so my next app will be C#.
I don't know specifically about biometric applications, but in general when security is important Java can be a stumbling block. Depending on how the security requirements are written, they can cover things that one must do manually in C++, but which are done automatically by Java. This poses a problem because one would need to demonstrate that Java properly (and in a timely manner!) satisfies the requirement. It is a lot easier to show that these requirements are met in C++ code, because the code the meets the requirement is part of the program in question.
If the security person/requirements/customer make it clear that relying on Java for some security features is acceptable, then this is no big deal. We could go round-and-round about whether or not it is reasonable to rely on/trust Java to satisfy security requirements, it really just depends on the specific security needs.
I am willing to put money on the reason being simply that the access api's for the hardware are written in c++. Most of the modern/higher-level languages are not going to easily communicate with hardware originaly exposed through a C/C++ api.
On a somewhat related note, Vala has all the languages features expected of a modern\high-level language(and then some), but compiles to C binary and source, and can easily make use of any library written in C (not sure about c++). Check it out, I havnt used it much, but its pretty cool.
Implementing a library in C++ provide a lot over java. Once written, C++ library can run on almost any platform (including embedded ones), and can be made available as a native import to a variety of other languages through tools like SWIG. Java can only run on something with enough speed and memory to run a JVM, and the only other Java programs can include the code as a native import. For biometric applications especially I think running on embedded systems would be a large concern, since you could build this into a small sensor.
The more glib answer would be no one wants to wait for your garbage collection cycle to launch the friggen missiles.
You could replace Java with any other language there. Probably it has more to do with the APIs and hardware.
Also, Java is more suited for Web Applications. Its not the best choice for desktop applications.
For some biometric applications, execution speed is crucial.
For instance, let's say you're doing facial recognition for a checkpoint, and Java takes twice the time to run the algorithm that a compiled language like C++ does. That means if you go with Java, either:
The checkpoint lines will be twice as long,
You'll have to pay to staff twice as many checkpoints, or
Your system will do half as good a job at recognizing faces
None of those are usually acceptable options, which makes using Java a non-starter.
Java and .NET are two languages targeted at removing platform dependence. This is achieved by adding a virtual machine/framework between the code and the OS.
So, what is the point in using it on the server side, as all websites are accessible via browser, and that is platform independent? Is there any special reason for using them?
.NET is meant for the Windows platform only. Java is the only one of the two that is meant to be platform independent.
These languages have a strong presence on the server end for many reasons:
Lots of libraries that handle the subtasks of the problem
Both frameworks are built with security in mind
They are managed languages, it is much harder to pull off the typical attacks on software.
They are considered to be mature technologies, they have been put to quite a bit of abuse and have stood the test.
They have industry support.
Both are object oriented
This means that there is the ability to either develop a web site through the use of reusable components or third party components.
Both language allow "sandboxing" of non-managed components (Java: JNI .NET: Boxing) [allows inclusion of legacy components]
They're actually chosen for almost completely opposite reasons:
Java's platform independance means you're not tied to one platform and are thus more flexible in choosing the most cost-effective platform, or the most reliable one. And you can keep your apps running even when you have to change server platforms because the old one isn't supported anymore.
.NET is chosen because if you're going to tie yourself to an OS, Microsoft is the biggest player and thus the least risky option - or simply because companies fell into the "All-Microsoft shop" trap through gateway drugs like Exchange. And once you're there, .NET is what Microsoft wants you to use and supports and integrates with all their current tools.
Both Java and .NET have their own benefits for the server-side.
For example, with .NET you are free to pick the best language for the part of the application you are working on, and all of these .NET languages work together.
So, you may want to use F# for the data mining functions, C# to work with the database, unmanaged C++ (going through a thin managed C++ layer) for fast network connections, or system calls, and there are a host of other languages. .NET is less platform independent currently, but language independent.
Java can be used on several different OSes, which is advantageous if you are selling a solution, since you don't care what OS the customer is using.
Now the JVM is becoming less language dependent, with Clojure and Scala running off of it, so Java has become more interesting now, for designing applications.
They virtualize the underlying system, so they can be run on different kinds of server operating systems.
And, they are designed to be general purpose application development systems, so they are intended to be run on anything with a processor.
If you are asking because you do not understand why one would accept the overhead of an abstraction layer, keep in mind that both Java and .NET JIT down to native code.
So, what is the point in using it on the server side, as all websites are accessible via browser, and that is platform independent?
Well, web applications are not just rendering HTML for fun, they are doing things on the server-side that may involve talking to database(s), sending messages to a MOM, etc.
Is there any special reason for using them?
This is a partial answer but I wanted at least to cover the case of Java here. I could start by arguing that Java is a safe, robust, garbage-collected, object-oriented, high-performance, multi-threaded, interpreted, architecture-neutral, cross-platform, buzzword-compliant programming language... but this wouldn't really answer your question. Actually, the big deal with Java on the server side is IMO that you benefit from standardized Enterprise APIs (aka J2EE) that allow you to do "enterprise things" (JDBC, JTA, JMS, etc) in a standard way with hardware, operating system and software vendor independence (which is a big plus for contract negotiation). In other words, Java is perfect for heterogeneous environments which are almost always the case with big organizations and doesn't lock you in.
While platform independence are great to strive for I would say Java
and .net are commonly used as there are a large number frameworks
available which make it so much easier to develop enterprise level
applications. This is especially true with java, where you have an
incredible choice of high quality technologies most of which are
flexible enough to meet the needs of most projects, allowing you to
focus on your application's functionality.
Also, without no intent to start a flame war, Java and .net have
better development tool support and are easier/quicker to develop
with for your average programmer.
In early web days, it was mostly Perl and occasional brave souls who didn't like Perl or wanted more performance used C++. Then Sun developed JDBC and Servlets for Java, and then other J2EE pieces, and Java became a higher performance alternative to Perl, and easier than C++. With J2EE came a lot of application server products from big companies, and now you have a big Java web/app server community.
Then Microsoft came along, after losing the J++/Java war with Sun, and created a similar web app infrastructure with .NET. With .NET you have fewer choices, with all of the advantages and disadvantages that brings.
So, I think the answer is a mix of decent performance, safety and enterprise features, and major corporate backing. C++ is too hard and dangerous for most people. Perl, PHP, Python, and Ruby have their fans, but not the corporate backing. I don't think the fact that Java/.NET are on Virtual Machines is important for the server side. Java used a VM originally for the client. Sun had to work hard to make a fast sever VM. I think Microsoft used a VM to compete with Sun, and to make it easier to support multiple languages. It will be interesting to see if Google's Go language takes off, which may surpass Java and C# for safety and power but no VM.
the browser doesn't have access to the server resources (database, files etc.) that those frameworks have access to. You couldn't have an application that is only javascript (and does meaningful things)
I understand your question this way: why choose Java or .NET if there are more other comfortable ways to setup a server because the clients use HTTP to access the server?
You are right that the server OS or framework does generally not matter to the client.
However the client side also can contain applets or code that then needs to communicate with its counterpart on the server. Then JSP or .NET becomes more interesting as you do not have to manage different client OS's. Then website become easily extensible.
If you want to integrate some nice graphing and charting solutions (Telerik, Dundas, ... or whatever - not meant to be advertisement - ) from 3rd parties you would also have to select a compatible server infrastructure to run them.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I understand that C++ is generally considered better than Java for games (at least larger-scale games). Why is this?
What is keeping Java from being competitive in this field? Which reasons against using Java for game programming have the most basis, and which ones are myths?
EDIT: Am a bit unfamiliar with C/C++, and did not think to differentiate between the two at line 1 >.<
The reason Java (and C#/.NET) is not a viable option for AAA titles at this point is the established game engines and their toolchains are written in C++. Game development is all about getting a title on the market in the shortest amount of time, and budgets don't allow for piddling in things like a new language/engine when several are already available, work well, and have an extensive set of editors and tools backing them.
Moving to Java (or C#) would also require a new performance-driven JVM (or CLI) across the big-3 (PC, X360, PS3) or big-5 (add Wii, iPhone). It's technically doable, but not financially viable.
Edit: Anyone with low-level knowledge of both virtual machines and the current state of game engines can tell you that a JVM or CLI could unquestionably be implemented with a new game engine to beat the performance of current C++ engines. The preventing factor is time and money, nothing more and nothing less.
High performance and the inertia of C and C++ traditionally being used for games.
Choosing based on performance isn't that big a priority unless you are making a 3D extravaganza.
Because:
Java is not compiled to native code, meaning that there is a performance hit the first time the code is run.
Java does not give you a predictable memory model (console games need this)
Java does not give you deterministic object finalization.
Java is not as close to the hardware as C is, an essential for a lot of professional 3D game programming.
Console programmers likely don't have a JVM that runs on the PS3, X-Box, etc.
Runtime performance penalties.
You will never be able to squeeze as much performance out of a Java app as you can with a C++ app.
There are probably more reasons, like the fact that they are using pre-existing code that was written in C or C++.
EDIT: As an aside, I don't think that many modern games are written in C. OOP lends itself to game development, and C++ is the de facto language of choice.
Also, I won't add it to my list, but as others have mentioned there is a lot of pre-existing code that works very well that is used in the game industry. It would not be practical to rewrite all/most of your tools just to switch to a new language especially when that switch could cause you a lot of headaches.
I would say, despite the other answers pointing to a lack in speed caused mainly by the JVM, that the real reason people don't code games in Java is the lack of support for environments such as DirectX and OpenGL (which actually remove the need for your code to be close to he hardware as it was suggested by some answers). They are the base frameworks that people generally use to code games, especially nowadays with 3D games being everywhere - and lack of support for them is the reason why Java is not considered as a language for game development.
To emphasize my point, I would suggest you take a look at Microsoft's XNA which is currently optimized for coding in C# via the .NET framework (which like Java is Just-In-Time-Compiled and doesn't run natively per se). The XNA framework interfaces with DirectX which talks to the hardware and so it is very fast.
EDIT
#Ed Swangren's comment made me realize yet another distinction between .NET vs Java when considered for game development. I think another strong point to .NET is that if you do need to be able to squeeze out that last bit of performance and do some pointer math or implement a sophisticated high-performance algorithm it's a lot easier thanks to the unsafe mode. Of course you can even go beyond that and write native libraries to be used by your C# code which is made pretty simple thanks to P/Invoke.
Leaving C(++) aside for the moment... I am inclined to say much of the reason is that Java lacks anything like XNA. What advantages does Java actually have over a language such as C++ when it comes to game development? You have to consider that several of it's typical advantages disappear for the specific area of game development, while C++ gains several.
XNA is what made C# a highly popular language for amateur game development, and contrary to common belief, a quite viable option for commercial development too. C#/.NET being a parallel to Java in so many ways (and arguably a better framework nowadays), when people now have the option for game development with a higher-level language, C# would seem like the much more appealing one, unless cross-platform support is essential (then again, we have Mono and OpenGL for .NET).
C (or rather, C++) has long been the language of game development due to their low-level nature (thus performance benefits) and the host of graphics frameworks (DirectX, OpenGL) and engines that primarily target them. It's usage is embedded in game development and been used virtually since the inception of the industry - and won't disappear any time soon, I suspect.
Java doesn't have as controllable performance
Its highly reversable so harder to protect
Many Games employ scripting languages like lua or python to get "higher" level programming
the API of most systems is C oriented.
Java can be used for back end server systems that games connect to
Flash games seems to of taken the niche Java games could have had.
Java can be optimized to be very fast, as is evident by an interview I had recently with a high-frequency trading company, where they do use Java, as well as C++.
Java has OpenGL bindings, as others have pointed out, so getting to the hardware isn't such a problem, esp since not all games need that, some commercial games have been written for Java3D.
You can use Scala or F# if you want some more performance for multi-threaded or numerically intensive operations, and just tie those in with the GUI.
But, as others have mentioned, the tools that are used tend to be written for C++, and some companies feel more comfortable doing some optimizations in assembly, but, given the fact that the new cpus are very complicated, with multicores, it is unlikely you will get any performance increase over the optimizations from the compilers, but, as long as companies feel these optimizations are still needed, they will stay with C++.
If some developers wanted to write commercial-grade tools for Java or .NET, there could be a market opportunity there, but it will be a great deal of work to make it as good as what is already out there.
I think C or C++ is a better language for building many types of games because it is closer to the hardware and likely to be the first language implemented on any new hardware. Not only that the libraries for accessing many of the advanced features of today's hardware are likely to be implemented in C.
Your typically general purpose higher level language has no easy way to access features of the hardware unless it uses some type of binding layer to call the libraries which are written in C.
For instance how do you write code to access a GPU, or write a custom Shader, or write code that run well on a Cell chip, or run on an Iphone, or on a Blackberry in a high level language. Even when these things are supported, they come out well after other people are able to write games in C that use these features in games.
One compromise you can make is to use a higher level language like Java for most things and C where its needed. You will limit the types of platforms you support though.
Java might also be good for client/server games where the server is written in Java.
It's very hard to write a program that runs in constant memory without garbage collection in Java.
If you want to read statements from game studios who are happy to use java for serious game development then search on twitter for #javaforgames
https://twitter.com/search?q=javaforgames
By studying the Java developers tweets conclude that Java is good for game development if you use it in combination with a high level game engine API such as libgdx and jmonkeyengine that both ease development effort and makes the game tuned to take advantage of the OpenGL/ES hardware acceleration provided by modern GPU hardware.
Java do allow cross-platform goals using said engines on mobile, console and desktop.
Some game developers prefer java for the design phase of the game to engineer in-house tooling.
Java game studios and developers who seek the best performance can archive it by tightly controlling OpenGL by using JOGL or LWJGL directly. Also performance and flexibility archive this by writing their own engine, if time and money allows it.
I wouldn't say that it is always true that C is better than Java for game programming.
For example, if you want to write a game client which can be hosted in a web page, Java could be better.
When writing games which produce amazing 3-D graphics (e.g., Halo on the X-box), usually there is barely enough computing speed to generate all the pixels for each frame. In this kind of game, C would be preferable to Java because it allows the programmer to write faster programs -- at a large expense in terms of difficulty in extracting that speed.
I think it's mostly because c lets developers squeeze every last little bit of performance out of hardware, whereas Java doesn't, it's not low level enough for things like high end 3d video renderers. Basically c lets you squeeze out a couple more frames per second in your next gen shooter.
Inertia mainly... Although it's a bit old now, you can look at Jake2 (which is a pure Java port of Quake 2 with jogl as the openGL lib).
It can perform up to 85% as fast as the C++ original, which means it's fine for most games; especially modern ones which are more social and game play based rather than the limited "hard core" games.
I'd also suggest that most of the answers you get here are coming from a gaming geek/"I want the coolest hardware and games". For [these] hard core 3D games and gamers, that final 15% is hugely important, as that's what separates the $150 graphics card from the $500 one they just bought.
As John Carmack is reported to have said (something along the lines of): "If I were to enter games programming now, I'd program for the iPhone". e.g. it's not nearly as much fun to make the fastest game with the best 3d engine as it is to make the best game.
The console game market is about 10X larger (financially) than the PC game market. For current generation consoles, all the major programming is in C or C++ with some little bits of intrinsics or assembler. If you want to be a professional Game Programmer and work at any major game company, then learn C and C++.
More to the point, all the commercial cross platform engines that are that starting points for many commercial games are in C or C++ right now as well.
You may be able to work on small games in java and flash or even casual Windows games in C#. You can even code C# for XNA games but if you want to make REAL (pressed on DVD) XBOX 360 games you need to learn C++.
Speaking as a game developer at WBGames Chicago. We would not hire a programmer who didn't have strong C++ skills. The same is true at every other game studio that I know of.
The short answer is because almost no gaming platforms support Java, or if they do there is a much better alternative.
On the game consoles, seasoned game developers are using C because that's what they've been doing for 20 years. There's no compelling reason for Java games to exist there.
On the desktop, there are a few Java games, but they can't compete with the market leaders such as World of Warcraft.
On the web, Applets are long dead, and if you're going to make a casual game it's going to be in Flash.
In the mobile space, JME has had it's time in the sun but it's on its way to obsolescence in the face of far superior platforms such as the iPhone.
The perfect world scenario for Java to be a heavy hitter in the gaming world would be for Sun/Oracle to deliver a gaming platform like the Wii or the iPhone - a must-have device that everybody owns. Then, there is a good reason for developers to invest time into experimenting with new technology. But given Sun and Oracle's apparent lack of interest in the consumer market, the chances of them making a gaming rig are slim to none.
It's not a technical issue but purely a "client optics" issue for this.
Good Java code can run just as fast as good C++ code. It can access OpenGL just as fast as native C++ via projects like LWJGL and JMonkeyEngine.
The real reason is that Sun never put any effort into highlighting Java for games and they've never made any deployment particularly easy for Java games. It's a LOT of work and effort of the developer / team to create a seamless / smooth installation (and launch?) experience for the player.
Customers just don't "trust" Java games and bail during the install process when they see the logo.
Although old, no one here seems to point out
All the games and apps on Android are programmed in Java
Because not only is Android written in Java, so are most all of its apps/games/etc...
I will answer in a very different way.
If Java can nevre write a device driver like C, how can you Imagine that it would be faster than the language that the driver is already written in ?