游戏开发论坛

 找回密码
 立即注册
搜索
查看: 4765|回复: 1

HL2初探(总结前人+个人观点)

[复制链接]

2

主题

4

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2003-11-14 01:29:00 | 显示全部楼层 |阅读模式
HL2代码部分目录及其内容

appframework目录: 应用程序框架

class CAppSystemGroup : public IAppSystemGroup        //应用程序系统组
// This class represents a group of app systems that all have the same lifetime
// that need to be connected/initialized, etc. in a well-defined order
有连接、断开、初始化、删除、关闭应用系统,加载和卸载模块


class IApplication                                //应用程序接口
// NOTE: The following methods may be implemented in your application
// although you need not implement them all...
所有app都有Create()、main()等                       

class IAppSystem                                //应用系统接口

//-----------------------------------------------------------------------------
// This interface represents a group of app systems that all have the same
// lifetime that need to be connected/initialized, etc. in a well-defined order
//-----------------------------------------------------------------------------
class IAppSystemGroup                                ////应用程序组接口

cl_dll目录:cstrike/vgui(虚拟GUI?)下,buy菜单
CBuyMenu::CBuyMenu(vgui:anel *parent) : WizardPanel(parent, "BuyMenu")
{
        SetScheme("ClientScheme");
        SetProportional( true );
        SetTitle( "#Cstrike_Buy_Menu", true);

        SetMoveable(false);
        SetSizeable(false);

        // hide the system buttons
        SetTitleBarVisible( false );

        SetAutoDelete( false ); // we reuse this panel, don't let WizardPanel delete us
       
        // the base sub panels
        _mainMenu = new CBuySubMenu( this, "mainmenu" );
        _mainMenu->LoadControlSettings( "Resource/UI/MainBuyMenu.res" );
        _mainMenu->SetVisible( false );

        _equipMenu = new CBuySubMenu( this, "equipmenu" );
        switch( C_CSPlayer::GetLocalCSPlayer()->GetTeamNumber() )
        {
        case TEAM_TERRORIST:
                _equipMenu->LoadControlSettings( "Resource/UI/BuyEquipment_TER.res" );
                break;
        case TEAM_CT:
        default:
                _equipMenu->LoadControlSettings( "Resource/UI/BuyEquipment_CT.res" );
                break;
        }
        _equipMenu->SetVisible( false );

        LoadControlSettings( "Resource/UI/BuyMenu.res" );
        ShowButtons( false );
}

common目录:GameUI,keyframe(关键帧?),materialsystem等的公共部分

devtools目录:开发工具,.exe文件

dlls目录:ai文件,定义npc的一些移动,躲避等动作,
          ai的criteria,pathfinder,responseSystem,schedule
          
dx8sdk,dx9sdk目录:dx8,dx9的开发包

engine目录:引擎系统
        在游戏里,剧情的进行,形形色色的角色,场景的变换,
        都不是用编程语言一句一句来控制的,而是制定好一种模式、
        一种框架,依靠数据文件来完成的。
        一个成功的游戏引擎,可以适用于同一类型的游戏,
        你通过改动与美工、声音、剧情有关的数据文件,就可以构成一个全新的游戏了。
       
        引擎至关重要,它要负责游戏的很多方面,游戏的运作,包括画面的显示,声音系统,用户输入的接受,
        剧情的进展,战斗的模式,每个角色、物品、武功数据的存取,以及当前游戏进行状态的保存和恢复。
       
        该目录下有一些gl_开头的文件,里面有一些画线画面的函数。
       
filesystem目录:       
        低级文件操作:打开、读取、关闭,写入等;
        高级文件操作:块拷贝、载入、进度计数等;
       
gameshare目录:游戏中的一些共享文件

gameui目录:游戏用户接口,包括基本面板,player列表等

ivp目录:两个强有力的仿真物理,havok和ivp(Ipion Virtual Physics)

launcher目录:调用各个子系统的(文件、引擎、接口、应用等)

launcher_main目录:整个大系统入口,winmain函数

int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
        //...
        LauncherMain_t main = (LauncherMain_t)GetProcAddress( launcher, "LauncherMain" );
        return main( hInstance, hPrevInstance, lpCmdLine, nCmdShow );
        //...
}

lib目录:各个系统的lib文件

linux目录:linux下各部分的makefile

master目录:似乎是少量网络编程函数

materialsystem目录:材料、阴影、纹理、贴图等相关内容

maxsdk目录:3dsmax开发包

public目录:包含许多前面提到的目录,内容大多为.h文件

shaderlib目录:阴影dll文件生成

shell目录:制作autorun,各国语言版本,卸载程序

status目录:程序运行时的一些统计数据

studiorender目录:渲染,如加阴影、去阴影,计算光源等

tier0目录:处理debug信息,时间,内存管理,游戏的录像,播放等

tracker目录:实现对服务器、网络、用户等的监控
        在adminserver中可以知道是在创建游戏或者加入游戏等
       
unitlib目录:单元测试库
// Usage model for the UnitTest library
//
// The general methodology here is that clients are expected to create unit
// test DLLs that statically link to the unit test DLL and which implement
// tests of various libraries. The unit test application will dynamically
// load all DLLs in a directory, which causes them to install their test cases
// into the unit test system. The application then runs through all tests and
// executes them all, displaying the results.

utils目录:工具集,包括打包、报告bug等许多

vgui2、vguimatsurface目录:GUI

vphysics目录:也是有关物理方面的,物理碰撞、声音碰撞,运动控制,工具控制等

vstdlib目录:一些标准库函数,包括随机数生成等

vtf目录:vtf,一种纹理文件格式,本系统予以简化

worldcraft目录:地图编辑器



资源:        http://www.gameres.com
        http://www.halflife2.org
       

1

主题

15

帖子

15

积分

新手上路

Rank: 1

积分
15
发表于 2003-11-15 18:33:00 | 显示全部楼层

Re:HL2初探(总结前人+个人观点)

很好!你是按目录来分的!我对HL2进行工程DSP逐一进行了浏览!主要的工程数目有137个。从工程角度来看其基本内容与你说的完全相符!但有一些工程项目还没有搞明白!不过我发现这些程序代码有好多工程是用来测试的。比如,utils\hlmvtest下的内容和utils\hlmviewer下的内容是基本相同,都是HL2的模型浏览器。还有一些是它方的开发包样例,如QHTM并不是Valve自己的东东。有一些搞不明白是用来做什么的,如particle。
其实我觉得目前我们的工作任务,不应该在研究目录的作用上了,而应该深入到某个类的作用和相互之间的关系了,然后细化到函数的作用及调用 关系。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-5-11 02:31

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表