commit 5b2ee9f22fdc6fa8b17c583705b378be8808173b Author: Jonatan Pålsson Date: Tue Mar 22 18:37:09 2011 +0100 Added report diff --git a/#report.lyx# b/#report.lyx# new file mode 100644 index 0000000..64e2c8a --- /dev/null +++ b/#report.lyx# @@ -0,0 +1,786 @@ +#LyX 1.6.7 created this file. For more info see http://www.lyx.org/ +\lyxformat 345 +\begin_document +\begin_header +\textclass report +\begin_preamble +\usepackage{indentfirst} +\usepackage{tocloft} +\usepackage{calc} +\date{} +\usepackage[section] {placeins} +\def\myClearpage{% + \ifvmode + \ifnum \@dbltopnum =\m@ne + \ifdim \pagetotal <\topskip + \hbox{}% + \fi + \fi + \fi +% \newpage + \write\m@ne{}% + \vbox{}% + \penalty -\@Mi +} +\def\myCleardoublepage{\myClearpage\if@twoside \ifodd\c@page\else + \hbox{}\if@twocolumn\hbox{}\fi\fi\fi} +\usepackage{morefloats} +\usepackage{graphicx} +\usepackage{subfig} +\usepackage{tocloft} +\renewcommand{\cftchapfont}{\bfseries} +\renewcommand{\cftchappagefont}{\bfseries} +\renewcommand{\cftchappresnum}{Chapter } +\renewcommand{\cftchapnumwidth}{6em} +\oddsidemargin 0.5in +\textwidth 6in +\topmargin 0.0in +\textheight 8.0in +\setlength\topskip{24pt} +\footskip 0.75in +\end_preamble +\use_default_options true +\language english +\inputencoding auto +\font_roman lmodern +\font_sans default +\font_typewriter default +\font_default_family rmdefault +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\paperfontsize default +\spacing double +\use_hyperref false +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\cite_engine natbib_authoryear +\use_bibtopic false +\paperorientation portrait +\paperwidth 11in +\paperheight 8.5in +\leftmargin 1.25in +\topmargin 1in +\rightmargin 1in +\bottommargin 1.7in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\author "" +\author "" +\end_header + +\begin_body + +\begin_layout Title +Generic Game Server +\end_layout + +\begin_layout Author +Jonatan Pålsson +\begin_inset Newline newline +\end_inset + +Niklas Landin +\begin_inset Newline newline +\end_inset + +Richard Pannek +\begin_inset Newline newline +\end_inset + +Matias Petterson +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{roman} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{5} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +contentsname{Table of Contents} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cfttoctitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftaftertoctitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftpartdotsep{6.6} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftchapdotsep{6.6} +\end_layout + +\end_inset + + +\begin_inset CommandInset toc +LatexCommand tableofcontents + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Tables} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftlottitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterlottitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cfttabpresnum}{Table~} +\backslash +setlength +\backslash +cfttabnumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList table + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Figures} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftloftitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterloftitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cftfigpresnum}{Figure~} +\backslash +setlength +\backslash +cftfignumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList figure + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{arabic} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{1} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Introduction +\end_layout + +\begin_layout Section +Background +\end_layout + +\begin_layout Section +Purpose +\end_layout + +\begin_layout Section +Challenges +\end_layout + +\begin_layout Standard +Challenges lies mainly in providing a reliable, high-performing server and + at the same time make it easy to use for game developers. + +\end_layout + +\begin_layout Subsection +Basis +\end_layout + +\begin_layout Section +Delimitations +\end_layout + +\begin_layout Subsection +Types of games +\end_layout + +\begin_layout Standard +In theory no limitations, but in reality it will be limitations. + Many factors are involved here. + Implementation of protocol, storage possibilities, server capacity, language + support. + In real time games a low latency is very important not a high bandwidth + because the games already send very little data, ~ 80 bytes. + Lag of below 250 ms is good, lag up to 500 ms payable and beyond that the + lag is noticeable. +\end_layout + +\begin_layout Section +Method +\end_layout + +\begin_layout Subsection +Development process +\end_layout + +\begin_layout Standard +May be Extreme Programming(XP), need to check this out further. + Maybe adapt so we can say that we use a standardized software development + method. +\end_layout + +\begin_layout Subsubsection +Demand specification +\end_layout + +\begin_layout Subsection +Design +\end_layout + +\begin_layout Subsection +Testing and evaluation +\end_layout + +\begin_layout Standard +Can we use quickcheck? +\end_layout + +\begin_layout Chapter +Theory +\end_layout + +\begin_layout Subsection +Performance +\end_layout + +\begin_layout Standard +How many players can we have on a server? Performance differences between + games? e.g can one game have thousands players on a server and another only + have hundreds? Questions to be discussed here. + +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Create a game with several thousand players, see how our server scales, + how can we improve the performance? Sharding isn’t very nice.. + alternatives? Improve the speed of sharding? +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +Choice of network protocol +\end_layout + +\begin_layout Standard +There are three main ways in which computer communication over the Internet + usually takes place; TCP, UDP and HTTP. + The first two are transport layer protocols, which are commonly used to + transport application layer protocols, such as HTTP. + TCP and UDP can not be used on their own, without an application layer + protocol on top. + Application layer protocols such as HTTP on the other hand needs a transport + layer protocol in order to work. + +\end_layout + +\begin_layout Subsubsection +HTTP +\end_layout + +\begin_layout Standard +Since HTTP is so widely used on the Internet today in web servers, it is + available on most Internet connected devices. + This means that if HTTP is used in GGS, firewalls will not pose problems, + which is a great benefit. + However, due to the intended usage of HTTP in web servers, the protocol + was designed to be stateless and client-initiated. + In order to maintain a state during a game session using HTTP, some sort + of token would have to be passed between client and server at all times, + much like how a web server works. + These facts combined makes HTTP unsuitable for our purposes, since GGS + requires a state to be maintained throughout a session, and also needs + to push data from the server to clients without the clients requesting + data. + It should also be mentioned that HTTP uses the TCP protocol for transport, + and what is said about TCP also applies to HTTP. + +\end_layout + +\begin_layout Subsubsection +UDP +\end_layout + +\begin_layout Standard +Many online games use UDP as the carrier for their application layer protocol. + UDP moves data across a network very quickly, however it does not ensure + that the data transferred arrives in consistent manner. + Data sent via UDP may be repeated, lost or out of order. + To ensure the data transferred is in good shape, some sort of error checking + mechanisms must be implemented. + UDP is a good choice for applications where it is more important that data + arrives in a timely manner than that all data arrives undamaged, it is + thus very suitable for media streaming, for example. + In GGS reliability of transfer was chosen before the speed of the transfer, + ruling out UDP as the transport later protocol. + +\end_layout + +\begin_layout Subsubsection +TCP +\end_layout + +\begin_layout Standard +For reliable transfers, TCP is often used on the Internet. + Built in to the protocol are the error checking and correction mechanisms + missing in UDP. + This ensures the consistency of data, but also makes the transfer slower + than if UDP had been used. + In GGS, data consistency is more important than transfer speeds, and thus + TCP is a better alternative than UDP. +\end_layout + +\begin_layout Subsection +Encryption +\end_layout + +\begin_layout Subsubsection +Performance penalties +\end_layout + +\begin_layout Subsection +Availability +\end_layout + +\begin_layout Standard +One important factor of a server is the availability, a server that you + can not connect to is a bad server. + Erlang has several features to increase the availability, for example hot + code replacement. + It is also critical to have a good design, we want to separate each part + of the server and thus avoiding that the whole server will crash. + +\end_layout + +\begin_layout Standard +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Players are unsatisfied with the service of WoW Telecoms have the same problem + of having to migrate users from one node to another, this is called handover +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +Scalability +\end_layout + +\begin_layout Standard +Because P2P game architectures are a constant goal for cheaters and because + “Cheating is a major concern in network games as it degrades the experience + of the majority of players who are honest” and preventing cheating in P2P + game architectures is very difficult game developers try to use Client + - Server architectures which have a natural problem to scale. + In this paper we want to show some strategies to achieve scalability. +\end_layout + +\begin_layout Subsubsection +UUID +\end_layout + +\begin_layout Subsection +Security +\end_layout + +\begin_layout Standard +We only support languages running in a sandboxed environment. + Each game session is started in its own sandbox. + The sandboxing isolates the games in such a way that they can not interfere + with each other. + If sandboxing was not in place, one game could potentially modify the contents + of a different game. + A similar approach is taken with the persistent storage we provide. + In the storage each game has its own namespace, much like a table in a + relational database. + A game is not allowed to venture outside this namespace, and can because + of this not modify the persistent data of other games. +\end_layout + +\begin_layout Chapter +Overview +\end_layout + +\begin_layout Subsection +Techniques for ensuring reliability +\end_layout + +\begin_layout Standard +One of the main goals of the project is to achieve high reliability. + A highly reliable application is one crashes very, very rarely +\begin_inset Note Note +status open + +\begin_layout Plain Layout +CITATION NEEDED +\end_layout + +\end_inset + +. + There are some tools for creating reliable applications built in to Erlang. + +\end_layout + +\begin_layout Itemize +Links between processes. + When a process spawns a new child process, and the child process later + exits, the parent process is notified of the exit. + +\end_layout + +\begin_layout Itemize +Transparent distribution over a network of processors. + When several nodes participate in a network, it does not matter on which + of these machines a process is run. + Communication between processes does not depend on the node in which each + process is run. + +\end_layout + +\begin_layout Itemize +Hot code replacements. + Two versions of the same module can reside in the memory of Erlang at any + time. + This means that a simple swap between these versions can take place very + quickly, and without stopping the machine. +\end_layout + +\begin_layout Standard +These three features are some of the basic building blocks for more sophisticate +d reliability systems in Erlang. + Many times it is not necessary to use these features directly, but rather + through the design patterns described below. +\end_layout + +\begin_layout Subsubsection +Supervisor structure +\end_layout + +\begin_layout Standard +By linking processes together and notifying parents when children exit, + we can create supervisors. + A supervisor is a common approach in ensuring that an application functions + in the way it was intended. + When a process misbehaves, the supervisor takes some action to restore + the process to a functional state. + +\end_layout + +\begin_layout Standard +There are several approaches to supervisor design in general (when not just + considering how they work in Erlang). + One common approach is to have the supervisor look in to the state of the + process(es) it supervises, and let the supervisor make decisions based + on this state. + The supervisor has a specification of how the process it supervises should + function, and this is how it makes decisions. + +\end_layout + +\begin_layout Standard +In Erlang, we have a simple version of supervisors. + We do not inspect the state of the processes being supervised. + We do have a specification of how the supervised processes should behave, + but on a higher level. + The specification describes things such as how many times in a given time + interval a child process may crash, which processes need restarting when + crashes occur, and so forth. + +\end_layout + +\begin_layout Standard +When the linking of processes in order to monitor exit behaviour is coupled + with the transparent distribution of Erlang, a very powerful supervision + system is created. + For instance, we can restart a failing process on a different, new node, + with minimal impact on the system as a whole. + +\end_layout + +\begin_layout Standard +In GGS, we have separated the system in to two large supervised parts. + We try to restart a crashing child separately, if this fails too many times, + we restart the nearest supervisor of this child. + This ensures separation of the subsystems so that a crash is as isolated + as possible. +\end_layout + +\begin_layout Standard + +\end_layout + +\begin_layout Subsubsection +Hot code replacement +\end_layout + +\begin_layout Subsection +Implementation +\end_layout + +\begin_layout Subsubsection +User interface +\end_layout + +\begin_layout Chapter +Problems +\end_layout + +\begin_layout Subsection +Erlang JS +\end_layout + +\begin_layout Subsubsection +UUID +\end_layout + +\begin_layout Section +Design choices +\end_layout + +\begin_layout Section +Understanding OTP +\end_layout + +\begin_layout Section +Usability +\end_layout + +\begin_layout Chapter +Results and discussion +\end_layout + +\begin_layout Section +Software development methodology +\end_layout + +\begin_layout Section +Statistics +\end_layout + +\begin_layout Chapter +Conclusion +\end_layout + +\begin_layout Chapter +References +\end_layout + +\begin_layout Chapter +Appendix +\end_layout + +\begin_layout Standard +Text goes here... +\end_layout + +\begin_layout Section +Objectives +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +Figures go here... +\end_layout + +\begin_layout Chapter +Methodology +\end_layout + +\begin_layout Section +Overview +\end_layout + +\begin_layout Standard +Text goes here... +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +Figures go here... +\end_layout + +\end_body +\end_document diff --git a/LO_CHGU_cen2rCMYK.eps b/LO_CHGU_cen2rCMYK.eps new file mode 100644 index 0000000..8bfd0c8 Binary files /dev/null and b/LO_CHGU_cen2rCMYK.eps differ diff --git a/Thesis_Template.lyx b/Thesis_Template.lyx new file mode 100644 index 0000000..19b8d5f --- /dev/null +++ b/Thesis_Template.lyx @@ -0,0 +1,352 @@ +#LyX 1.6.3 created this file. For more info see http://www.lyx.org/ +\lyxformat 345 +\begin_document +\begin_header +\textclass report +\begin_preamble +\usepackage{indentfirst} +\usepackage{tocloft} +\usepackage{calc} +\date{} +\usepackage[section] {placeins} +\def\myClearpage{% + \ifvmode + \ifnum \@dbltopnum =\m@ne + \ifdim \pagetotal <\topskip + \hbox{}% + \fi + \fi + \fi +% \newpage + \write\m@ne{}% + \vbox{}% + \penalty -\@Mi +} +\def\myCleardoublepage{\myClearpage\if@twoside \ifodd\c@page\else + \hbox{}\if@twocolumn\hbox{}\fi\fi\fi} +\usepackage{morefloats} +\usepackage{graphicx} +\usepackage{subfig} +\usepackage{tocloft} +\renewcommand{\cftchapfont}{\bfseries} +\renewcommand{\cftchappagefont}{\bfseries} +\renewcommand{\cftchappresnum}{Chapter } +\renewcommand{\cftchapnumwidth}{6em} +\oddsidemargin 0.5in +\textwidth 6in +\topmargin 0.0in +\textheight 8.0in +\setlength\topskip{24pt} +\footskip 0.75in +\end_preamble +\use_default_options true +\language english +\inputencoding auto +\font_roman lmodern +\font_sans default +\font_typewriter default +\font_default_family rmdefault +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\paperfontsize default +\spacing double +\use_hyperref false +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\cite_engine natbib_authoryear +\use_bibtopic false +\paperorientation portrait +\paperwidth 11in +\paperheight 8.5in +\leftmargin 1.25in +\topmargin 1in +\rightmargin 1in +\bottommargin 1.7in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\author "" +\author "" +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{roman} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{5} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +contentsname{Table of Contents} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cfttoctitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftaftertoctitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftpartdotsep{6.6} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftchapdotsep{6.6} +\end_layout + +\end_inset + + +\begin_inset CommandInset toc +LatexCommand tableofcontents + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Tables} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftlottitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterlottitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cfttabpresnum}{Table~} +\backslash +setlength +\backslash +cfttabnumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList table + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Figures} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftloftitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterloftitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cftfigpresnum}{Figure~} +\backslash +setlength +\backslash +cftfignumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList figure + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{arabic} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{1} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Introduction +\end_layout + +\begin_layout Standard +Text goes here... +\end_layout + +\begin_layout Section +Objectives +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +Figures go here... +\end_layout + +\begin_layout Chapter +Methodology +\end_layout + +\begin_layout Section +Overview +\end_layout + +\begin_layout Standard +Text goes here... +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +Figures go here... +\end_layout + +\end_body +\end_document diff --git a/UTHM-Thesis-Classic-authoryear-V-05.lyx b/UTHM-Thesis-Classic-authoryear-V-05.lyx new file mode 100644 index 0000000..a251c39 --- /dev/null +++ b/UTHM-Thesis-Classic-authoryear-V-05.lyx @@ -0,0 +1,2262 @@ +#LyX 1.6.7 created this file. For more info see http://www.lyx.org/ +\lyxformat 345 +\begin_document +\begin_header +\textclass scrbook +\begin_preamble +%====================== +% Written by Waluyo Adi Siswanto +% You are allowed to modify this +% in order to meet your requirements +%====================== +% this command prints empty date in title page +\date{} + +% If you want your text paragraph is left justfied +% you need to uncomment (delete %) the following command +%\raggedright + +% this command set the paragraph indentation +% if you want to modify change the value 1.5cm to your preference +\setlength{\parindent}{1.5cm} + +%This command will change the default Bibliography to References +\AtBeginDocument{ + \renewcommand{\bibname}{References} + \renewcommand{\nomname}{List of Symbols} +} + +%The following comands center the heading of chapters and +% chapter entries, the default is on the left +\addtokomafont{chapterentry}{\centering} +\addtokomafont{chapter}{\centering} + +% The following commands set the page numbers on the top right +% except in the beginning of chapters +% using fancyhdr package (page layout>heading style->fancy) +\lhead{} +\chead{} +\rhead{\thepage} +\lfoot{} +\cfoot{} +\rfoot{} +\renewcommand{\headrulewidth}{0pt} + +% The following commands set the vertical space before and after +% every chapter entry +\renewcommand*{\chapterheadendvskip}{\vspace{2cm}} +\renewcommand*{\chapterheadstartvskip}{\vspace{2.5cm}} + +% The following commands set the TOC, LOT, LOF and LOA +% this employs tocloft package +\usepackage{tocloft} +\cftpagenumbersoff{part} +\renewcommand{\cftdot}{} +\renewcommand{\cfttoctitlefont}{\hfill\Large\bfseries\sffamily} +\renewcommand{\cftaftertoctitle}{\hfill} +\renewcommand{\cftaftertoctitleskip}{2.5cm} +\renewcommand{\cftbeforetoctitleskip}{2.5cm} + +\renewcommand{\cftloftitlefont}{\hfill\Large\bfseries\sffamily} +\renewcommand{\cftafterloftitle}{\hfill \hfill +\\[3\baselineskip]{Figure No \hfill Title \hfill Page \linebreak} \vskip-50pt} +\renewcommand{\cftbeforeloftitleskip}{2.5cm} + +\renewcommand{\cftlottitlefont}{\hfill\Large\bfseries\sffamily} +\renewcommand{\cftafterlottitle}{\hfill \hfill +\\[3\baselineskip]{Table No \hfill Title \hfill Page \linebreak } +\vskip-50pt} +\renewcommand{\cftbeforelottitleskip}{2.5cm} + +\newlistof{appendices}{loa}{List of Appendices} +\renewcommand{\cftloatitlefont}{\hfill\Large\bfseries\sffamily} +\renewcommand{\cftafterloatitle}{\hfill \hfill +\\[3\baselineskip]{Appendix \hfill Title \hfill Page \linebreak} +\vskip-60pt} +\renewcommand{\cftbeforeloatitleskip}{2.5cm} + + +\renewcommand{\cftchappresnum}{Chapter } +\renewcommand{\cftchapaftersnum}{} +\renewcommand{\cftchapaftersnumb}{\qquad\quad\,\,} +\renewcommand{\cftsecpresnum}{\qquad\quad\,\,\,\, } +\renewcommand{\cftsubsecpresnum}{\quad\,\, } +\renewcommand{\cftsecaftersnum}{} +\renewcommand{\cftsecaftersnumb}{\qquad\qquad\,} +\renewcommand{\cftsubsecaftersnumb}{\quad} + +\usepackage{minitoc} + +% Redefining automatic label of Figure, Table and Eq. +\usepackage{prettyref} +\newrefformat{tab}{Table\,\ref{#1}} +\newrefformat{fig}{Figure\,\ref{#1}} +\newrefformat{eq}{Eq.\,\textup{(\ref{#1})}} + +%To remove extra vertical space in List of Symbols [added in V-05] +%\setlength{\nomitemsep}{-2\parsep} % another alternative +\setlength{\nomitemsep}{-\parsep} + +% from koma-script scrbook.cls, then modified [added in V-05] +% to shift addchap in TOC ro the right: \qquad\qquad\,\, +\renewcommand\addchap{ + \if@openright\cleardoublepage\else\clearpage + \fi + \thispagestyle{plain} + \global\@topnum\z@ + \@afterindentfalse + \secdef\@addchap\@saddchap} + \def\@addchap[#1]#2{ + \typeout{#2} + \addcontentsline{toc}{chapter}{\qquad\qquad\,\, #1} + \if@twoside\@mkboth{#1}{}\else\@mkboth{}{#1} + \fi + \addtocontents{lof}{\protect\addvspace{10\p@}} + \addtocontents{lot}{\protect\addvspace{10\p@}} + \if@twocolumn + \@topnewpage[\@makeschapterhead{#2}] + \else + \@makeschapterhead{#2} + \@afterheading + \fi + } + \def\@saddchap#1{\@mkboth{}{} + \if@twocolumn + \@topnewpage[\@makeschapterhead{#1}] + \else + \@makeschapterhead{#1} + \@afterheading + \fi +} + +\makeatletter + \renewcommand*\l@figure{\@dottedtocline{0}{1.5em}{4.3em}} + \renewcommand*\l@table{\@dottedtocline{0}{1.5em}{4.3em}} + \renewcommand{\@dotsep}{10000} +\makeatother +\end_preamble +\options liststotoc,chapterprefix,tablecaptionabove,bibtotoc,parskip=full,headings=small,numbers=noenddot +\use_default_options true +\language english +\inputencoding auto +\font_roman lmodern +\font_sans lmss +\font_typewriter lmtt +\font_default_family rmdefault +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\paperfontsize 12 +\spacing onehalf +\use_hyperref true +\pdf_title "Write the title of the thesis here" +\pdf_author "Write the student's name here" +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen false +\pdf_bookmarksopenlevel 1 +\pdf_breaklinks false +\pdf_pdfborder true +\pdf_colorlinks true +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "linkcolor=blue, citecolor=blue, urlcolor=blue, pdfstartview=XYZ, plainpages=false, pdfpagelabels " +\papersize a4paper +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\cite_engine natbib_authoryear +\use_bibtopic false +\paperorientation portrait +\leftmargin 4cm +\topmargin 2.5cm +\rightmargin 2.5cm +\bottommargin 2.5cm +\headsep 0.5cm +\footskip 1cm +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle fancy +\tracking_changes false +\output_changes false +\author "" +\author "" +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +frontmatter +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Note Note +status open + +\begin_layout Plain Layout +This is UTHM thesis (Classic) template version 0.5 (release date) +\end_layout + +\end_inset + + +\begin_inset VSpace 2.5cm +\end_inset + + +\end_layout + +\begin_layout Title + +\family roman +\series medium +\size larger +The Thesis Title Line 1 +\family default +\series default +\size default + +\begin_inset Newline newline +\end_inset + + +\family roman +\series medium +\size larger +Thesis Title Line 2 +\family default +\series default +\size default + +\begin_inset VSpace 1.8cm +\end_inset + + +\end_layout + +\begin_layout Author +The Author +\begin_inset VSpace 2.5cm +\end_inset + + +\begin_inset Newline newline +\end_inset + + +\size normal +A thesis submitted in +\begin_inset Newline newline +\end_inset + +fulfillment of the requirement for the award of the +\begin_inset Newline newline +\end_inset + +Degree of Doctor of Philosophy / Bachelor of.../ Master of ... +\begin_inset VSpace 3.1cm +\end_inset + + +\begin_inset Newline newline +\end_inset + +FACULTY OF WHATEVER +\size default + +\begin_inset Newline newline +\end_inset + + +\size normal +UNIVERSITY WHATEVER +\begin_inset VSpace 3.1cm +\end_inset + + +\end_layout + +\begin_layout Publishers + +\size normal +SEPTEMBER 2010 +\end_layout + +\begin_layout Standard +\align center +\begin_inset Formula $ $ +\end_inset + + +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +thispagestyle{plain} +\end_layout + +\end_inset + + +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{ +\backslash +qquad +\backslash +qquad +\backslash +, +\backslash +, Declaration} +\end_layout + +\end_inset + + +\begin_inset VSpace 2cm +\end_inset + + +\end_layout + +\begin_layout Standard +\align center +I hereby declare that this thesis entitled “Write The Thesis Title Here” + is the result of my own research except as cited in the references. + This thesis has not been accepted for any degree and is not concurrently + submitted in candidature of any other degree. + +\begin_inset VSpace 2cm +\end_inset + + +\end_layout + +\begin_layout Standard +Signature +\begin_inset Formula $\hphantom{xte1}$ +\end_inset + +: +\end_layout + +\begin_layout Standard +Student +\begin_inset Formula $\hphantom{Date1}$ +\end_inset + +: Write the name of the student here +\end_layout + +\begin_layout Standard +Date +\begin_inset Formula $\hphantom{Student1}$ +\end_inset + +: Write the date here +\begin_inset VSpace 4cm +\end_inset + + +\end_layout + +\begin_layout Standard +Supervisor +\begin_inset Formula $\hphantom{Co}\,$ +\end_inset + +: Write supervisor's name here +\begin_inset VSpace 2cm +\end_inset + + +\end_layout + +\begin_layout Standard +Co-Supervisor: Write co-supervisor's name here +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\align center +\begin_inset Formula $ $ +\end_inset + + +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +thispagestyle{plain} +\end_layout + +\end_inset + + +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{ +\backslash +qquad +\backslash +qquad +\backslash +, +\backslash +, Dedication} +\end_layout + +\end_inset + + +\begin_inset VSpace 2cm +\end_inset + + +\end_layout + +\begin_layout Standard +\align center +For my beloved mother and father +\end_layout + +\begin_layout Addchap +Acknowledgment +\end_layout + +\begin_layout Standard +Here is the acknowledgment must be written. +\end_layout + +\begin_layout Standard +Praise to the Almighty... + +\end_layout + +\begin_layout Standard +Thanks to supervisor(s)... + +\end_layout + +\begin_layout Standard +Thanks to sponsor... + +\end_layout + +\begin_layout Standard +Appreciate family... + +\end_layout + +\begin_layout Standard +Thanks to friends... + +\begin_inset VSpace medskip +\end_inset + + +\end_layout + +\begin_layout Standard +\align right +Author, Place +\end_layout + +\begin_layout Addchap +Abstract +\end_layout + +\begin_layout Standard +The abstract should be brief, written in one paragraph and not exceed 300 + words. + This only demonstrates the paragraph in the abstract. + +\end_layout + +\begin_layout Addchap +Abstrak +\end_layout + +\begin_layout Standard +Here is the abstract in Malay. + Please write the abstract in Malay. + Please write the abstract in Malay. + Please write the abstract in Malay. +\end_layout + +\begin_layout Standard +\begin_inset Newpage clearpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset toc +LatexCommand tableofcontents + +\end_inset + + +\begin_inset Newpage clearpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList figure + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{ +\backslash +qquad +\backslash +qquad +\backslash +, +\backslash +, List of Figures} +\end_layout + +\end_inset + + +\begin_inset Newpage clearpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList table + +\end_inset + + +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{ +\backslash +qquad +\backslash +qquad +\backslash +, +\backslash +, List of Tables} +\end_layout + +\end_inset + + +\begin_inset Newpage clearpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftchappresnum}{ +\backslash +quad +\backslash +, +\backslash +, +\backslash +,} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftchapaftersnum}{} +\backslash +renewcommand{ +\backslash +cftchapaftersnumb}{ +\backslash +qquad +\backslash +qquad} +\end_layout + +\begin_layout Plain Layout + + +\backslash +listofappendices +\end_layout + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{ +\backslash +qquad +\backslash +qquad +\backslash +, +\backslash +, List of Appendices} +\end_layout + +\end_inset + + +\begin_inset Newpage clearpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset nomencl_print +LatexCommand printnomenclature + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{ +\backslash +qquad +\backslash +qquad +\backslash +, +\backslash +, List of Symbols} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +mainmatter +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Introduction +\begin_inset CommandInset label +LatexCommand label +name "cha:Introduction" + +\end_inset + + +\end_layout + +\begin_layout Standard +The specific use of the word “thesis” in this guide refers to the academic + writings submitted in fulfillment for the award of the doctoral degree + or the masters by research degree. + The word “thesis” is also used in general to refer to the master’s project + report and research dissertation, which are the documents submitted in + partial fulfillment for the award of the degree of master by coursework + or by coursework and research as well as the undergraduate project reports. + +\end_layout + +\begin_layout Standard +The Numisheet Conferences is conducted once every three years in location + between North America, Europe and Asia. + The conference attracts international participation from the metal forming + industry and university professors interested in sheet metal forming technology +, with a strong emphasis on forming simulation. + The Numisheet Conference Proceedings include the latest developments in + metal forming technology, which is a rapidly growing and challenging opportunit +y for application of science to industry. +\end_layout + +\begin_layout Section +Background of Study +\end_layout + +\begin_layout Standard +One of the hallmarks of the conference is the Numisheet Benchmark Study, + which is a set of three blind tests prepared one year prior to the conference. + Numisheet 2008 Benchmark Problem II is provided by Daimler AG. + For this benchmark, the well known S-Rail geometry as shown in +\begin_inset CommandInset ref +LatexCommand prettyref +reference "fig:R-rail-geometry" + +\end_inset + + was chosen. + In this benchmark, study the influence of different drawbeads geometries; + smooth bead and locking bead on the springback behavior for steel is to + be examined using numerical simulation. + Here is the example of citation. + +\begin_inset CommandInset citation +LatexCommand citep +key "Rodriguez2009,Poirson2007" + +\end_inset + + +\end_layout + +\begin_layout Standard +Sheet metal forming is one of the most widely used manufacturing processes + for the fabrication of a wide range of products in many industries. + The reason behind sheet metal forming gaining a lot attention in modern + technology is due to the ease with which metal may be formed into useful + shapes by plastic deformation processes. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +placement h +wide false +sideways false +status open + +\begin_layout Plain Layout +\align center +\begin_inset Graphics + filename sample.png + width 80col% + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption + +\begin_layout Plain Layout +S-rail geometry +\begin_inset CommandInset label +LatexCommand label +name "fig:R-rail-geometry" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Literature Review +\begin_inset CommandInset label +LatexCommand label +name "cha:Literature-Review" + +\end_inset + + +\end_layout + +\begin_layout Standard +The sheet metal forming process, in theory, can be viewed as relatively + straight forward operation where a sheet of material is plastically deformed + into desired shape. + +\begin_inset CommandInset citation +LatexCommand cite +key "Schell2002" + +\end_inset + + has investigated musical melodies. +\end_layout + +\begin_layout Section +Practical Usage +\end_layout + +\begin_layout Standard +In practice, however, variations in blank dimensions, material properties + and environmental conditions make the predictability and reproducibility + of a sheet metal forming process difficult. + Apart from this, springback properties of sheet metal make it extremely + tedious to design appropriate tooling for a given process. + +\begin_inset CommandInset citation +LatexCommand cite +key "Poirson2007" + +\end_inset + + concluded the analysis as shown in +\begin_inset CommandInset ref +LatexCommand prettyref +reference "tab:Data-structure" + +\end_inset + +. +\end_layout + +\begin_layout Standard +The explanation of the Hubolt formula +\begin_inset Formula \begin{equation} +f(t)=\intop_{s0}^{s1}d\left(x\right)\label{eq:hubolt}\end{equation} + +\end_inset + +where +\begin_inset Formula $x$ +\end_inset + + is the displacement. +\end_layout + +\begin_layout Standard +\begin_inset CommandInset ref +LatexCommand prettyref +reference "eq:hubolt" + +\end_inset + + can be derived from another equation as written by +\begin_inset Formula \begin{equation} +\varepsilon_{x}=\dfrac{\partial u}{\partial x}\label{eq:fdfdfd}\end{equation} + +\end_inset + + +\end_layout + +\begin_layout Standard +This is another example +\begin_inset Formula \begin{equation} +\left[N\right]=\left[\begin{array}{ccc} +N_{1} & N_{2} & N_{3}\end{array}\right]^{T}\label{eq:ddssdd}\end{equation} + +\end_inset + +as mention in +\begin_inset CommandInset ref +LatexCommand prettyref +reference "cha:Introduction" + +\end_inset + +. +\end_layout + +\begin_layout Section +dded +\end_layout + +\begin_layout Subsection +dddd +\end_layout + +\begin_layout Standard +\begin_inset Float table +placement h +wide false +sideways false +status open + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption + +\begin_layout Plain Layout +Data structure +\begin_inset CommandInset label +LatexCommand label +name "tab:Data-structure" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\align center +\begin_inset Tabular + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +node +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +x +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +y +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +z +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +DVI +\begin_inset CommandInset nomenclature +LatexCommand nomenclature +symbol "DVI" +description "Device Independent" + +\end_inset + +, +\begin_inset Formula $\sigma$ +\end_inset + + +\begin_inset CommandInset nomenclature +LatexCommand nomenclature +symbol "$\\sigma$" +description "Nominal Stress" + +\end_inset + + +\end_layout + +\begin_layout Chapter +Methodology +\end_layout + +\begin_layout Standard +dsds +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Section +Title +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Section +Another Title +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{equation} +ff\end{equation} + +\end_inset + + +\end_layout + +\begin_layout Chapter +Title of Chapter 4 +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Section +Title +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Section +Another Title +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Chapter +Title of Chapter 5 +\end_layout + +\begin_layout Standard +bla bla bla bla bla +\end_layout + +\begin_layout Section +Title +\end_layout + +\begin_layout Standard +According to +\begin_inset CommandInset citation +LatexCommand citet +key "Abdullah1989" + +\end_inset + + also +\begin_inset CommandInset citation +LatexCommand citet +key "Creme2003" + +\end_inset + +, bla bla bla. +\end_layout + +\begin_layout Section +Another Title +\end_layout + +\begin_layout Standard +bla bla bla +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +setlength{ +\backslash +parskip}{0.3cm} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset bibtex +LatexCommand bibtex +bibfiles "thesis" +options "UTHM-ref-style-V-04" + +\end_inset + + +\end_layout + +\begin_layout Part* +APPENDICES +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +thispagestyle{empty} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +renewcommand*{ +\backslash +chapterheadendvskip}{ +\backslash +vspace{2cm}} +\backslash +renewcommand*{ +\backslash +chapterheadstartvskip}{ +\backslash +vspace{1cm}} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\start_of_appendix +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +makeatletter +\end_layout + +\begin_layout Plain Layout + + +\backslash +def +\backslash +@chapter[#1]#2{ +\backslash +ifnum +\backslash +c@secnumdepth > +\backslash +m@ne +\end_layout + +\begin_layout Plain Layout + + +\backslash +if@mainmatter +\end_layout + +\begin_layout Plain Layout + + +\backslash +refstepcounter{chapter}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +typeout{ +\backslash +@chapapp +\backslash +space +\backslash +thechapter.}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +addcontentsline{loa}{chapter}% +\end_layout + +\begin_layout Plain Layout + +{ +\backslash +protect +\backslash +numberline{ +\backslash +thechapter}#1}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +else +\end_layout + +\begin_layout Plain Layout + + +\backslash +addcontentsline{loa}{chapter}{#1}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +fi +\end_layout + +\begin_layout Plain Layout + + +\backslash +else +\end_layout + +\begin_layout Plain Layout + + +\backslash +addcontentsline{loa}{chapter}{#1}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +fi +\end_layout + +\begin_layout Plain Layout + + +\backslash +chaptermark{#1}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +addtocontents{lot}{ +\backslash +protect +\backslash +addvspace{10 +\backslash +p@}}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +addtocontents{lof}{ +\backslash +protect +\backslash +addvspace{10 +\backslash +p@}}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +if@twocolumn +\end_layout + +\begin_layout Plain Layout + + +\backslash +@topnewpage[ +\backslash +@makechapterhead{#2}]% +\end_layout + +\begin_layout Plain Layout + + +\backslash +else +\end_layout + +\begin_layout Plain Layout + + +\backslash +@makechapterhead{#2}% +\end_layout + +\begin_layout Plain Layout + + +\backslash +@afterheading +\end_layout + +\begin_layout Plain Layout + + +\backslash +fi} +\end_layout + +\begin_layout Plain Layout + + +\backslash +makeatother +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addtocontents{toc}{ +\backslash +protect +\backslash +setcounter{tocdepth}{0}} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Write Title Here +\end_layout + +\begin_layout Standard +You can see here the equation number is consistent with Appendix numbering + system +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{equation} +\left[k^{e}\right]=\dfrac{AE}{L}\left[\begin{array}{cc} +1 & -1\\ +-1 & 1\end{array}\right]\end{equation} + +\end_inset + + +\end_layout + +\begin_layout Section +Section title 1 here +\end_layout + +\begin_layout Standard +Text text text of first paragraph +\end_layout + +\begin_layout Standard +Now second paragraph. + +\begin_inset CommandInset citation +LatexCommand cite +key "Bongers1998" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{equation} +f\left(x\right)=3x^{2}+\intop_{0}^{20}45x^{2}\textrm{d}x\end{equation} + +\end_inset + + +\end_layout + +\begin_layout Section +Section title 2 here +\end_layout + +\begin_layout Standard +Text text text of first paragraph +\end_layout + +\begin_layout Standard +Now second paragraph +\end_layout + +\begin_layout Chapter +Source Code for Initial Model +\end_layout + +\begin_layout Standard +The following codes are written in LaTe +\begin_inset ERT +status open + +\begin_layout Plain Layout + +\end_layout + +\end_inset + +X preamble +\end_layout + +\begin_layout Standard +\begin_inset listings +lstparams "basicstyle={\small\ttfamily},breaklines=true,numbers=left" +inline false +status open + +\begin_layout Plain Layout + +%====================== +\end_layout + +\begin_layout Plain Layout + +% Written by Waluyo Adi Siswanto +\end_layout + +\begin_layout Plain Layout + +% You are allowed to modify this +\end_layout + +\begin_layout Plain Layout + +% in order to meet your requirements +\end_layout + +\begin_layout Plain Layout + +%====================== +\end_layout + +\begin_layout Plain Layout + +% this command prints empty date in title page +\end_layout + +\begin_layout Plain Layout + + +\backslash +date{} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +% this command set the paragraph indentation +\end_layout + +\begin_layout Plain Layout + +% if you want to modify change the value 1.5cm to your preference +\end_layout + +\begin_layout Plain Layout + + +\backslash +setlength{ +\backslash +parindent}{1.5cm} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +%This command will change the default Bibliography to References +\end_layout + +\begin_layout Plain Layout + + +\backslash +AtBeginDocument{ +\backslash +renewcommand{ +\backslash +bibname}{References}} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +%The following comands center the heading of chapters and +\end_layout + +\begin_layout Plain Layout + +% chapter entries, the default is on the left +\end_layout + +\begin_layout Plain Layout + + +\backslash +addtokomafont{chapterentry}{ +\backslash +centering} +\end_layout + +\begin_layout Plain Layout + + +\backslash +addtokomafont{chapter}{ +\backslash +centering} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +% The following commands set the page numbers on the top right +\end_layout + +\begin_layout Plain Layout + +% except in the beginning of chapters +\end_layout + +\begin_layout Plain Layout + +% using fancyhdr package (page layout>heading style->fancy) +\end_layout + +\begin_layout Plain Layout + + +\backslash +lhead{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +chead{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +rhead{ +\backslash +thepage} +\end_layout + +\begin_layout Plain Layout + + +\backslash +lfoot{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +cfoot{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +rfoot{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +headrulewidth}{0pt} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +% The following commands set the vertical space before and after +\end_layout + +\begin_layout Plain Layout + +% every chapter entry +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand*{ +\backslash +chapterheadendvskip}{ +\backslash +vspace{2cm}} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand*{ +\backslash +chapterheadstartvskip}{ +\backslash +vspace{2.5cm}} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +% The following commands set the TOC, LOT and LOF +\end_layout + +\begin_layout Plain Layout + +% this employs tocloft package +\end_layout + +\begin_layout Plain Layout + + +\backslash +usepackage{tocloft} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftdot}{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cfttoctitlefont}{ +\backslash +hfill +\backslash +Large +\backslash +bfseries +\backslash +sffamily} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftaftertoctitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftaftertoctitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftbeforetoctitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftloftitlefont}{ +\backslash +hfill +\backslash +Large +\backslash +bfseries +\backslash +sffamily} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterloftitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterloftitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftbeforeloftitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftlottitlefont}{ +\backslash +hfill +\backslash +Large +\backslash +bfseries +\backslash +sffamily} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterlottitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterlottitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftbeforelottitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +usepackage{tocloft} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftdot}{} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cfttoctitlefont}{ +\backslash +hfill +\backslash +Large +\backslash +bfseries +\backslash +sffamily} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftaftertoctitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftaftertoctitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftbeforetoctitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftloftitlefont}{ +\backslash +hfill +\backslash +Large +\backslash +bfseries +\backslash +sffamily} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterloftitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterloftitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftbeforeloftitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftlottitlefont}{ +\backslash +hfill +\backslash +Large +\backslash +bfseries +\backslash +sffamily} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterlottitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftafterlottitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftbeforelottitleskip}{2.5cm} +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + +\backslash +usepackage{minitoc} +\end_layout + +\begin_layout Plain Layout + +% Redefining automatic label of +\end_layout + +\begin_layout Plain Layout + +% Figure, Table and Eq. + +\end_layout + +\begin_layout Plain Layout + + +\backslash +usepackage{prettyref} +\end_layout + +\begin_layout Plain Layout + + +\backslash +newrefformat{tab}{Table +\backslash +, +\backslash +ref{#1}} +\end_layout + +\begin_layout Plain Layout + + +\backslash +newrefformat{fig}{Figure +\backslash +, +\backslash +ref{#1}} +\end_layout + +\begin_layout Plain Layout + + +\backslash +newrefformat{eq}{Eq. +\backslash +, +\backslash +textup{( +\backslash +ref{#1})}} +\end_layout + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/gu_logo.png b/gu_logo.png new file mode 100644 index 0000000..1f83e77 Binary files /dev/null and b/gu_logo.png differ diff --git a/report.lyx b/report.lyx new file mode 100644 index 0000000..d216beb --- /dev/null +++ b/report.lyx @@ -0,0 +1,984 @@ +#LyX 1.6.7 created this file. For more info see http://www.lyx.org/ +\lyxformat 345 +\begin_document +\begin_header +\textclass report +\begin_preamble +\usepackage{indentfirst} +\usepackage{tocloft} +\usepackage{calc} +\date{} +\usepackage[section] {placeins} +\def\myClearpage{% + \ifvmode + \ifnum \@dbltopnum =\m@ne + \ifdim \pagetotal <\topskip + \hbox{}% + \fi + \fi + \fi +% \newpage + \write\m@ne{}% + \vbox{}% + \penalty -\@Mi +} +\def\myCleardoublepage{\myClearpage\if@twoside \ifodd\c@page\else + \hbox{}\if@twocolumn\hbox{}\fi\fi\fi} +\usepackage{morefloats} +\usepackage{graphicx} +\usepackage{subfig} +\usepackage{tocloft} +\renewcommand{\cftchapfont}{\bfseries} +\renewcommand{\cftchappagefont}{\bfseries} +\renewcommand{\cftchappresnum}{Chapter } +\renewcommand{\cftchapnumwidth}{6em} +\oddsidemargin 0.5in +\textwidth 6in +\topmargin 0.0in +\textheight 8.0in +\setlength\topskip{24pt} +\footskip 0.75in +\end_preamble +\use_default_options true +\language english +\inputencoding auto +\font_roman lmodern +\font_sans default +\font_typewriter default +\font_default_family rmdefault +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\paperfontsize default +\spacing double +\use_hyperref false +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\cite_engine natbib_authoryear +\use_bibtopic false +\paperorientation portrait +\paperwidth 11in +\paperheight 8.5in +\leftmargin 1.25in +\topmargin 1in +\rightmargin 1in +\bottommargin 1.7in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\author "" +\author "" +\end_header + +\begin_body + +\begin_layout Title +Generic Game Server +\end_layout + +\begin_layout Author +Jonatan Pålsson +\begin_inset Newline newline +\end_inset + +Niklas Landin +\begin_inset Newline newline +\end_inset + +Richard Pannek +\begin_inset Newline newline +\end_inset + +Matias Petterson +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{roman} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{5} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +contentsname{Table of Contents} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cfttoctitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftaftertoctitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftpartdotsep{6.6} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftchapdotsep{6.6} +\end_layout + +\end_inset + + +\begin_inset CommandInset toc +LatexCommand tableofcontents + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Tables} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftlottitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterlottitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cfttabpresnum}{Table~} +\backslash +setlength +\backslash +cfttabnumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList table + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Figures} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftloftitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterloftitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cftfigpresnum}{Figure~} +\backslash +setlength +\backslash +cftfignumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList figure + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{arabic} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{1} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Introduction +\end_layout + +\begin_layout Section +Background +\end_layout + +\begin_layout Section +Purpose +\end_layout + +\begin_layout Section +Challenges +\end_layout + +\begin_layout Standard +Challenges lies mainly in providing a reliable, high-performing server and + at the same time make it easy to use for game developers. + +\end_layout + +\begin_layout Subsection +Basis +\end_layout + +\begin_layout Section +Delimitations +\end_layout + +\begin_layout Subsection +Types of games +\end_layout + +\begin_layout Standard +In theory no limitations, but in reality it will be limitations. + Many factors are involved here. + Implementation of protocol, storage possibilities, server capacity, language + support. + In real time games a low latency is very important not a high bandwidth + because the games already send very little data, ~ 80 bytes. + Lag of below 250 ms is good, lag up to 500 ms payable and beyond that the + lag is noticeable. +\end_layout + +\begin_layout Section +Method +\end_layout + +\begin_layout Subsection +Development process +\end_layout + +\begin_layout Standard +May be Extreme Programming(XP), need to check this out further. + Maybe adapt so we can say that we use a standardized software development + method. +\end_layout + +\begin_layout Subsubsection +Demand specification +\end_layout + +\begin_layout Subsection +Design +\end_layout + +\begin_layout Subsection +Testing and evaluation +\end_layout + +\begin_layout Standard +Can we use quickcheck? +\end_layout + +\begin_layout Chapter +Theory +\end_layout + +\begin_layout Subsection +Performance +\end_layout + +\begin_layout Standard +How many players can we have on a server? Performance differences between + games? e.g can one game have thousands players on a server and another only + have hundreds? Questions to be discussed here. + +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Create a game with several thousand players, see how our server scales, + how can we improve the performance? Sharding isn’t very nice.. + alternatives? Improve the speed of sharding? +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +Choice of network protocol +\end_layout + +\begin_layout Standard +There are three main ways in which computer communication over the Internet + usually takes place; TCP, UDP and HTTP. + The first two are transport layer protocols, which are commonly used to + transport application layer protocols, such as HTTP. + TCP and UDP can not be used on their own, without an application layer + protocol on top. + Application layer protocols such as HTTP on the other hand needs a transport + layer protocol in order to work. + +\end_layout + +\begin_layout Subsubsection +HTTP +\end_layout + +\begin_layout Standard +Since HTTP is so widely used on the Internet today in web servers, it is + available on most Internet connected devices. + This means that if HTTP is used in GGS, firewalls will not pose problems, + which is a great benefit. + However, due to the intended usage of HTTP in web servers, the protocol + was designed to be stateless and client-initiated. + In order to maintain a state during a game session using HTTP, some sort + of token would have to be passed between client and server at all times, + much like how a web server works. + These facts combined makes HTTP unsuitable for our purposes, since GGS + requires a state to be maintained throughout a session, and also needs + to push data from the server to clients without the clients requesting + data. + It should also be mentioned that HTTP uses the TCP protocol for transport, + and what is said about TCP also applies to HTTP. + +\end_layout + +\begin_layout Subsubsection +UDP +\end_layout + +\begin_layout Standard +Many online games use UDP as the carrier for their application layer protocol. + UDP moves data across a network very quickly, however it does not ensure + that the data transferred arrives in consistent manner. + Data sent via UDP may be repeated, lost or out of order. + To ensure the data transferred is in good shape, some sort of error checking + mechanisms must be implemented. + UDP is a good choice for applications where it is more important that data + arrives in a timely manner than that all data arrives undamaged, it is + thus very suitable for media streaming, for example. + In GGS reliability of transfer was chosen before the speed of the transfer, + ruling out UDP as the transport later protocol. + +\end_layout + +\begin_layout Subsubsection +TCP +\end_layout + +\begin_layout Standard +For reliable transfers, TCP is often used on the Internet. + Built in to the protocol are the error checking and correction mechanisms + missing in UDP. + This ensures the consistency of data, but also makes the transfer slower + than if UDP had been used. + In GGS, data consistency is more important than transfer speeds, and thus + TCP is a better alternative than UDP. +\end_layout + +\begin_layout Subsection +Encryption +\end_layout + +\begin_layout Subsubsection +Performance penalties +\end_layout + +\begin_layout Subsection +Availability +\end_layout + +\begin_layout Standard +One important factor of a server is the availability, a server that you + can not connect to is a bad server. + Erlang has several features to increase the availability, for example hot + code replacement. + It is also critical to have a good design, we want to separate each part + of the server and thus avoiding that the whole server will crash. + +\end_layout + +\begin_layout Standard +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Players are unsatisfied with the service of WoW Telecoms have the same problem + of having to migrate users from one node to another, this is called handover +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +Scalability +\end_layout + +\begin_layout Standard +Because P2P game architectures are a constant goal for cheaters and because + “Cheating is a major concern in network games as it degrades the experience + of the majority of players who are honest” and preventing cheating in P2P + game architectures is very difficult game developers try to use Client + - Server architectures which have a natural problem to scale. + In this paper we want to show some strategies to achieve scalability. +\end_layout + +\begin_layout Subsubsection +UUID +\end_layout + +\begin_layout Subsection +Security +\end_layout + +\begin_layout Standard +We only support languages running in a sandboxed environment. + Each game session is started in its own sandbox. + The sandboxing isolates the games in such a way that they can not interfere + with each other. + If sandboxing was not in place, one game could potentially modify the contents + of a different game. + A similar approach is taken with the persistent storage we provide. + In the storage each game has its own namespace, much like a table in a + relational database. + A game is not allowed to venture outside this namespace, and can because + of this not modify the persistent data of other games. +\end_layout + +\begin_layout Chapter +Overview +\end_layout + +\begin_layout Subsection +Techniques for ensuring reliability +\end_layout + +\begin_layout Standard +One of the main goals of the project is to achieve high reliability. + A highly reliable application is one crashes very, very rarely +\begin_inset Note Note +status open + +\begin_layout Plain Layout +CITATION NEEDED +\end_layout + +\end_inset + +. + There are some tools for creating reliable applications built in to Erlang. + +\end_layout + +\begin_layout Itemize +Links between processes. + When a process spawns a new child process, and the child process later + exits, the parent process is notified of the exit. + +\end_layout + +\begin_layout Itemize +Transparent distribution over a network of processors. + When several nodes participate in a network, it does not matter on which + of these machines a process is run. + Communication between processes does not depend on the node in which each + process is run. + +\end_layout + +\begin_layout Itemize +Hot code replacements. + Two versions of the same module can reside in the memory of Erlang at any + time. + This means that a simple swap between these versions can take place very + quickly, and without stopping the machine. +\end_layout + +\begin_layout Standard +These three features are some of the basic building blocks for more sophisticate +d reliability systems in Erlang. + Many times it is not necessary to use these features directly, but rather + through the design patterns described below. +\end_layout + +\begin_layout Subsubsection +Supervisor structure +\end_layout + +\begin_layout Standard +By linking processes together and notifying parents when children exit, + we can create supervisors. + A supervisor is a common approach in ensuring that an application functions + in the way it was intended. + When a process misbehaves, the supervisor takes some action to restore + the process to a functional state. + +\end_layout + +\begin_layout Standard +There are several approaches to supervisor design in general (when not just + considering how they work in Erlang). + One common approach is to have the supervisor look in to the state of the + process(es) it supervises, and let the supervisor make decisions based + on this state. + The supervisor has a specification of how the process it supervises should + function, and this is how it makes decisions. + +\end_layout + +\begin_layout Standard +In Erlang, we have a simple version of supervisors. + We do not inspect the state of the processes being supervised. + We do have a specification of how the supervised processes should behave, + but on a higher level. + The specification describes things such as how many times in a given time + interval a child process may crash, which processes need restarting when + crashes occur, and so forth. + +\end_layout + +\begin_layout Standard +When the linking of processes in order to monitor exit behaviour is coupled + with the transparent distribution of Erlang, a very powerful supervision + system is created. + For instance, we can restart a failing process on a different, new node, + with minimal impact on the system as a whole. + +\end_layout + +\begin_layout Standard +In GGS, we have separated the system in to two large supervised parts. + We try to restart a crashing child separately, if this fails too many times, + we restart the nearest supervisor of this child. + This ensures separation of the subsystems so that a crash is as isolated + as possible. +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename supervisors.png + scale 40 + +\end_inset + + +\end_layout + +\begin_layout Standard +The graphic above shows our two subsystems, the coordinator subsystem and + the dispatcher subsystem. + Since these two systems perform very different tasks they have been separated. + Each subsystem has one worker process, the coordinator or the dispatcher. + The worker process keeps a state which should not be lost upon a crash. +\end_layout + +\begin_layout Standard +We have chosen to let faulty processes crash very easily when they receive + bad data, or something unexpected happens. + The alternative to crashing would have been to try and fix this faulty + data, or to foresee the unexpected events. + We chose not to do this because it is so simple to monitor and restart + processes, and so difficult to try and mend broken states. + This approach is something widely deployed in the Erlang world, and developers + are often encouraged to “Let it crash”. +\end_layout + +\begin_layout Standard +To prevent any data loss, the good state of the worker processes is stored + in their respective backup processes. + When a worker process (re)starts, it asks the backup process for any previous + state, if there is any that state is loaded in to the worker and it proceeds + where it left off. + If on the other hand no state is available, a special message is delivered + instead, making the worker create a new state, this is what happens when + the workers are first created. +\end_layout + +\begin_layout Subsubsection +Hot code replacement +\end_layout + +\begin_layout Subsection +Implementation +\end_layout + +\begin_layout Subsubsection +User interface +\end_layout + +\begin_layout Chapter +Problems +\end_layout + +\begin_layout Subsection +Erlang JS +\end_layout + +\begin_layout Standard +To be able to run JavaScript on our server we needed to embed a JavaScript + engine within the server. + After a thorough investigation erlang_js became our choice. + erlang_js provides direct communication with a JavaScript VM (Virtual Machine). + This was exactly what we wanted, but we also needed the possibility to + communicate from erlang_js to Erlang. + This functionality was not yet implemented in erlang_js, due to lack of + time. +\end_layout + +\begin_layout Standard +There were two possible solutions to the problem. + We could rewrite some part of erlang_js, or we could switch erlang_js for + some other JavaScript engine. + Searching for other engines we found erlv8 and beam.js which provided the + functionality that we wanted. + As we tested beam.js it occurred random crashes of the whole Erlang environment. + These crashes were related to the use of erlv8 in beam.js and we decided + that the use of erlv8 was not an alternative due to the stability issues. +\end_layout + +\begin_layout Standard +To get the functionality needed we decided to implement this in erlang_js. +\end_layout + +\begin_layout Subsubsection +UUID +\end_layout + +\begin_layout Standard +Erlang identifies processes uniquely throughout the entire Erlang network + using process IDs (PID). + When we wish to refer to erlang processes from outside our erlang system, + for example in a virtual machine for a different language, possibly on + a different machine, these PIDs are no longer useful. + +\end_layout + +\begin_layout Standard +This problem is not new, and a common solution is to use a Universally Unique + Identifier, a UUID. + These identifiers are generated both using randomization and using time. + A reasonably large number of UUIDs can be generated before a collision + should occur. + There are standard tools in many UNIX systems to generate UUIDs, we chose + to use the uuidgen command, which employs an equidistributed combined Tausworth +e generator. +\end_layout + +\begin_layout Section +Design choices +\end_layout + +\begin_layout Standard +When designing concurrent applications, it is useful to picture them as + real world scenarios, and to model each actor# as a real world process. + A real world process is a process which performs some action in the real + world, such as a mailbox receiving a letter, a door being opened, a person + translating a text, a soccer player kicking the ball, just to name a few + examples. + Since we focus on games in this project, it is suitable to model our system + as a place where games take place. + We imagined a chess club. + +\end_layout + +\begin_layout Standard +The clients pictured as green circles can be thought of as the physical + chess players. +\end_layout + +\begin_layout Standard +When a player wants to enter the our particular chess club, he must first + be let in by the doorman, called the Dispatcher in GGS. +\end_layout + +\begin_layout Standard +He then gets a name badge, and thus becomes a Player process in the system. + He is also guided in to the lobby by the Coordinator, which has the role + of the host of the chess club. +\end_layout + +\begin_layout Standard +When players wish to play against each other, they talk to the Coordinator + who pairs them up, and places them at a table. + Once they have sat down at the table, they no longer need the assistance + of the Coordinator, all further communication takes place via the table. + This can be thought of as the actual chess game commencing. + +\end_layout + +\begin_layout Standard +All the moves made in the game are recorded by the table, such that the + table can restore the game in case something would happen, such as the + table tipping over, which would represent the table process crashing. +\end_layout + +\begin_layout Standard +Once a player wishes to leave a game, or the entire facility, he should + contact the Coordinator, who revokes his name badge and the Dispatcher + will let the player out. +\end_layout + +\begin_layout Standard +With the information kept in the tables and the Coordinator combined, we + can rebuild the entire state of the server at a different location. + This can be thought of the chess club catching fire, and the Coordinator + rounding up all the tables, running to a new location and building the + club up in the exact state it was prior to the fire. +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename system_structure.png + scale 40 + +\end_inset + + +\end_layout + +\begin_layout Section +Understanding OTP +\end_layout + +\begin_layout Section +Usability +\end_layout + +\begin_layout Chapter +Results and discussion +\end_layout + +\begin_layout Section +Software development methodology +\end_layout + +\begin_layout Section +Statistics +\end_layout + +\begin_layout Chapter +Conclusion +\end_layout + +\begin_layout Chapter +References +\end_layout + +\begin_layout Chapter +Appendix +\end_layout + +\begin_layout Standard +Text goes here.. +\end_layout + +\begin_layout Bibliography +\begin_inset CommandInset bibitem +LatexCommand bibitem +key "key-1" + +\end_inset + +Savor, T.; Seviora, R.E.; , "Hierarchical supervisors for automatic detection + of software failures," PROCEEDINGS The Eighth International Symposium On + Software Reliability Engineering , vol., no., pp.48-59, 2-5 Nov1997 doi: 10.1109/IS +SRE.1997.630847 URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=630847&i +snumber=13710 +\end_layout + +\begin_layout Bibliography +\begin_inset CommandInset bibitem +LatexCommand bibitem +key "key-6" + +\end_inset + +Vinoski, S.; , "Reliability with Erlang," Internet Computing, IEEE , vol.11, + no.6, pp.79-81, Nov.-Dec. + 2007 doi: 10.1109/MIC.2007.132 URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&ar +number=4376232&isnumber=4376216 +\end_layout + +\begin_layout Bibliography +\begin_inset CommandInset bibitem +LatexCommand bibitem +key "key-5" + +\end_inset + +CESARINI, F., & THOMPSON, S. + (2009). + Erlang programming. + Beijing, O'Reilly. + pp.139 +\end_layout + +\begin_layout Bibliography +\begin_inset CommandInset bibitem +LatexCommand bibitem +key "key-4" + +\end_inset + +"Erlang/OTP Product Information: Technical Description of Erlang." Home of + Erlang/OTP. + Web. + 01 Mar. + 2011. + . +\end_layout + +\begin_layout Bibliography +\begin_inset CommandInset bibitem +LatexCommand bibitem +key "key-3" + +\end_inset + +Joe Armstrong – Armstrong, J. + [2011]. + If Erlang is the answer, then what is the question?. + [1]. + IT University. + Computer Science and Engineering, 15/2/2011 +\end_layout + +\begin_layout Bibliography +\begin_inset CommandInset bibitem +LatexCommand bibitem +key "key-2" + +\end_inset + +Gul Abdulnabi Agha (1985). + ACTORS: A MODEL OF CONCURRENT COMPUTATION IN DISTRIBUTED SYSTEMS. + Ph.D thesis, Artificial Intelligence Laboratory, MIT. +\end_layout + +\end_body +\end_document diff --git a/report.lyx~ b/report.lyx~ new file mode 100644 index 0000000..65806e0 --- /dev/null +++ b/report.lyx~ @@ -0,0 +1,792 @@ +#LyX 1.6.7 created this file. For more info see http://www.lyx.org/ +\lyxformat 345 +\begin_document +\begin_header +\textclass report +\begin_preamble +\usepackage{indentfirst} +\usepackage{tocloft} +\usepackage{calc} +\date{} +\usepackage[section] {placeins} +\def\myClearpage{% + \ifvmode + \ifnum \@dbltopnum =\m@ne + \ifdim \pagetotal <\topskip + \hbox{}% + \fi + \fi + \fi +% \newpage + \write\m@ne{}% + \vbox{}% + \penalty -\@Mi +} +\def\myCleardoublepage{\myClearpage\if@twoside \ifodd\c@page\else + \hbox{}\if@twocolumn\hbox{}\fi\fi\fi} +\usepackage{morefloats} +\usepackage{graphicx} +\usepackage{subfig} +\usepackage{tocloft} +\renewcommand{\cftchapfont}{\bfseries} +\renewcommand{\cftchappagefont}{\bfseries} +\renewcommand{\cftchappresnum}{Chapter } +\renewcommand{\cftchapnumwidth}{6em} +\oddsidemargin 0.5in +\textwidth 6in +\topmargin 0.0in +\textheight 8.0in +\setlength\topskip{24pt} +\footskip 0.75in +\end_preamble +\use_default_options true +\language english +\inputencoding auto +\font_roman lmodern +\font_sans default +\font_typewriter default +\font_default_family rmdefault +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\paperfontsize default +\spacing double +\use_hyperref false +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\cite_engine natbib_authoryear +\use_bibtopic false +\paperorientation portrait +\paperwidth 11in +\paperheight 8.5in +\leftmargin 1.25in +\topmargin 1in +\rightmargin 1in +\bottommargin 1.7in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\author "" +\author "" +\end_header + +\begin_body + +\begin_layout Title +Generic Game Server +\end_layout + +\begin_layout Author +Jonatan Pålsson +\begin_inset Newline newline +\end_inset + +Niklas Landin +\begin_inset Newline newline +\end_inset + +Richard Pannek +\begin_inset Newline newline +\end_inset + +Matias Petterson +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{roman} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{5} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +contentsname{Table of Contents} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cfttoctitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftaftertoctitle}{ +\backslash +hfill} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftpartdotsep{6.6} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand +\backslash +cftchapdotsep{6.6} +\end_layout + +\end_inset + + +\begin_inset CommandInset toc +LatexCommand tableofcontents + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Tables} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftlottitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterlottitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cfttabpresnum}{Table~} +\backslash +setlength +\backslash +cfttabnumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList table + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +addcontentsline{toc}{chapter}{List of Figures} +\end_layout + +\begin_layout Plain Layout + + +\backslash +renewcommand{ +\backslash +cftloftitlefont}{ +\backslash +hfill +\backslash +Large} +\backslash +renewcommand{ +\backslash +cftafterloftitle}{ +\backslash +hfill} +\backslash +renewcommand{ +\backslash +cftfigpresnum}{Figure~} +\backslash +setlength +\backslash +cftfignumwidth{60pt} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset FloatList figure + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +pagenumbering{arabic} +\end_layout + +\begin_layout Plain Layout + + +\backslash +setcounter{page}{1} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Chapter +Introduction +\end_layout + +\begin_layout Section +Background +\end_layout + +\begin_layout Section +Purpose +\end_layout + +\begin_layout Section +Challenges +\end_layout + +\begin_layout Standard +Challenges lies mainly in providing a reliable, high-performing server and + at the same time make it easy to use for game developers. + +\end_layout + +\begin_layout Subsection +Basis +\end_layout + +\begin_layout Section +Delimitations +\end_layout + +\begin_layout Subsection +Types of games +\end_layout + +\begin_layout Standard +In theory no limitations, but in reality it will be limitations. + Many factors are involved here. + Implementation of protocol, storage possibilities, server capacity, language + support. + In real time games a low latency is very important not a high bandwidth + because the games already send very little data, ~ 80 bytes. + Lag of below 250 ms is good, lag up to 500 ms payable and beyond that the + lag is noticeable. +\end_layout + +\begin_layout Section +Method +\end_layout + +\begin_layout Subsection +Development process +\end_layout + +\begin_layout Standard +May be Extreme Programming(XP), need to check this out further. + Maybe adapt so we can say that we use a standardized software development + method. +\end_layout + +\begin_layout Subsubsection +Demand specification +\end_layout + +\begin_layout Subsection +Design +\end_layout + +\begin_layout Subsection +Testing and evaluation +\end_layout + +\begin_layout Standard +Can we use quickcheck? +\end_layout + +\begin_layout Chapter +Theory +\end_layout + +\begin_layout Subsection +Performance +\end_layout + +\begin_layout Standard +How many players can we have on a server? Performance differences between + games? e.g can one game have thousands players on a server and another only + have hundreds? Questions to be discussed here. + +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Create a game with several thousand players, see how our server scales, + how can we improve the performance? Sharding isn’t very nice.. + alternatives? Improve the speed of sharding? +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +Choice of network protocol +\end_layout + +\begin_layout Standard +There are three main ways in which computer communication over the Internet + usually takes place; TCP, UDP and HTTP. + The first two are transport layer protocols, which are commonly used to + transport application layer protocols, such as HTTP. + TCP and UDP can not be used on their own, without an application layer + protocol on top. + Application layer protocols such as HTTP on the other hand needs a transport + layer protocol in order to work. + +\end_layout + +\begin_layout Subsubsection +HTTP +\end_layout + +\begin_layout Standard +Since HTTP is so widely used on the Internet today in web servers, it is + available on most Internet connected devices. + This means that if HTTP is used in GGS, firewalls will not pose problems, + which is a great benefit. + However, due to the intended usage of HTTP in web servers, the protocol + was designed to be stateless and client-initiated. + In order to maintain a state during a game session using HTTP, some sort + of token would have to be passed between client and server at all times, + much like how a web server works. + These facts combined makes HTTP unsuitable for our purposes, since GGS + requires a state to be maintained throughout a session, and also needs + to push data from the server to clients without the clients requesting + data. + It should also be mentioned that HTTP uses the TCP protocol for transport, + and what is said about TCP also applies to HTTP. + +\end_layout + +\begin_layout Subsubsection +UDP +\end_layout + +\begin_layout Standard +Many online games use UDP as the carrier for their application layer protocol. + UDP moves data across a network very quickly, however it does not ensure + that the data transferred arrives in consistent manner. + Data sent via UDP may be repeated, lost or out of order. + To ensure the data transferred is in good shape, some sort of error checking + mechanisms must be implemented. + UDP is a good choice for applications where it is more important that data + arrives in a timely manner than that all data arrives undamaged, it is + thus very suitable for media streaming, for example. + In GGS reliability of transfer was chosen before the speed of the transfer, + ruling out UDP as the transport later protocol. + +\end_layout + +\begin_layout Subsubsection +TCP +\end_layout + +\begin_layout Standard +For reliable transfers, TCP is often used on the Internet. + Built in to the protocol are the error checking and correction mechanisms + missing in UDP. + This ensures the consistency of data, but also makes the transfer slower + than if UDP had been used. + In GGS, data consistency is more important than transfer speeds, and thus + TCP is a better alternative than UDP. +\end_layout + +\begin_layout Subsection +Encryption +\end_layout + +\begin_layout Subsubsection +Performance penalties +\end_layout + +\begin_layout Subsection +Availability +\end_layout + +\begin_layout Standard +One important factor of a server is the availability, a server that you + can not connect to is a bad server. + Erlang has several features to increase the availability, for example hot + code replacement. + It is also critical to have a good design, we want to separate each part + of the server and thus avoiding that the whole server will crash. + +\end_layout + +\begin_layout Standard +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Players are unsatisfied with the service of WoW Telecoms have the same problem + of having to migrate users from one node to another, this is called handover +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +Scalability +\end_layout + +\begin_layout Standard +Because P2P game architectures are a constant goal for cheaters and because + “Cheating is a major concern in network games as it degrades the experience + of the majority of players who are honest” and preventing cheating in P2P + game architectures is very difficult game developers try to use Client + - Server architectures which have a natural problem to scale. + In this paper we want to show some strategies to achieve scalability. +\end_layout + +\begin_layout Subsubsection +UUID +\end_layout + +\begin_layout Subsection +Security +\end_layout + +\begin_layout Standard +We only support languages running in a sandboxed environment. + Each game session is started in its own sandbox. + The sandboxing isolates the games in such a way that they can not interfere + with each other. + If sandboxing was not in place, one game could potentially modify the contents + of a different game. + A similar approach is taken with the persistent storage we provide. + In the storage each game has its own namespace, much like a table in a + relational database. + A game is not allowed to venture outside this namespace, and can because + of this not modify the persistent data of other games. +\end_layout + +\begin_layout Chapter +Overview +\end_layout + +\begin_layout Subsection +Techniques for ensuring reliability +\end_layout + +\begin_layout Standard +One of the main goals of the project is to achieve high reliability. + A highly reliable application is one crashes very, very rarely +\begin_inset Note Note +status open + +\begin_layout Plain Layout +CITATION NEEDED +\end_layout + +\end_inset + +. + There are some tools for creating reliable applications built in to Erlang. + +\end_layout + +\begin_layout Itemize +Links between processes. + When a process spawns a new child process, and the child process later + exits, the parent process is notified of the exit. + +\end_layout + +\begin_layout Itemize +Transparent distribution over a network of processors. + When several nodes participate in a network, it does not matter on which + of these machines a process is run. + Communication between processes does not depend on the node in which each + process is run. + +\end_layout + +\begin_layout Itemize +Hot code replacements. + Two versions of the same module can reside in the memory of Erlang at any + time. + This means that a simple swap between these versions can take place very + quickly, and without stopping the machine. +\end_layout + +\begin_layout Standard +These three features are some of the basic building blocks for more sophisticate +d reliability systems in Erlang. + Many times it is not necessary to use these features directly, but rather + through the design patterns described below. +\end_layout + +\begin_layout Subsubsection +Supervisor structure +\end_layout + +\begin_layout Standard +By linking processes together and notifying parents when children exit, + we can create supervisors. + A supervisor is a common approach in ensuring that an application functions + in the way it was intended. + When a process misbehaves, the supervisor takes some action to restore + the process to a functional state. + +\end_layout + +\begin_layout Standard +There are several approaches to supervisor design in general (when not just + considering how they work in Erlang). + One common approach is to have the supervisor look in to the state of the + process(es) it supervises, and let the supervisor make decisions based + on this state. + The supervisor has a specification of how the process it supervises should + function, and this is how it makes decisions. + +\end_layout + +\begin_layout Standard +In Erlang, we have a simple version of supervisors. + We do not inspect the state of the processes being supervised. + We do have a specification of how the supervised processes should behave, + but on a higher level. + The specification describes things such as how many times in a given time + interval a child process may crash, which processes need restarting when + crashes occur, and so forth. + +\end_layout + +\begin_layout Standard +When the linking of processes in order to monitor exit behaviour is coupled + with the transparent distribution of Erlang, a very powerful supervision + system is created. + For instance, we can restart a failing process on a different, new node, + with minimal impact on the system as a whole. + +\end_layout + +\begin_layout Standard +In GGS, we have separated the system in to two large supervised parts. + We try to restart a crashing child separately, if this fails too many times, + we restart the nearest supervisor of this child. + This ensures separation of the subsystems so that a crash is as isolated + as possible. +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename supervisors.png + scale 50 + +\end_inset + + +\end_layout + +\begin_layout Subsubsection +Hot code replacement +\end_layout + +\begin_layout Subsection +Implementation +\end_layout + +\begin_layout Subsubsection +User interface +\end_layout + +\begin_layout Chapter +Problems +\end_layout + +\begin_layout Subsection +Erlang JS +\end_layout + +\begin_layout Subsubsection +UUID +\end_layout + +\begin_layout Section +Design choices +\end_layout + +\begin_layout Section +Understanding OTP +\end_layout + +\begin_layout Section +Usability +\end_layout + +\begin_layout Chapter +Results and discussion +\end_layout + +\begin_layout Section +Software development methodology +\end_layout + +\begin_layout Section +Statistics +\end_layout + +\begin_layout Chapter +Conclusion +\end_layout + +\begin_layout Chapter +References +\end_layout + +\begin_layout Chapter +Appendix +\end_layout + +\begin_layout Standard +Text goes here... +\end_layout + +\begin_layout Section +Objectives +\end_layout + +\begin_layout Standard +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +Figures go here... +\end_layout + +\begin_layout Chapter +Methodology +\end_layout + +\begin_layout Section +Overview +\end_layout + +\begin_layout Standard +Text goes here... +\begin_inset Newpage newpage +\end_inset + + +\end_layout + +\begin_layout Standard +Figures go here... +\end_layout + +\end_body +\end_document diff --git a/report.pdf b/report.pdf new file mode 100644 index 0000000..32bb70d Binary files /dev/null and b/report.pdf differ diff --git a/supervisors.png b/supervisors.png new file mode 100644 index 0000000..b5f6dac Binary files /dev/null and b/supervisors.png differ diff --git a/system_structure.png b/system_structure.png new file mode 100644 index 0000000..2daec0a Binary files /dev/null and b/system_structure.png differ