-
Notifications
You must be signed in to change notification settings - Fork 7
/
design.rtf
70 lines (70 loc) · 16.1 KB
/
design.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{\rtf1\ansi\deff1\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\froman\fprq2\fcharset0 Times New Roman;}{\f3\fswiss\fprq2\fcharset0 Arial;}{\f4\fswiss\fprq2\fcharset0 Bitstream Vera Sans;}}
{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
{\stylesheet{\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033\snext1 Normal;}
{\s2\sb240\sa120\keepn\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af3\afs28\lang255\ltrch\dbch\af1\langfe255\hich\f3\fs28\lang1033\loch\f3\fs28\lang1033\sbasedon1\snext3 Heading;}
{\s3\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033\sbasedon1\snext3 Body Text;}
{\s4\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033\sbasedon3\snext4 List;}
{\s5\sb120\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ai\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\i\loch\f1\fs24\lang1033\i\sbasedon1\snext5 caption;}
{\s6\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033\sbasedon1\snext6 Index;}
{\s7\sb120\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ai\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\i\loch\f1\fs24\lang1033\i\sbasedon1\snext7 caption;}
{\s8\sb120\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ai\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\i\loch\f1\fs24\lang1033\i\sbasedon1\snext8 WW-caption;}
}
{\info{\creatim\yr0\mo0\dy0\hr0\min0}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment StarWriter}{\vern6800}}\deftab709
{\*\pgdsctbl
{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}}
{\*\pgdscno0}\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
\pard\plain \ltrpar\s1\cf0\qc{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs28\lang255\ab\ltrch\dbch\af4\langfe255\hich\fs28\lang1033\b\loch\fs28\lang1033\b {\rtlch \ltrch\loch\f1\fs28\lang1033\i0\b The Design of Skyscraper and the Scalable Building Simulator}
\par \pard\plain \ltrpar\s1\cf0\qc{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0\qc{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 by Ryan Thoryk}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 This document is a basic birds-eye view of the internals of both the frontend and the backend (the Scalable Building Simulator engine) of Skyscraper. This is intended for people who are interested in helping out with C++ development to quickly get fam
iliar with the system's design and how it works.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper is comprised of two parts: the frontend, and the Scalable Building Simulator (backend). The frontend is the controller portion of the program and is responsible for setting up and managing the CrystalSpace environment, for starting and shutting
down the SBS simulator, making calls to SBS, handling keyboard/mouse input, and rendering. The reason this is split is so that there can be multiple frontends sharing the same simulation library, such as the regular Skyscraper app, a graphical building d
esigner, etc all sharing the same SBS.dll. Skyscraper.exe is the frontend, and does those things mentioned above, and also has a script interpreter which makes the SBS calls (the script language is known as ISL2, or Interactive Scripting Language 2).}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0\qc{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ab\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\b\loch\f1\fs24\lang1033\b {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b A Typical Run}
\par \pard\plain \ltrpar\s1\cf0\qc{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 When the program is run, wxWidgets will pass control onto the Skyscraper class for startup (the Skyscraper::OnInit() function). Skyscraper will create the main window, initialize CrystalSpace, set up things such as sound and the buttons, and loop inside th
e main intro screen. When a building is selected, Start() will be called which creates an SBS object, initializes it, runs the script interpreter for the selected file (which makes lots of SBS calls), tells SBS to create the sky, runs SBS's Start() functi
on (the startup initializer), and creates the debug/control panel. Some flags are then set which tell Skyscraper that the simulator is ready to run. When the main screen idles, wxWidgets calls that window's OnIdle() function which calls Skyscraper's Push
Frame() function (this is how the program loops). PushFrame is the program's top-level loop function, and does some CrystalSpace work and calls the program's CrystalSpace event handler. The event handler eventually does a frame dispatch which calls Setup
Frame(), which is Skyscraper's top-level run loop function. This calls things such as the SBS main loop, the input handler (for keyboard/mouse input), the SBS camera loop, and CrystalSpace rendering. So in a normal run, SBS's main loop will be called fir
st in there, which is SBS::MainLoop(). In this loop, other runloops are called, such as Elevator::MonitorLoop() for each elevator (the elevator loop; this handles all elevator movement, elevator door movement, shaft door movement, etc), the camera's Check
Shaft function (which is basically a shaft loop that handles the displaying of shafts), and the camera's CheckStairs function (which is basically the stairs loop and handles the displaying of stairs). The mainloop also handles door callbacks, which opera
te the door movement (it calls Door::MoveDoor() which is the Door main loop and does the raw door movement). After the SBS main loop is run, Skyscraper's input handler is run which gets keyboard and mouse input from wxWidgets, and calls the related SBS fu
nction for these. This function also calls functions such as Camera::ClickObject which checks to see if a user clicked on an object (and performs the related functions for that, such as a button click). After that, the SBS camera loop (Camera::Loop()) is
run, which handles all camera movement, collision detection, and keeping the sound listener object locked to the position and rotation of the camera. Finally the Render() function is run, which tells CrystalSpace to render the 3D graphics onto the screen
. The program will loop in this way, until the main simulator window is closed. When it's closed, wxWidgets will call that window's OnClose() function (MainWindow::OnClose()) which turns off the debug panel timer and calls the main Skyscraper app's OnExi
t function. The Skyscraper::OnExit() function stops the frame printer (automatic renderer), cleans up the sound object, deletes all windows, deletes the SBS object (which causes the simulator to clean up all it's objects), and calls CrystalSpace's Destroy
Application() process which cleans up the rest of the objects.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0\qc{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\rtlch\af1\afs24\lang255\ab\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\b\loch\f1\fs24\lang1033\b {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b Some Function Descriptions}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ab\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\b\loch\f1\fs24\lang1033\b {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b The Frontend:}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::OnInit() - this is called by wxWidgets on program startup, and creates the main window and calls the CrystalSpace initialization function.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::OnExit() - this is called by wxWidgets when a user closes the main window, and is responsible for cleaning up objects and shutting down the app.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 MainScreen \'96 this is a wxWidgets window class, and represents the main simulator window.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::Render() - this is the CrystalSpace rendering function}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::SetupFrame() - this is considered the top-level runloop function, and calls everything else from this, such as the main menu stuff, window resize functions, the SBS main loop, the input handler, the SBS camera loop, and the rendering function.
This function also has speed limiter code in order to keep the simulator running at the same speed despite changes in frame rate (the frame rate is basically how many times a second the entire app performs one loop cycle).}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::HandleEvent() - this is right above SetupFrame(), and is a CrystalSpace event dispatcher; this is responsible for running both the SBS CalculateFrameRate() function and SetupFrame() within a frame event context.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 SkyscraperEventHandler() - this is the top-level event handler, and really just calls HandleEvent. This is outside of the Skyscraper class.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::Initialize() - this is the CrystalSpace initialization code.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::GetInput() - this is the keyboard and mouse input handler. It uses wxWidgets for events, and calls SBS to process those events.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::PushFrame() - this is the CrystalSpace top-level loop code, and is responsible for advancing CrystalSpace's virtual clock, and for calling the event handler. This function is called from MainScreen's OnIdle() function.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::SelectBuilding() - this is the wxWidgets code that pops up a file selection dialog for selecting a building.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Skyscraper::Start() - this starts the simulator. This creates a new SBS object, calls the SBS initialization function, calls the script interpreter (which translates the script commands into SBS calls), tells SBS to create the sky, runs the CrystalSpace
engine object preparation, runs the SBS Start() function, and creates the debug control panel.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 The file fileio.cpp has the raw building loader code and the script interpreter. These are part of the Skyscraper class.}
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033
\par }