Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi StackOverflow people!

I would like to know how easy it could be to move from XNA to using LWJGL.

Just wanted to throw this out there because of the rumors that MS is shutting down XNA and having an interest in checking out gamedeveloping in Java.

Thanks in advance for your interest.

share|improve this question

closed as not constructive by Byte56, ClassicThunder, Philipp, Tetrad Feb 11 '13 at 17:48

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

If you like XNA try MonoGame. I've seen it recommended by microsoft employees in their personal blogs and use it myself with no issues. Also personally after getting used to C#, Java is lacking in features and generally extremely simplistic to the point of being a fault. – ClassicThunder Feb 11 '13 at 15:20
How difficult it will be to switch depends on your skill, the language features you used and the size of your project. There's no way to give a correct answer for this. Please see the FAQ about what types of questions to ask here. – Byte56 Feb 11 '13 at 15:23
When you are talking about porting an existing project from XNA to LWJGL: When you started a project building on a specific technology, it's usually not worth the effort to change the technology in the middle of it. – Philipp Feb 11 '13 at 16:31
Also, you do not "switch" from one programming language or library to another. You learn another tool, and then you decide which tool is the best one for each specific project you undertake based on your experience with each tool. – Philipp Feb 11 '13 at 16:33

Well, how easy it is will vary from person to person. I can speak from experience, as I made the same switch (well, kind of) a couple of months ago (due to the same rumors).

I decided to learn how to use the OpenTK library (definitely worth checking out if love C# as much as I do), but that kind of has the same learning curve as LWJGL (I have created some applications using that as well, but I always struggle with Java).

Now first you need to know a couple of differences between the two frameworks:

  • XNA uses Direct3D, LWJGL uses OpenGL
  • XNA is a "proper" framework, LWJGL is a wrapper

Now I have not chosen the last term to debase LWJGL, I just couldn't find a better term for it.

The first thing doesn't mean a lot, since XNA is an abstraction layer, and you don't have to use Direct3D directly yourself, XNA will take care of that. With LWJGL, however, you will have to have some knowledge about OpenGL, since you will be directly interacting with it.

This will mean that you will have to implement more things for yourself, so creating an abstraction layer yourself is probably a good idea (LWJGL doesn't have the SpriteBatch class, for example).

Apart from that, it won't be that difficult. Interacting with graphical hardware works in a similar fashion for all frameworks, so if you already know the basics of vertex buffers and shaders, you'll probably be able to master LWJGL in a couple of months of off and on coding.

share|improve this answer
+1 agreed, for a better comparison LibGDX, Slick2D are more of a framework on top of LWJGL and would be more of a comparison to XNA – AbstractChaos Feb 11 '13 at 21:17

Java lacks some features(useful for gamedev) that C# has:

  1. Operator overloading: In XNA, you can treat vectors like numbers: Position += Velocity. In Java, you have to use methods: Velocity.add(Position), or store vectors as two floats.

  2. Value types: In XNA, you can have Vertex struct. Array of these can be send directly to OpenGL. In Java, you have to use array of primitives. Also, value types are useful for optimization: they don't need Garbage Collector, need less memory, and may be sometimes faster because of the CPU cache.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.