站内搜索: 请输入搜索关键词

当前页面: 开发资料首页业界新闻开源J2ME游戏引擎 Gmatrix 0.01 版本发布

开源J2ME游戏引擎 Gmatrix 0.01 版本发布

摘要: Gmatrix是一款轻量级的游戏引擎. 包含一个自主编写的轻量级的xmlReader类:去掉write和对nested结构的复杂逻辑以及一个清晰的分离体系:游戏控制、游戏生命体、道具、场景、游戏引擎、动画播放、音效播放、游戏事件等元素,利于代码重构和升级等等
Gmatrix 0.01版本发布了.

这是Gmatrix第一次发布源代码.





授权协议:Matrix license(见Matrix.org.cn)

作者:cleverpig


发布日期:2006-10-09

代码版本:0.01

gmatrix项目Logo:征集中!

mail-list:matrix的j2me论坛

一、开源主旨

与坛子里的同学共享,相互促进。在本版尝试发布,待代码完善后发布于matrix社区,呵呵,这有待老大的批准(口头已通过哦)!

二、框架特点

1.自主编写的轻量级的xmlReader类:去掉write和对nested结构的复杂逻辑;

2.分离体系:游戏控制、游戏生命体、道具、场景、游戏引擎、动画播放、音效播放、游戏事件等元素,利于代码重构和升级;

3.有用的工具类:文件IO类、计时器类、坐标类、边界测量类、运动类、随机数类、字符串扩展类;

4.中文javadoc:适合初学者阅读。

大家可以下载源代码,look一下其中的uml\export目录,此目录下为uml图。由于图片比较big,这里就不一一显示了。

src:源代码目录。
其中src\cn\org\matrix\gmatrix\gameLab:gmatrix引擎代码的package。
src\cn\org\matrix\gmatrix\practice\demo01:使用gmatrix引擎渲染运行的Demo01游戏演示。

res:资源目录(图片、music、配置文件)。

uml:uml图存放目录。[/color]

[b]tools:开发游戏用到的工具包(地图工具)。


三、使用gmatrix引擎开发的Demo01游戏截图


图-1:“粗糙”的Demo01游戏菜单界面 :-)


图-2:Demo01游戏装载,亦很粗糙啊!


图-3:Demo01游戏运行


四、gmatrix引擎开发输出

...
npc属性--animationLoopTime=0
npc属性--animationFrameWidth=32
npc属性--animationFrameHeight=32
npc属性--frameSwtichSequence=1,0,3,2
npc属性--eventQueueREF=NONE
npc属性--propertiesREF=NONE
npc属性--type=3
npc属性--id=strawberry
npc属性--name=萝卜
npc属性--life=100
npc属性--attack=10
npc属性--defence=5
npc属性--imgURL=/binaryresource/images/strawberry.png
npc属性--faceURL=/binaryresource/images/face001.png
npc属性--col=6
npc属性--row=2
npc属性--speed=16
npc属性--direction=0
npc属性--animationLoopTime=0
npc属性--animationFrameWidth=32
npc属性--animationFrameHeight=32
npc属性--frameSwtichSequence=1,0,3,2
npc属性--eventQueueREF=NONE
npc属性--propertiesREF=NONE
npc属性--type=3
读取npc元素结束...
被装载的游戏对象:id=cushaw name=南瓜怪 life=100 attack=10 defence=5 imgURL=/binaryresource/images/cushaw.png faceURL=/binaryresource/images/face001.png col=11 row=7 speed=16 direction=0 eventQueue={} animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@1cb37664 propBox={}
被装载的游戏对象:id=cushaw02 name=南瓜怪02 life=100 attack=10 defence=5 imgURL=/binaryresource/images/cushaw.png faceURL=/binaryresource/images/face001.png col=14 row=17 speed=16 direction=0 eventQueue={} animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@f828ed68 propBox={}
被装载的游戏对象:id=flash name=章鱼 life=100 attack=10 defence=5 imgURL=/binaryresource/images/flash.png faceURL=/binaryresource/images/face001.png col=14 row=10 speed=16 direction=0 eventQueue={} animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@ea0ef881 propBox={}
被装载的游戏对象:id=flash02 name=章鱼02 life=100 attack=10 defence=5 imgURL=/binaryresource/images/flash.png faceURL=/binaryresource/images/face001.png col=9 row=9 speed=16 direction=0 eventQueue={} animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@84aee8b propBox={}
被装载的游戏对象:id=spook name=蓝鱼 life=100 attack=10 defence=5 imgURL=/binaryresource/images/spook.png faceURL=/binaryresource/images/face001.png col=5 row=11 speed=16 direction=0 eventQueue={} animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@c5c7331 propBox={}
被装载的游戏对象:id=strawberry name=萝卜 life=100 attack=10 defence=5 imgURL=/binaryresource/images/strawberry.png faceURL=/binaryresource/images/face001.png col=6 row=2 speed=16 direction=0 eventQueue={} animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@e938beb1 propBox={}
npc数量=6
开始读取actor元素...
actor属性--id=actor
actor属性--name=小苹果
actor属性--life=100
actor属性--attack=20
actor属性--defence=15
actor属性--imgURL=/binaryresource/images/apple.png
actor属性--faceURL=/binaryresource/images/face001.png
actor属性--col=9
actor属性--row=19
actor属性--speed=16
actor属性--direction=2
actor属性--animationLoopTime=0
actor属性--animationFrameWidth=32
actor属性--animationFrameHeight=32
actor属性--frameSwtichSequence=1,0,3,2
actor属性--propertiesREF=NONE
读取actor元素结束...
被装载的游戏对象:id=actor name=小苹果 life=100 attack=20 defence=15 imgURL=/binaryresource/images/apple.png faceURL=/binaryresource/images/face001.png col=9 row=19 speed=16 direction=2 eventQueue=null animator=cn.org.matrix.gmatrix.gameLab.engine.animation.Animator@11eaa96 frameSwtichSequence=1,0,3,2
actor数量=1
开始读取layer元素...
layer属性--id=grass
layer属性--tileWidth=32
layer属性--tileHeight=32
layer属性--tileCols=20
layer属性--tileRows=20
layer属性--type=2
layer属性--imgURL=/binaryresource/images/grass.png
layer属性--mapData=1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,
1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,
1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,
1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,
1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1
layer属性--id=road
layer属性--tileWidth=32
layer属性--tileHeight=32
layer属性--tileCols=20
layer属性--tileRows=20
layer属性--type=1
layer属性--imgURL=/binaryresource/images/road.PNG
layer属性--mapData=0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,
0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,
0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,
0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,
0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0
读取layer元素结束...
被装载的游戏对象:id=grass tileWidth=32 tileHeight=32 tileCols=20 tileRows=20 type=2 imgURL=/binaryresource/images/grass.png mapData Size=400
被装载的游戏对象:id=road tileWidth=32 tileHeight=32 tileCols=20 tileRows=20 type=1 imgURL=/binaryresource/images/road.PNG mapData Size=400
layer数量=2
开始读取transformer元素...
transformer属性--id=pass
transformer属性--nextLevel=level01
transformer属性--nextMap=map01
transformer属性--location_col=9
transformer属性--location_row=0
transformer属性--nextMapEntry_col=0
transformer属性--nextMapEntry_row=0
transformer属性--imgURL=/binaryresource/images/pass.png
transformer属性--tileWidth=32
transformer属性--tileHeight=32
读取transformer元素结束...
被装载的游戏对象:id=id=pass nextLevel=level01 nextMap=map01 location_col=9 location_row=0 nextMapEntry_col=0 nextMapEntry_row=0 sprite x=288 y=0
transformer数量=1
开始读取map元素...
map属性--id=map01
map属性--name=芳草地
map属性--width=640
map属性--height=640
map属性--layerREF=grass,road
map属性--npcREF=cushaw,flash,spook,strawberry,cushaw02,flash02
map属性--maptransformerREF=pass
读取map元素结束...
被装载的游戏对象:id=id=map01 name=芳草地 width=640 height=640 layerSet size=2 MapLink size=1 NpcSet size=6
map数量=1
开始读取level元素...
level属性--id=level01
level属性--name=第1关:遨游世界
level属性--firstMapID=map01
level属性--mapREF=map01
读取level元素结束...
被装载的游戏对象:id=id=level01 levelName=第1关:遨游世界 firstMapID=map01 mapSet size=1
level数量=1
开始读取camera元素...
camera属性--id=camera001
camera属性--x=0
camera属性--y=0
camera属性--width=180
camera属性--height=177
camera属性--moveType=1
camera属性--customSize=1
读取camera元素结束...
被装载的游戏对象:id=id=camera001 x=0 y=0 width=180 height=177 moveType=1 customSize=1
camera数量=1
开始读取music元素...
music属性--id=bgmusic
music属性--resURL=/binaryresource/music/theme01.mid
music属性--musicType=audio/midi
music属性--playModel=1
music属性--loopNumber=1
music属性--id=levelUp
music属性--resURL=/binaryresource/music/levelUp.mid
music属性--musicType=audio/midi
music属性--playModel=2
music属性--loopNumber=1
music属性--id=gameOver
music属性--resURL=/binaryresource/music/gameOver.mid
music属性--musicType=audio/midi
music属性--playModel=2
music属性--loopNumber=1
读取music元素结束...
被装载的游戏对象:id=bgmusic resURL=/binaryresource/music/theme01.mid musicType=audio/midi playModel=1 loopNumber=1
被装载的游戏对象:id=levelUp resURL=/binaryresource/music/levelUp.mid musicType=audio/midi playModel=2 loopNumber=1
被装载的游戏对象:id=gameOver resURL=/binaryresource/music/gameOver.mid musicType=audio/midi playModel=2 loopNumber=1
music数量=3
...


下载gmatrix的开发代码v0.01版
源代码:gmatrixProject.zip
↑返回目录
前一篇: Java 数据库 PointBase 5.5 发布
后一篇: Eclipse 3.3 M2 发布