Java 中的游戏编程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/64392/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Game programming in Java?
提问by Niklas
I am looking into game programming in Java to see if it is feasible. When googling for it I find several old references to Java2D, Project Darkstar (Sun's MMO-server) and some books on Java game programming. But alot of the information seems to be several years old.
我正在研究 Java 中的游戏编程,看看它是否可行。在谷歌搜索时,我发现了一些对 Java2D、Project Darkstar(Sun 的 MMO 服务器)和一些关于 Java 游戏编程的书籍的旧参考。但是很多信息似乎已经有好几年了。
So the question I am asking, is anyone creating any games in Java SE 1.5 or above?
所以我要问的问题是,有人在 Java SE 1.5 或更高版本中创建任何游戏吗?
If so, what frameworks are used and are there any best practices or libraries available?
如果是,使用了哪些框架,是否有任何最佳实践或库可用?
采纳答案by Niklas
there is the excellent open source 3d engine called jMonkey (http://www.jmonkeyengine.com) which is being used for a few commercial projects as well as hobby developers... there is also at a lower level the lwjgl library which jmonkeyengine is built on which is a set of apis to wrap opengl as well as provide other game specific libs...
有一个名为 jMonkey ( http://www.jmonkeyengine.com)的优秀开源 3d 引擎,它被用于一些商业项目和业余开发人员......还有一个较低级别的 lwjgl 库,它是 jmonkeyengine建立在一组 apis 上,用于包装 opengl 以及提供其他游戏特定的库...
回答by Fredrik
I haven't directly done any game programming but some scene-demo coding and have found that JOGLis really a quite nice framework to work with. It's Java OpenGL so it has a rich 3D functionality and i do believe there are some open source graphic engines done for it aswell.
我没有直接做过任何游戏编程,而是一些场景演示编码,并且发现JOGL确实是一个非常好的框架。它是 Java OpenGL,所以它具有丰富的 3D 功能,我相信也有一些开源图形引擎为它完成。
回答by MetroidFan2002
GTGE (www.goldenstudios.or.id) is an excellent 2D Java Game Library, with tutorials and an extensive API. It has gone open-source in its latest version, and the source can be downloaded, browsed, etc. at gtge.googlecode.com.
GTGE ( www.goldenstudios.or.id) 是一个优秀的 2D Java 游戏库,包含教程和广泛的 API。它的最新版本已经开源,可以在gtge.googlecode.com下载、浏览源代码等。
回答by basszero
Despite the odd name ( pretty sure he's talking about the soft drink...), this site has loads of resources and examples games both 2D and 3D. Coke and Code
尽管名字很奇怪(很确定他在谈论软饮料......),这个网站有大量的资源和示例游戏,包括 2D 和 3D。可乐和代码
回答by Petteri Hietavirta
http://www.javagaming.org/is a good source for up-to-date information.
http://www.javagaming.org/是获取最新信息的好来源。
Another framework not mentioned yet is Xith3D
另一个尚未提及的框架是Xith3D
回答by Pool
回答by cordinc
As an update, a couple of the JMonkeyEngine guys have forked that project to create Ardor3d, a new version of which was recently released, so its still under active development. Project Darkstar is also still actively developed. Indeed DarkMMOan opensource example Darkstar game is being currently refactoredto use the latest version of both Darkstar and Ardor3d.
作为更新,一些 JMonkeyEngine 人员已经创建了该项目以创建Ardor3d,最近发布了一个新版本,因此它仍在积极开发中。暗星计划也仍在积极开发中。事实上,DarkMMO是一个开源示例 Darkstar 游戏,目前正在重构以使用最新版本的 Darkstar 和 Ardor3d。
回答by davidahines
I've made a list of a bunch of tutorialsthat should be of help
回答by Pjotterke
As mentioned by all others in this topic, there are plenty of excellent libraries/engines available for building games in Java.
正如本主题中的所有其他人所提到的,有许多优秀的库/引擎可用于在 Java 中构建游戏。
Game programming in Java is definitely feasible. Keep in mind though that, as with any other language, getting real-time performance will always take some effort. I wrote a small article about my experiences with using Java for our 3D breakout game 'Caromble!'. It is mainly about the steps we had to take to get our game running smoothly.
用 Java 进行游戏编程绝对是可行的。但请记住,与任何其他语言一样,获得实时性能总是需要付出一些努力。我写了一篇关于我在 3D 突破游戏“Caromble!”中使用 Java 的经验的小文章。它主要是关于我们必须采取哪些步骤才能让我们的游戏顺利运行。
回答by Chris Dearden
I like to code games a bit in my free time. I use a library called slick2d which makes programming the back-end a lot easier. For example, you can copy/paste the example 'main' class file from the Slick2d Wiki and you have your game loop as well as the Update() and Render() methods all ready to go.
我喜欢在空闲时间编写一些游戏代码。我使用了一个名为 slick2d 的库,它使后端编程变得更加容易。例如,您可以从 Slick2d Wiki 复制/粘贴示例“主”类文件,并且您的游戏循环以及 Update() 和 Render() 方法都已准备就绪。
Slick 2d is based on LWGJL and uses it to load images and do other cool things with OpenGL. There is also a bunch of helpful topics at: http://www.java-gaming.org/
Slick 2d 基于 LWGJL,并使用它来加载图像和使用 OpenGL 做其他很酷的事情。还有一堆有用的主题:http: //www.java-gaming.org/