0

I am looking to create an android based game. I am planning for this to eventually be on the OUYA. I know that the console isn't out yet so it is hard to say what would work and what wouldn't but we do know it is android based and java will work.

So I am writing my game in java. I am using OpenGL ES. I'd also like it to work on desktops too. I am assuming that players will either have a controller or a keyboard and mouse (touch MIGHT work as well, but tweaking is needed). I know android itself won't provide this out of the box, but java does have some libraries that handle controllers.

In this train of thought I suppose I am creating a plain java application using OpenGL ES and would like to run it on android. Is there an easy way to package a plain java application up so that it would work on android as well? How should I structure my application to optimize code reuse?

CaseyB
  • 24,780
  • 14
  • 77
  • 112
Parris
  • 17,833
  • 17
  • 90
  • 133
  • 1
    "How you should structure your app" is a pretty broad question. Other than saying "keep the graphics and input separated from the logic" not sure what kind of answer you're looking for. – Dave Newton Aug 18 '12 at 22:34
  • @DaveNewton I guess that part of the question is more about well if i am doing this without any frameworks well how do I piece things together so I am not copy pasting code from place to place to get this to work everywhere. – Parris Aug 18 '12 at 22:37
  • What's up with the vote close... this is a legitimate question. – Parris Aug 18 '12 at 22:40
  • If you cut-and-paste more than, say, twice, put it somewhere else, and refactor properly. Graphics and input should be the only major differences across platforms, no? – Dave Newton Aug 18 '12 at 22:40
  • I didn't downvote or vote to close yet, but it's pretty borderline because it's very, very broad. – Dave Newton Aug 18 '12 at 22:41

2 Answers2

2

i think the best thing to do would be to use the libGdx library .

even though it's a bit hard since the library isn't much high level as Andengine , libGdx allows you to run your app on both desktop AND android , and you use Java for development on this library !

android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • Thanks! This is what I needed. It set me off in the right direction. As far as how to set up your application: http://code.google.com/p/libgdx/wiki/IntelliJIDEALibgdx Is exactly what I was looking for. – Parris Aug 19 '12 at 00:24
  • 1
    well i prefer the official eclipse , but each person likes different tools ... – android developer Aug 19 '12 at 06:04
1

If you want to port your application to more than just 1 platform, consider programming your engine and your game in C and/or C++.

user827992
  • 1,743
  • 13
  • 25
  • butttt all devices I am looking at use java. Mac, PC, OUYA, Android... Writing a game in C (I don't think C++ allows for this) does allow you to be cross-platform, but also causes you to write more code, which means it'd take longer to get something out there. – Parris Aug 18 '12 at 22:29
  • 1
    not really, also the JVM that you can find on a MAC is not a standard implementation, and the only official JVM for MAC is the number 7, the latest release from Oracle and the first and only for MAC; also on Windows the support for the C/C++ is native, for java is not, Ouya is just Android, so you do not have to count Ouya and Android, and in this case you have the NDK and with an appropriate use of the code you can give a significant edge to the performance of your app. You are confused about this, C/C++ is always the best choice for gaming, portability, and performance. – user827992 Aug 18 '12 at 22:33