Java当然可以呀,不然《我的世界》运行为啥需要java环境,它就是用Java开发的。
如果你只是做一些简单的小游戏,只是用Java中的javafx或swing就可以了。
如果你是要做3D游戏,就需要用到引擎了,当然2D的也可以用引擎。
所谓的游戏引擎,说的直接一点就是处理图像画面的,你不用就需要自己处理。但目前开发游戏一般都会用到游戏引擎,把素材准备好,然后自己写代码处理游戏的逻辑就OK了。
早几年Java里面的游戏引擎还是有很多的,但现在还活着的已经不多了,下面介绍一个目前Java中比较流行的游戏引擎。
jMonkeyEngine 是一个功能丰富的引擎,能够在各种平台上创建美观复杂的游戏、单人游戏或网络游戏。目前最新版本为3.3.2。
下面是来自官网的一些特性说明,可以看到它支持几个主流的操作系统,并且最高可支持OpenGL 4.5版本,各种特效也都支持了。所以,你用它还是可以开发不少好玩的游戏的。
特性
PlatformsWindows
Linux
Mac OSX
Raspberry Pi 3 (OpenGL ES 2.0)
Raspberry Pi 4 (OpenGL ES 3.2)
Android
Supported Model FormatsGLTF
OBJ
AudioSupport for WAV, MP3 and OGG file formats.
Buffered and Streaming support.
Global, directional and positional sounds.
InputMouse and Keyboard
Touchscreen
Joystick/Joypad/Wheel
SceneGraphBatching
Instancing
2D and 3D scene support
Level of Detail
Light Culling
Single Pass Lighting
AnimationTween API with out of the box support for spatial, bone and morph animations
Stock Tweens availble:Sequence tween: a tween that plays tweens in sequence.
Parallel tween: a tween that plays tweens in parallel.
Delay tween : a tween that just waits…
Stretch tween: a tween that wraps another tween and change its duration.
Camera tween: moves the camera…
CallMethod: calling a method on an object …
Animation Blending
Animation interpolation (interpolors for rotation, position, scale and time)
Hardware Skinning
GraphicsOpenGL support up to OpenGL 4.5
OpenGL ES support up to 3.0
LWJGL2 and 3
Post Processing
Stock Post ProcessorsWater
Screen Space Ambient OcclusionSupports Approximate Normals (50% faster)
Bloom
Cartoon Edge
Color Overlay
Cross-Hatch
Depth Of Field
Fast Approximate Anti Aliasing
Fog
Light Scattering
Posterization
Radial Blur
ToneMap
Unshaded Materials
Phong Lighting Materials
PBR MaterialsSphere and OrientedBox Probe areas
Light Probe blending (up to 3 light probes)
Supports both Roughness/Metallic & Roughness/SpecularGloss workflow
Vertex, Fragment and Geometry shader support
Texture Atlas support
Particles
LanguageSupport for Java 1.8+
Use Kotlin, Groovy or any combination all in one project.
PhysicsBullet Physics
Minie Physics - A high-powered improved and up-to-date binding around Bullet with “soft body” support.
NetworkingNetworking API supporting UDP/TCP either with low-level Messaging or high-level RMI.
SimEthereal - A high performance library for real-time networked object synching
GUILemur - a fast and efficient Jme-Native 2D and 3D GUI Toolkit.
JME-JFX-11 - A bridge to create a 2D GUI in JME using JavaFX 11.
Entity SystemZay-ES - A high-performance entity-component-system
ProfilingDetailedProfiler - Displays timing information for various areas of your game to determine bottlenecks