j2me商业手机游戏的技术及运作内幕!部分代码+Demo

litianyu 2005-03-08 05:12:27

我肯定来这里的朋友大部分都是做技术的,所以可以得出2个结论。第一,高品质商业手机游戏的内核对其据有很大吸引力。第二,相当多的程序员对技术了解多,对运作了解少,干了很多活,没拿多少钱。本来这些内容是我要保密的,但是我要讲出来,因为一个的原因——我有私事寻求帮助。不可否认我的动机,但是不论因为什么原因结识,我们有可能成为朋友或合作伙伴。


我打算按下面的顺序来说:
1.开发技术
2.商业运作
3.我写的ARPG游戏的demo下载
4.关于我和我寻求的帮助

一、游戏内核
我在学习j2me游戏编程的时候,在网上搜索了大量的资料,其中包括流传很广的《极品3D手机游戏开发过程全揭秘》(数位红自吹的广告)和《》(讲解太浅,完全属于最最最基础的内容基本上没有价值)。其实国内的高手不多,但也不少,只是没有人真正愿意把自己的开发经验和代码放出来砸自己的饭碗。我也如此,只是现在比不得以,所以讲部分出来。
先放一小段代码上来,再说说其他方面。

public class Core extends Canvas
implements Runnable , RecordFilter {


//////////////////////////////////////////////////////////////////
//Game core
//////////////////////////////////////////////////////////////////


//#ifndef Core.GameCanvas

//define constant to handle game key states
public static final int UP_PRESSED = 1 << UP;
public static final int DOWN_PRESSED = 1 << DOWN;
public static final int LEFT_PRESSED = 1 << LEFT;
public static final int RIGHT_PRESSED = 1 << RIGHT;
public static final int FIRE_PRESSED = 1 << FIRE;
public static final int GAME_A_PRESSED = 1 << GAME_A;
public static final int GAME_B_PRESSED = 1 << GAME_B;
public static final int GAME_C_PRESSED = 1 << GAME_C;
public static final int GAME_D_PRESSED = 1 << GAME_D;
//double buffer
private Image __bufferedImage;
//clip
private boolean __setClip;
private int __clipX, __clipY, __clipWidth, __clipHeight;

public void paint(Graphics g)
{
if (this.__setClip) {
g.clipRect( this.__clipX, this.__clipY, this.__clipWidth, this.__clipHeight);
this.__setClip = false;
}
g.drawImage(this.__bufferedImage, 0, 0, Graphics.TOP | Graphics.LEFT );
}

public void flushGraphics()
{
repaint();
serviceRepaints();
}

public void flushGraphics(int x, int y, int width, int height)
{
this.__setClip = true;
this.__clipX = x;
this.__clipY = y;
this.__clipWidth = width;
this.__clipHeight = height;
repaint();
serviceRepaints();
}

//#endif


//define constant to handle soft key states
public static final int SOFT_FIRST_PRESSED = GAME_A_PRESSED;
public static final int SOFT_LAST_PRESSED = GAME_B_PRESSED;
//MIDlet object
private MIDlet __midlet;
//key states and soft key states
private int __keyStates, __currentKeyStates, __lastKeyStates, __softKeyStates, __currentSoftKeyStates, __lastSoftKeyStates;
//used for sleep
private long __lastSystemTime, __elapsedTime;

//canvas Graphics object
private Graphics g;
//view window
private int viewX, viewY, viewWidth, viewHeight;
//running and pause flags
public boolean running = true;
public boolean pause;
//clock
private boolean clockRunning = true;
public long virtualTime;
//frame delay
private long frameDelay = 120;
//auto flushGraphics

public Core(MIDlet m) {
//#ifndef Core.GameCanvas
super();
//#else
//# super(false);
//# setFullScreenMode(true);
//#endif


//#ifdef Core.GameCanvas
this.viewWidth = getWidth();
this.viewHeight = getHeight();
//#else
//#if polish.FullCanvasSize:defined
//#= this.viewWidth = ${polish.FullCanvasWidth};
//#= this.viewHeight = ${polish.FullCanvasHeight};
//#else
//# this.viewWidth = getWidth();
//# this.viewHeight = getHeight();
//#endif
//#endif


//#ifndef Core.GameCanvas
this.__bufferedImage = Image.createImage(this.viewWidth, this.viewHeight );
this.g = this.__bufferedImage.getGraphics();
//#else
//# this.g = getGraphics();
//#endif


//midlet
this.__midlet = m;
}

protected void keyPressed(int keyCode) {

//#ifndef Core.GameCanvas
this.__keyStates |= 1 << getGameAction(keyCode);
//#endif



switch (keyCode) {
//#ifdef polish.key.LeftSoftKey
//# case ${polish.key.LeftSoftKey}:
//#else
case -6:
//#endif
this.__softKeyStates |= SOFT_FIRST_PRESSED;
break;
//#ifdef polish.key.RightSoftKey
//# case ${polish.key.RightSoftKey}:
//#else
case -7:
//#endif
this.__softKeyStates |= SOFT_LAST_PRESSED;
break;
}

}

protected void keyReleased(int keyCode) {

//#ifndef Core.GameCanvas
this.__keyStates &= ~(1 << getGameAction(keyCode));
//#endif



switch (keyCode) {
//#ifdef polish.key.LeftSoftKey
//# case ${polish.key.LeftSoftKey}:
//#else
case -6:
//#endif
this.__softKeyStates &= ~SOFT_FIRST_PRESSED;
break;
//#ifdef polish.key.RightSoftKey
//# case ${polish.key.RightSoftKey}:
//#else
case -7:
//#endif
this.__softKeyStates &= ~SOFT_LAST_PRESSED;
break;
}

}

/**
* detect user input
*
* @param keyPressedConstant
* XXX_PRESSED constant like FIRE_PRESSED
* @param detectsStroke
* set true to detect stroke action,false to detect key pressed
* state
* @param soft
* set true to detect soft key,false to detect game key.
* @param update
* set true to update key(soft key) state
* @return
*/
private final boolean detectInput(int keyPressedConstant, boolean detectsStroke,boolean soft,boolean update){
if(soft){
if(update){
this.__lastSoftKeyStates = this.__currentSoftKeyStates;
this.__currentSoftKeyStates = this.__softKeyStates;
}

if(detectsStroke){
return ((this.__lastSoftKeyStates & keyPressedConstant) != 0) && ((this.__softKeyStates & keyPressedConstant) == 0);
}else{
return ((this.__softKeyStates & keyPressedConstant) != 0);
}
}else{
if(update){
//#ifdef Core.GameCanvas
//# this.__keyStates = getKeyStates();
//#endif
this.__lastKeyStates = this.__currentKeyStates;
this.__currentKeyStates = this.__keyStates;
}

if(detectsStroke){
return ((this.__lastKeyStates & keyPressedConstant) != 0) && ((this.__keyStates & keyPressedConstant) == 0);
}else{
return ((this.__keyStates & keyPressedConstant) != 0);
}
}
}

//implements interface Runnable
public void run(){
try{
initialize();

while (running) {
this.__lastSystemTime = System.currentTimeMillis();

if(!pause){
//#ifndef Core.GameCanvas
this.g = this.__bufferedImage.getGraphics();
//#else
//# this.g = getGraphics();
//#endif
executeFrameTask();
if(clockRunning){
this.virtualTime += this.frameDelay;
}
}

this.__elapsedTime = System.currentTimeMillis() - this.__lastSystemTime;
if (this.__elapsedTime>0 && this.__elapsedTime < this.frameDelay) {
try{
Thread.sleep(this.frameDelay - this.__elapsedTime);
}catch(InterruptedException ie){}
}

//#mdebug benchmark
//# System.out.println("elapsed time: " + String.valueOf(this.__elapsedTime) +
//# " (" + String.valueOf(this.__elapsedTime*100/this.frameDelay) + "%)");
//#enddebug
}

this.__midlet.notifyDestroyed();
//#mdebug info
//# System.out.println("game stop normally.");
//#enddebug
}catch(Exception e){
//#mdebug fatal
//# System.out.println("a fatal error occured.");
//# e.printStackTrace();
//#enddebug

showSystemHint(Locale.get("Game.SystemError"));

this.__midlet.notifyDestroyed();
}
}
//略……
}
...全文
811 50 打赏 收藏 转发到动态 举报
写回复
用AI写文章
50 条回复
切换为时间正序
请发表友善的回复…
发表回复
67 2005-03-10
  • 打赏
  • 举报
回复
j2me技术是很简单的,主要看对游戏的理解,以及游戏架构的掌握
我做了2年j2me,最近准备做别的了,可惜帮不上你了。
dvictor 2005-03-10
  • 打赏
  • 举报
回复
唉 只能祝福楼主了
贝壳鱼 2005-03-10
  • 打赏
  • 举报
回复
楼主既然有办法了,就结帖吧
miaoliujun 2005-03-10
  • 打赏
  • 举报
回复
对不起,我不在北京。

同时,我相信一个想自己做一番事业的人,住房的事应该能解决。
penfe 2005-03-10
  • 打赏
  • 举报
回复
极品啊……
娘子,出来看妖怪啊。
litianyu 2005-03-10
  • 打赏
  • 举报
回复
给关注j2me的朋友介绍个东西~,超级好用。

www.j2mepolish.org

里面中文介绍是我翻译的,很仓促有能力的朋友看英文吧。
litianyu 2005-03-10
  • 打赏
  • 举报
回复
有3-4家国外的服务上和我们联系了,另外我们正寻求和某知名品牌手机的捆绑,希望能谈成:)。

在技术上,我要说明一点:
j2me技术的确没什么高深的地方,关键在于很多技巧。比如游戏,重要的是把技术潜力发挥到极限,而不仅仅是实现功能。

看看gameloft的收入,j2me游戏有没有钱途不言而喻了。关键是你能不能拿出好东西!
litianyu 2005-03-10
  • 打赏
  • 举报
回复
谢谢上面的兄弟们

事实上,已经无法挽回了。我去只是划个句号!
yexing 2005-03-09
  • 打赏
  • 举报
回复
还要说一下,遇到问题要冷静
yexing 2005-03-09
  • 打赏
  • 举报
回复
我的小师弟,我是七系九八的,就是后来的人文管理学院,可惜我也不在北京。我是去年才离开部队的,当初也不习惯,不过没有你那么极端,我们级有人和你一样,跑掉了,然后被退学。。。现在回想起来,当兵的日子还是不错的,除了有些浪费时间:)
行业达人 2005-03-09
  • 打赏
  • 举报
回复
去招待所吧!大概一百多一天!
wingser 2005-03-09
  • 打赏
  • 举报
回复
midp 1.0模拟2.0有开源的代码,有这么好现的吗
hubo2003hq 2005-03-09
  • 打赏
  • 举报
回复
楼主 厉害 很佩服你的一些观念 不过 什么事都可以自己想到办法的 我在广州 可惜可帮不了你!!
顶下先!~~~~
heidongstar 2005-03-09
  • 打赏
  • 举报
回复
楼主说的怎么这么凄凉呢?
acc1982 2005-03-09
  • 打赏
  • 举报
回复
我想活人是不会被尿给憋死的,你一个堂堂男儿,只要愿意走到哪里都会快乐的生活下去的!祝你好运!!
sharphero2003 2005-03-09
  • 打赏
  • 举报
回复
谢谢,请给个地图编辑器的写法吧!
kuibobo 2005-03-08
  • 打赏
  • 举报
回复
好运
metaphy 2005-03-08
  • 打赏
  • 举报
回复
我倒是在北京,但没办法给你提供住的地方
最好找找同学什么的,
在大学里找个地方招待所也可以


好运!
up
metaphy 2005-03-08
  • 打赏
  • 举报
回复
为什么不住旅馆?
IsGoldenFinger 2005-03-08
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/3829/3829268.xml?temp=.1739771
加载更多回复(30)

13,100

社区成员

发帖
与我相关
我的任务
社区描述
Java J2ME
社区管理员
  • J2ME社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧