当前位置: 首页 > 工具软件 > Glest > 使用案例 >

Glest(开源RTS游戏)编译备忘

厉钊
2023-12-01

glest是一个基于opengl的开源RTS游戏,官网http://www.glest.org

vc下编译可以参考官方论坛的一个帖子,

http://www.glest.org/glest_board/viewtopic.php?t=3271

 

它是针对vs2008的,虽然帖子中提供的*.sln,*.vcproj文件是针对vs2008的,但是可以修改这些文件然后可以在vs2005中打开。如下:

在notebook中代开glest.sln, game.vcproj, libsglest.vcproj,将文件中与vs2008相关的内容改为vs2005的内容即可,如下:

Format Version 9.00   ---> Format Version 8.00

# Visual Studio 2008  ---> # Visual Studio 2005

Version="9.00"        ----> Version="8.00"

-----------------------------

以下是个人的编译过程

1.解压glest-source-3.1.2.tar.bz2 到glest-source-3.1.2/

2.解压glest-vc2005porj.rar到 glest-source-3.1.2/, 使得glest.sln在glest-source-3.1.2/目录下

3.解压win32-glest-deps.rar 到glest-source-3.1.2/ ,使得deps/ 和 glest.sln在同级目录

将VC inlucde目录下的glu.h 拷贝到 deps/include,将VC/lib目录下glu32.lib 拷贝到 deps/lib.

4.open glest.sln.

5..在工程文件属性中确认:

a)c/c++->代码生成->运行时库: /MT( release 版本时) and /MTD( debug版本时)

b)链接器->系统->子系统subsystem:/console

c) 设置附加的include目录和lib目录

对于game.vcproj

include dirs(release &debug):

../deps/include;../shared_lib/include/sound/ds8;../shared_lib/include/graphics;../shared_lib/include/graphics/gl;../shared_lib/include/platform/win32;../shared_lib/include/sound;../shared_lib/include/util;../shared_lib/include/xml;./ai;./facilities;./game;./global;./graphics;./gui;./main;./menu;./network;./sound;./type_instances;./types;./world

link dirs(release &debug):

../deps/lib;"../shared_lib/$(ConfigurationName)";"../../build/$(ConfigurationName)/libglest/"

需要链接的lib库(release版本):

dsound.lib

dxguid.lib

ogg_static.lib

vorbis_static.lib

vorbisfile_static.lib

xerces-c_2.lib

opengl32.lib

glu32.lib

wsock32.lib

libglest.lib

mmc.lib

libcmt.lib

xerces-c_static_2.lib

需要链接的lib库(debug版本):

dsound.lib

dxguid.lib

ogg_static_d.lib

vorbis_static_d.lib

xerces-c_2D.lib

opengl32.lib

glu32.lib

wsock32.lib

libglest.lib

mmc.lib

xerces-c_static_2D.lib

vorbisfile_static_d.lib

vorbisenc_d.lib

---------------------------------

对于libglest.vcproj

include dirs(release & debug):

gl/;../deps/include;./include/sound/ds8;./include/graphics;./include/graphics/gl;./include/platform/win32;./include/sound;./include/util;./include/xml;./glest_game/ai;./glest_game/facilities;./glest_game/game;./glest_game/global;./glest_game/graphics;./glest_game/gui;./glest_game/main;./glest_game/menu;./glest_game/network;./glest_game/sound;./glest_game/type_instances;./glest_game/types;./glest_game/world

无需链接lib库

------------------

至此,编译链接应该可以通过了

-------------------------------------------------------------------

笔者在运行时出错--"Unknow sound factory :OpenAL"

故做了如下修改,

6.打开glest-source-3.1.2/glest.ini

FactorySound=OpenAL

修改为

FactorySound=DirectSound8

7.以glest-source-3.1.2/为准,拷贝../../build/($configureName)/game/glest.exe 到glest-source-3.1.2/

运行glest.exe, 应该OK!

 

个人认为游戏很漂亮,有魔兽的感觉,:)

 运行时所需的glest.ini文件,可下载安装glest_3.1.2.exe后在根目录下获得。为方便,我暂将glest.ini附于此。

-------------------------------glest.ini---------------------------

; === propertyMap File ===

AiLog=0

AiRedir=0

CheckGlCaps=1

ColorBits=32

ConsoleMaxLines=10

ConsoleTimeout=10

DayTime=1000

DebugMode=0

DepthBits=16

FactoryGraphics=OpenGL

FactorySound=DirectSound8

FastSpeedLoops=2

Filter=Bilinear

FilterMaxAnisotropy=1

FirstTime=0

FocusArrows=1

FogOfWar=1

FogOfWarSmoothing=1

FogOfWarSmoothingFrameSkip=3

FontConsole=-*-*-*-*-*-*-12-*-*-*-*-*-*-*

FontDisplay=-*-*-*-*-*-*-12-*-*-*-*-*-*-*

FontMenu=-*-*-*-*-*-*-12-*-*-*-*-*-*-*

Lang=english.lng

MaxLights=1

NetworkConsistencyChecks=1

PhotoMode=0

RefreshFrequency=75

ScreenHeight=768

ScreenWidth=1024

ServerIp=192.168.1.100

ServerPort=6666

ShadowAlpha=0.2

ShadowFrameSkip=2

ShadowTextureSize=512

Shadows=Projected

SoundStaticBuffers=16

SoundStreamingBuffers=4

SoundVolumeAmbient=75

SoundVolumeFx=75

SoundVolumeMusic=55

StencilBits=0

Textures3D=0

Windowed=0

-----------------------------------------------------------------

 类似资料: