Project Name: Game – Legend of Swordsman
Project Type: RPG GAME
Project Objective: Practice In Game Programming
Story Background Brief:
The time is in the end of Sui Dynasty, The evil who named
ShiYou, which was defeated by HuangDi and close it up before, had escaped due to the watcher careless and the dangerous point is he wanted to unify the ancient China. Because of HangDi had been an immortal already, he didn’t care the things happened on earth anymore. So the celestial being dispatched four celestial beasts that called QinLong, BaiHu, ZhuQue, and XuanWu to the earth to stop the evil’s scheme.
Develop Group Member:
- Huang Zheng Shu.
Developing Environment: Microsoft Windows 98
Developing Toolkit: Microsoft SDK & DirectX SDK
Microsoft Virtual C++ 6.0
Developing Language Decided: C
System Analysis
Brief:
This is first game program we do, lack experiment; we can just record what we think.
Developing Plan:
I think we should following the steps follow:
- Practical Program Period:
- Doing some practical program, find out what kind programming technique we need.
- Doing some preparing work, include:
- Picture Gathering
- Music And Sound Gathering
- Literature Writing, include:
- Story Writing
- Actor’s Conversation Writing
- Gamming System Construction:
- Menu System Design
- Actor Design
- Primary Actor Design
- Secondary Actor Design
- Monster Design
- Characteristic of All Actors Design
- Game Event Design
- Stage Property Design
- Fighting System Design
- Game Rule System Design
- Game Control System Design
- Music And Sound System Design
- Music Chosen
- Sound Chosen
- Game Map Design
- Game Route Design
- Secondary Program Development Period:
- Engine Program Library
- Map Editor Program
- Primary Program Development Period
- Testing Period
System Design
Map Editor Development
BRIEF
Sub Project Name: Map Editor Development
Project Objective: Produce The Game Maps
Develop Environment: Microsoft Windows 98
Program Developing Language: C
Developing Toolkit: Microsoft Virtual C++ 6.0
Developing Technique Needed:
- WIN32 Programming Technique
- DirectX Programming Technique
Function Prospect:
- Throughout an easy way to edit game maps.
- You can select your won bitmap element what you want.
- The program should support keyboard and mouse.
- The program should include menu area, toolbars area; edit area and statue bar area.
- The maps can be saved and loaded.
- The editor area and toolbar can be scrolled.
STRUCTURE DESIGN
Map Structure
MENU DESIGN
Draft Design
Menu Variable Design
Macro Name |
Value |
Menu Item Name |
ID_MENU_NEW_MAP |
0 |
New Map |
ID_MENU_LOAD_MAP |
1 |
Load Map |
ID_MENU_SAVE_MAP |
2 |
Save Map |
ID_MENU_EXIT |
3 |
Exit |
MAP EDITOR EVENT LOOP
State Transition Diagram For Map Editor loop
State Flags Design
(Used In Macro Definition)
Macro Name |
Value |
Description |
MAPEDITOR_INIT |
0 |
Flag for initialize map editor |
MAPEDITOR_MENU |
1 |
Flag for run map editor menu |
MAPEDITOR_START |
2 |
Flag for map editor starting |
MAPEDITOR_RUN |
3 |
Flag for map editor running |
MAPEDITOR_RESTART |
4 |
Flag for map editor restarting |
MAPEDITOR_SHUTDOWN |
5 |
Flag for map editor shutdown resource |
MAPEDITOR_EXIT |
6 |
Flag for map editor exit |
Global Variables Design
Variable Type |
Variable Name |
Initial Value |
Description |
Int |
G_iMapEditor_State |
MAPEDITOR_INIT |
This global save map editor running state |
MAIN PRPOGRAM MODULE
Main Program Flowchart Diagram
Module Objective
- The module is a primary module of this program.
- The primary task is creating a window and builds up a main event loop.
Structure English Description
Main function ( )
{
Initialize window class
If (Register window class != success)
Return error message
If (windows exist == true)
Return error message
If (create window != success)
Return error message
Save current window handle to global variable
Save current application handle to global variable
Perform all game specific initialization
Enter main event loop
{
if (there is a message in message queue == true)
{
if (message == WM_QUIT)
break out event loop
translate any accelerator keys
send the message to window proc
}
main map editor process goes here
}
shutdown map editor release all resources
return useless message and exit
}
Main Function Design
Function Name: WinMain
Function Classify: WINAPI
Parameter Pass In:
Parameter Type |
Parameter Name |
Description |
HINSTANCE |
hInstance |
Current application handle |
HINSTANCE |
hPrevInstance |
The parameter not in use any more |
LPSTR |
lpCmdLine |
Pointer to a null-terminate string specifying the command line for application |
Int |
nCmdShow |
Specifies how the windows is to be shown |
Return Value Type: int
Macro Definition Design:
Macro Name |
Value |
Description |
WINDOW_CLASS_NAME |
“MAP_EDITOR” |
Main window class name |
Local Variables Design:
Variable Type |
Variable Name |
Initial Value |
Description |
WNDCLASS |
winclass |
|
This will hold the window class we create |
HWND |
hwnd |
|
Generic window handle |
MSG |
msg |
|
Generic message |
HDC |
hdc |
|
Generic dc |
PAINTSTRUCT |
Ps |
|
Generic paintstruct |
Structure Variable Initialize:
Structure Name: WNDCLASS
Structure Variable Name: winclass
Structure Property |
Initial Value |
Description |
style |
CS_DBLCLKS I CS_OWNDC | CS_HREDRAW | S_VREDRAW |
Specific window property |
lpfnWndProc |
WindowProc |
Assign window process function address |
cbClsExtra |
0 |
Specific the number of extra bytes to allocate following the window- class structure |
cbWndExtra |
0 |
Specific the number of extra bytes to allocate following the window instance |
hInstance |
HInstance |
Current application handle |
HIcon |
LoadIcon(NULL, IDI_APPLICATION) |
Assign icon resource |
HbrBackground |
LoadCursor(NULL, IDC_ARROW) |
Assign cursor resource |
LpszMenuName |
NULL |
Assign menu name of current window |
lpszClassName |
WINDOW_CLASS_NAME |
Assign window class name |
Function Name: FindWindow
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
LPCTSTR |
lpClassName |
WINDOW_CLASS_NAME |
Window class name |
LPCTSTR |
lpWindowName |
“RPG Map Editor” |
Window title |
Return Value Type: HWND
Function Name: CreateWIndow
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
LPCTSTR |
lpClassName |
WINDOW_CLASS_NAME |
Window class name |
LPCTSTR |
lpWindowName |
“RPG Map Editor” |
Window title |
DWORD |
dwStyle |
WS_POPUP | WS_VISIBLE |
Window style |
Int |
X |
0 |
Initialize window x coordinate |
Int |
Y |
0 |
Initialize window y coordinate |
Int |
nWidth |
GetSystemMeteric(SM_CXSCREEN) |
Initialize window width |
Int |
nHeight |
GetSystemMeteric(SM_CYSCREEN) |
Initialize window height |
HWND |
hWndParent |
NULL |
Handle to parent windows |
HMENU |
hMenu |
NULL |
Handle to menu |
HINSTANCE |
hInstance |
hInstance |
Current application handle |
LPVOID |
lpParam |
NULL |
Creation parameters |
Return Value Type: HWND
Function Name: MapEditor_Init
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
Void* |
pParms |
|
Reserve interface |
Return Value Type: int
Function Name: PeekMessage
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
LPMSG |
LpMsg |
&msg |
Pointer to structure for message |
HWND |
HWnd |
NULL |
Handle to window |
UINT |
wMsgFilterMin |
0 |
First message |
UINT |
wMsgFilterMax |
0 |
Last message |
UINT |
wRemoveMsg |
PM_REMOVE |
Removal flags |
Return Value Type: BOOL
Function Name: TranslateMessage
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
LPMSG |
LpMsg |
&msg |
Pointer to structure for message |
Return Value Type: BOOL
Function Name: DispatchMessage
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
LPMSG |
LpMsg |
&msg |
Pointer to structure for message |
Return Value Type: BOOL
Function Name: MapEditor_Main
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
Void* |
pParms |
|
Reserve interface |
Return Value Type: int
Function Name: MapEditor_Shutdown
Pass In Value Description:
Parameter Type |
Variable Name |
Pass In Value |
Description |
Void* |
pParms |
|
Reserve interface |
Return Value Type: int