Is OpenGL Neccessary for a 2D Android Game? - java

I'm planning on making a 2D game for Android. For drawing custom graphics, Android Training only goes over how to do so with OpenGL. For my first Android game, I don't want to have to learn OpenGL if I don't need to.
While programming games for Desktop with Java it's simple to paint images and draw. But OpenGL seems to be the standard for Android.
So my questions are, is OpenGL necessary or are there other options? Do I need to use an API or can I just use Android's basic toolkit? It's not possible to use Java's swing with Android, right?

Android GUI is like Swing, it’s on a single thread, if you do some heavy lifting on that thread it will cause some issue’s just like with Swing. There are mechanisms and classes available that like SwingWorker help you out. But If you wanna work in C++ it would be best to use OpenGL library for it.
Determining which engine is most suitable for your game project is a significant design choice, so you'll want to do your homework. Engines with more features are generally bigger and more complex to use than smaller, lightweight engines. Some game engines focus on cross platform support with a single code base. In this case, the developer usually writes their games in some sort of scripting language. Other game engines will require native coding on each platform.
There are alot of new technologies present now on Game Development for Android even you can use Third Party Game Engines.
For e.g,
Android Box2D - This is 2D physics engine written in C++ for Android developers which has even won some awards. Used to create the Crayon Physics Deluxe game, and ports for other platforms are available.
Cocos2D-x is One of the strongest and most famous free-to-use frameworks for building 2D games on both platforms (for Android & IOS).
I hope =my answer would help you.

Related

Java 3D Graphics using Applet and in built libraries only

I want to do Java 3D Graphics without using external libraries to develop a game applet. Sorry I am not that experienced with Graphics and so I am not sure how hard it would be to do it by myself
The real answer to your question is that you're thinking about it a bit sideways: you shouldn't be using an applet (they're dead), and you shouldn't try to do it all by yourself without any libraries.
I'd personally recommend Processing for beginners or libGDX for more experienced users. They both allow you to do 3D, and they both allow you to deploy as JavaScript- which is better than applets.
If you really, really, really want to try to do this without any libraries, then you'll have to do all the 3D math and whatnot yourself, then do the drawing in Java2D. A very basic example of getting started is here, but like I said, you're on your own to do all the conversions from 3D world space to 2D drawing space.
Any sane person would use something like OpenGL instead, which you can find Java wrappers for- JOGL is a pretty basic wrapper (so if your goal is to get "close to the metal" then this might be your best bet), LWJGL provides a few extra features for game development, and the already-mentioned libGDX is built on top of LWJGL.
If you're afraid of using libraries because you think they're too complicated, let me tell you that doing 3D stuff without a library is even more complicated.

2d mobile game development: OpenGL ES 2.0 or cocos2d-x?

I plan to build a game for mobile. My target platforms are iOS and Android. I hope to be able to carry out testing on windows and/or linux. I'm a bit over my head in this as aside from general game development experience, all the technologies are fairly new to me. I've done a decent amount of research and have concluded that the game should be written in/ported to C++ to ensure that most of my engine can be easily ported to multiple devices.
Another thing I'd prefer is to write the game initially in java and port to C++ since that's where I'm most comfortable and will get it done the fastest.
Now I have the issue of choosing whether to use a game engine such as cocos2d-x, or to write the engine from scratch and use OpenGL ES 2.0 for rendering. Initially I thought it would be better to use cocos2d-x since I don't have a lot of experience with OpenGL. My problem with using cocos2d-x, however, is that since I want to write the game initially in java, that I'm going to have a hard time porting the engine to conform to cocos2d-x (or I'd have to learn all about the cocos2d-x engine to begin with and then write my engine to mimic the cocos2d-x engine.. seems redundant).
Upon further consideration, I thought that writing my own engine using OpenGL would actually be the better option. I'm able to use the PowerVR SDK along with JOGL to emulate a GLES environment. Also it seemed nice since I would be able to allow GL to do most of the work for me in terms of collision detection and transformations. My only issue with this is that since the game is going to have multiplayer support as well, the GL collision detection and such is basically moot since I'm going to have to do collision checking server side anyway to prevent the game from being easily hacked. Of course for the single player game play this method is viable.
Obviously this decision is subjective and depends on my personal preference, though I hope to have given enough background for some more experienced persons to lend their opinions.
That being said, my question is: given these parameters - would it be better for me to use cocos2d-x and suffer the head trauma of building the game from the ground up in C++, or would it be better to write my own engine initially in java and struggle through the OpenGL aspect of it?
Building your own engine from scratch would be too much of a work and would attract lot's of bugs to creep into. The tried and tested engines are better choice in my view. The porting would be far more easier to do, since you would be having a working game.
I am using Marmalade engine currently and I am quite happy with it's performance. It gives you direct access to the OpenGL libraries, although I've never tried it. You should give it a try too, although it's not free, but the 90 days evaluation license is free to check it out.
I've decided to write it from the ground up in c++ using cocos2d-x. It hasn't been as bad as I expected.

Suitable platform for a 2D simulator using java

I have to do my final year project and I'm planning to use a visual simulator to simulate it. So I have to create a basic simulator and the program would be run in java. But I have a problem as to what to use to create the simulator. Should I use jmonkey or java2D or java 3D. What I would want is a basic 2d simulator. Please help me out. It would be better if it's java based as I do all my development using java
thanks,
ps :- Im planning to do a simulation on human movement within a building in a panic situation. so what i would need is a 2D view of maybe a 2 room building with a door and a few dots to be represented as people. So when the simulation starts the people(dots) must go out of the building accordingly. What i need is how to create the UI/simulator. Like some kind of an API.
If I understand correctly what you need is a way to paint 2D content. I would guess that the painting capabilities from java (swing) would be sufficient for you, an OpenGL wrapper or something like that may be overkill.
Look for "Graphics2D, Swing, Animation" ...
Here are some starting links:
http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html
http://download.oracle.com/javase/6/docs/api/java/awt/Graphics2D.html
By "visual simulator" you mean graphics/drawing engine?
It may or may not fit the bill, but I'm one of the developers of Greenfoot:
http://greenfoot.org/
... which is really an IDE, but it also includes a 2D graphics framework suitable for simple games and simulations. It's open source so if necessary you could rip out the parts you need (as long as you abide by the license terms of course!).

Best Java 'framework' for LOW-END 3D Graphics?

I've made my share of 2D games on various platforms but I have never developed a 3D game.
I want to make a small "mmorpg". I already made my server in python and it works just fine with my flash 2D game but I decided I want to step it up and try out 3D. I want to make a 3D game for the web browser and I think Java might be a good choice for this.
So basically I'm just looking for a straight forward and well documents 'framework' to make LOW-END 3D games. Keep in mind that I will be targeting peoples with very low-end PC's (plus my 3d modeling skills aren't great so I wouldn't mind hiding it somewhat, haha)
If you care to develop your own software 3D engine, which is pretty cool, Developing Games in Java is a complete walkthrough, step-by-step, of developing a 3D engine in pure Java, capable of rendering textured and lit polygons. You learn a lot about the math involved and you realize that it's really not a terribly hard thing to do; in addition, the engine is all yours, so you know it inside and out and you don't have to learn an API. On the flipside, it might be outdated. It's been sitting on my shelf for a number of years now, but it is made with Java 1.4 so it's not all too old.
Otherwise, I would definitely recommend JOGL or its competitor LWJGL; however, both require OpenGL knowledge, so if you want to just deal with loading 3D models and moving them around, jMonkeyEngine could be a better option for you. There is also the lesser-known Xith3D engine, somewhat a competitor to jME, though it hasn't been updated in over a year.
P.S. Ever seen RuneScape? It used JOGL, though now I think they switched to their own port of only the OpenGL functions that their code uses, kind of like a stripped-down version of JOGL.
JOGL would be a good possibility. You could look at the older "Java3D" framework as well.
You might want to check out the jMonkeyEngine.
I would advise against Java3D. We're using it for a project and frequently run into gotchas. If we had the resources, I'd migrate to something else in a second.

Game programming with Java in Linux

Recently I've been craving some game programming. I primarily use Linux, and was wondering if there are any good graphics libraries for Java development on Linux? Google didn't turn up very much useful information on the subject.
Also, would another language be better? I would like to avoid using python -- Ruby and Java are my two favorite languages. There doesn't seem to be much talk about game programming on Linux in general, unfortunately.
Any suggestions/resources? Easy portability or cross-platform functionality would be awesome too.
Oh, and I prefer 2D graphics.
What about the APIs mentioned in Pro Java 6 3D Game Development: Java3D, JOGL, JInput and JOAL APIs.
Topics are split into three sections: Java 3D API, non-standard input devices for game playing, and JOGL. Java 3D is a high-level 3D graphics API, and JOGL is a lower-level Java wrapper around the popular OpenGL graphics API.
You'll look at three non-standard input devices: the webcam, the game pad, and the P5 data glove.
Along the way, you'll utilize several other games-related libraries including: JInput, JOAL, JMF, and Odejava.
Learn all the latest Java SE 6 features relevant to gaming, including: splash screens, JavaScript scripting as well as the desktop and system tray interfaces.
Or have a look at Java 2D Game Frameworks here on SO.
For game programming there's a nice little framework available, jMonkeyEngine, it support both LWJGL and JOGL.
JOGL is supposed to be cross-platform. There's a wrapper which includes additional functionality called Lightweight Java Game Library.
How about Flash? The PushButton Engine looks fun.
Golden T Game Engine
I think the Golden T Game Engine is the sort of thing that you are looking for. It makes it very easy to get into actually making a game without having to worry about a lot of boilerplate code.
Golden T Game Engine (GTGE) is an advanced cross-platform game programming library written in Java language.
GTGE library provides a complete routines for making 2D game from low level routines such as hardware accelerated 2D graphics, mouse and keyboard input, audio support, game timing, to game specific routines such as sprite, background, collision detection.
...
GTGE is a high level interface library, it means programmer never has to worry about any low level commands anymore. The only thing left for the programmer is use their imagination and start programming their game.
You don't have to know anything about managing graphics, input, and other low level stuff in Java. Instead you can start immediately develop your own game using the latest Java technology, such as bufferstrategy, volatile image, and even OpenGL easily. You can check out GTGE design standard simplicity, generic, and replacable.

Categories