您的位置:首页 > 移动开发 > Cocos引擎

关于《FantasyWarrior3D》开源项目编译问题的补充说明

2014-12-11 12:47 531 查看
FantasyWarrior3D 是基于Cocos2d-x + Lua的一款3D开源游戏项目。相关的介绍请参考:Cocos2d-x
3D开源项目《Fantasy Warrior3D》

本文主要针对论坛中很多开发者反应无法正常运行的问题,解释一下如何操作,并做出一些说明:

一、操作步骤(以下均以Mac平台为例,Windows基本一致):

1.下载最新版Cocos Code IDE(目前最新版是1.01),环境搭建可以观看这个视频:

2.下载Cocos2d-x 3.3beta0以上版本(这里以Cocos2d-x3.3-RC0为例),下载地址:http://cn.cocos2d-x.org/download/(目前最新版本是3.3rc0)

3.下载或者克隆FantasyWarrior3D项目,下载地址:https://github.com/chukong/FantasyWarrior3D

4.打开Cocos Code IDE,点击Cocos Code IDE,Preferences,Cocos,Lua,设置Lua Frameworks,路径是第2步下载的Cocos2d-x 3.3rc0目录。



5.点击Cocos Code IDE工作区空白区域,右键选择导入Cocos Project,选择第3步下载的FantasyWarrior3D项目。

注意:导入的时候注意不能勾选升级到最新版本(upgrade runtime/framework to new version)。



6.点击build runtime,编译Mac runtime,注意编译结果Success。如果编译错误,请在论坛留言。

7.点击Debug Configurations,修改Mac OSX的runtime path,选择编译出来的runtime,正常是:runtime/mac/FantasyWarrior3D Mac.app,如图



修改为 



8.点击调试或者运行,可以看到蓝色的play界面(正常会直接进入游戏)

注意下右下角引擎版本是不是Cocos2d-x 3.2beat0(这个版本才是对的,不管你在第2步下载的引擎是什么版本,为什么?下面有解释)。如果是其他版本,则说明你可能在第5步时不小心升级了引擎版本。



====> 



二、几个疑问:

Q1.FantasyWarrior3D项目的framework目录下不是自带了引擎,为什么还需要下载一个单独的Cocos2d-x 3.2beta0以上版本的引擎?

A.FantasyWarrior3D项目的framework目录下的引擎代码是Native Code,是FantasyWarrior3D依赖的引擎代码。因为创建Cocos Code IDE项目的时候,console并没有跟在模板拷进去,但是项目的编译又是依赖于console的,所以需要另外下一个引擎包作为Lua Framework。如果不设置,在编译runtime的时候会强行要求设置。

Q2.一定要是Cocos2d-x 3.2beta0以上的版本吗?

A.FantasyWarrior3D项目是基于Cocos2d-x 3.2beta0项目编写的,在较低版本的引擎上并没有进行完整测试,所以建议下载Cocos2d-x 3.2beta0以上的版本作为Lua Framework。

Q3.为什么强调在导入项目的时候不能勾选升级选项?

A.虽然游戏项目是基于Cocos2d-x 3.2beta0编写的,但是在引擎的基础上我们进行了一些功能上的扩展和定制。主要保存在cocos/custom目录下,同时引擎其他部分也进行了一定的修改,这部分内容即保存在项目中的framework目录下。如果勾选了升级选项,引擎部分会被Cocos Code IDE自动替换,导致Native Code对不上。如果已经勾选过的,请重新下载FantasyWarrior3D项目,或者执行git命令:git checkout .。

Q4.为什么出现蓝色play界面的时候,强调显示Cocos2d-x3.3rc0是错的,3.3beta0才是对的?

A.蓝色play界面显示的版本号实际上是Native Code的引擎版本,并不一定是Lua Framework的引擎版本,所以要求显示是3.3beta0。

cocos2d: value at stack [-1] is not function

cocos2d: debug args = require('debugger')(,'/Users/chen/Documents/PrebuiltRuntimeLua/debugruntime/')

cocos2d: cocos2d: fullPathForFilename: No file found at src/main.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/init.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/Cocos2d.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/Cocos2dConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/extern.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/bitExtend.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/DrawPrimitives.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/Opengl.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/OpenglConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocosbuilder/CCBReaderLoad.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocosdenshion/AudioEngine.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocostudio/CocoStudio.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocos2d/json.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/cocostudio/StudioConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/ui/GuiConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/ui/experimentalUIConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/extension/ExtensionConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/network/NetworkConstants.luac. Possible missing file.

cocos2d: cocos2d: fullPathForFilename: No file found at cocos/spine/SpineConstants.luac. Possible missing file.

libpng warning: iCCP: known incorrect sRGB profile

cocos2d: cocos2d: fullPathForFilename: No file found at GameScene.luac. Possible missing file.

图片:屏幕快照 2014-11-19 22.59.21.png 


 [删除]
解决办法

解决办法,先打开XCode工程,选择生成Mac工程,如下图,这样就会在FantasyWarrior3D-master/runtime/mac/FantasyWarrior3D Mac的app文件,然后在CocosIDE中添加Mac OSX的Runtime  Path,右击工程,Debug   As,选Debug  Configurations,在Mac  OSX的Runtime   Path下选择Browse,只能通过它更改Path,粘贴上去是无效的。然后就可以点击Mac  Run了 

图片:屏幕快照 2014-11-19 23.24.56.png 


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息