CSC209 – build . a simple make-like tool

Assignment 1 for CSC209 course at University of Toronto in Software Tools and Systems Programming

Build

In this assignment a student is required to write a program in Bourne shell that performs some of the same operations that make does . A simpler file format for a build file is specified , which does not follow all rules of the make program .

Build file format

There are 4 types of valid lines in a build file:

  1. A blank line. I.e., a line containing nothing but whitespace.
  2. A line whose first character is # which indicates that the remainder of the line is a comment.
  3. A line whose first character is an @ followed by a space, and then followed by one or more words separated by a single space. This type of line marks the beginning of a build rule. The @ is ignored. The first word in the sequence is the target of the rule, and the remaining words, if any, are the prerequisites for the rule.
  4. Other lines are considered action lines which should be executable statements.

In example:
#Comment line
@target prerequisite1 prerequisite2
action
action with arguments

Functionality and Implementation

build program will take one or two arguments. The first argument is the target that you want to build. The second argument is the name of the build file to the program will read. If the second argument is not present, the program will try to read a file in the current working directory called buildfile.

Steps:

  1. Read the build file looking for the appropriate rule. If found:
  2. Update prerequisites. (as with make, each prerequisite corresponds to a target in the buildfile, so we might need to execute another rule to ensure that a prerequisite is up to date.)
  3. If the target is a file and has been modified more recently than all of its prerequisites, then the actions are not executed.
  4. If the target is not a file, or any of the prerequisites are newer than the target, then the rule’s actions are executed.

Exceptions:

  • If a rule has no prerequisites, then the rule will always be executed when it is encountered. Note that this differs from make where a rule with no prerequisites is only executed if it is called explicitly.
  • You don’t need to handle recursive targets and prerequisites.

The build process will likely want to call the build program from within the build program. (Recursion comes in many forms.) The best way to do this is to make sure that build is in a directory in the PATH variable.

Testing

Another obvious use for shell scripts is to automate testing programs. We will also write a shell script called testbuild that will run several tests of the build program.

The testbuild program will run at least 3 different test cases that test different parts of the program. We will also need to include one or more build files and possibly some other files. The touch (see “man touch”) command will come in quite handy when we want to change a file’s modification time automatically.

Zip archive can be obtained here: http://zenebo.com/csc209a1.zip

DSA555 – Peg jump / solitaire solver

Assignment 1 in DSA555 at Seneca College in Data Structures and Algorithms in C++

Peg solitaire is a game where a set amount of pegs are filled in on a board with a set amount of pegs slots. To solve the Solitaire, a player consecutively jumps a peg over another peg , which in turn is emptied out. This process is repeated until there is only one peg on the board.

A C++ program that takes a file name as input . It expects the first line to be in this format:
,
where height and width are valid integers. Using these numbers, it processes the rest of the file using this format:
Character ‘O’ is an empty peg.
Character ‘X’ is a taken peg.

Once the board is parsed , if the board has a solution thus has only one peg left , it will print out the consecutive steps to solve it or it will print “No solution” if a solution can’t be found .

Instructions

Using command prompt: <executable> <test board>

Boards can be downloaded below the source code download link, or a new board can be created as long as it follows above format.

Zip archive is located here: http://zenebo.com/solitaire.zip

Test boards can be downloaded here : http://zenebo.com/solitaire_test_boards.zip

You've been served . Setting up a community game server

On October 9 , 2007 , Valve Software released a long awaited collection of games under an umbrella nameOrangeBox called The Orange Box . Titles included in the package are: Half-Life 2, an expansion standalone release named Half-Life 2: Episode One, a continuation of the series titled Half-Life 2: Episode Two, a single-player first-person action/puzzle gem of a game called Portal and Team Fortress 2 .

As the article name suggests, there is a variety of ways to enjoy the sheer goodness that these games have to offer. A frequent course of action is to set-up an online community. An organized , group centric approach offers many rewards to the players as well as to game publishers alike . It cultivates fan created content, fosters online discussions, allows for inter-clan or casual leagues to form and most of all keeps the players connected and organized in an otherwise distant field of online gaming.

The Orange Box exploded into a present form of an online juggernaut . Fueled by constant improvements to the underlying Steam platform, players gain ability to form groups , connect with their friends and merge into distinct groups. Outside of Steam platform, a separate world exists and caters to extend the experience. The dedicated online server communities are the main attraction to more serious gamers . The following paragraphs explain the experience and steps taken to build one of them : The Last Gunslingers , tagged by [TLGS] .

Server Types

An administrator can choose a pre-installed or a self managed solution . The self managed solution is more flexible, usually more expensive and often more hardware specific to its use. Important things to look for are:

  • Bandwidth
  • RAM
  • CPU
  • Operating System
  • Network Throughput

There could be other factors that can affect the overall performance of the servers , but these are a good start. Let’s look at a general overview of the above.

Bandwidth

A game server needs to be able send and receive packets with the least amount of latency. A data center provided 10 Mbit connection can handle one or multiple server instances running on the same physical machine. A Team Fortress 2 server handling 32 connected players will require similar numbers to the ones below . Server variables that dictate how the server operates may change these dramatically , but overall it is about hitting that performance to price sweet spot .

Rate of data flowing to clients from the server:

2.7 – 3.0 Mbps

This translates to roughly 2.0 – 2.5 Gigabytes of data being sent by the server per hour .

Rate of data flowing to the server from clients:

0.6 – 0.9 Mbps

This translates to roughly 250 Megabytes of data received by the server per hour . These are minimum requirements for a quality sustained connection. A safe practice is to not over saturate the line and leave at least 20% of connection cap free. This will help to eliminate network choke , otherwise known as a network lag .

Summing up possible requirements can be attained by calculating per player / slot network liability .

One player will require on average : 100 Kbps download and 18 Kbps upload .

A common limiting factor is monthly bandwidth allowance . One full server operating 24 hours a day will push about 900 Gigabytes of traffic per month. Most common server carriers will be able to sustain these transfer speeds as well as data transfers.

Above network usage is based on these server variables:

sv_minrate 13000
sv_maxrate 25000
sv_minupdaterate 10
sv_maxupdaterate 33
sv_mincmdrate 10
sv_maxcmdrate 33

Next we’ll look at the other requirements in the equation such as the CPU and RAM , etc.

Main website located at http://orange.half-life2.com contains more information on the Orange Box compilation.

Wikipedia page is located at http://en.wikipedia.org/wiki/The_Orange_Box.

OrangeStats – Team Fortress 2 log file parser

Orange Stats is a Python script that will parse Team Fortress 2 server log files in order to aggregate the data for later use. Regular expressions capture events as written to the log file by the game server. Each event has a corresponding structure containing various information such as : date , time, victim, aggressor, weapon type, event type and other event specific information. Team Fortress 2 adds a vast array of new gameplay and class specific events which extend the Half-Life 2 log file structure. More information can be obtained from Valve Developer Community here.

Orange Stats will insert extracted data into a database for later use by a web front-end or a Team Fortress 2 in-game plugin. The table schema is a bare bones implementation that supports CP map style gameplay. Design requirements focused on simplicity and light weight code implementation. Following game events are captured and categorized :

  • Connect
  • Disconnect
  • Map load
  • Join Team
  • Point Capture
  • Point Capture Block
  • Pick Character Class
  • Player Death
  • Player Assist
  • Revenge
  • Built Object
  • Destroy Object
  • Domination
  • Steam user events ( user ticket validation )

Character class specific data extraction works for events such as:

  • Sapper events, Uber charge events, Engineer object events

A web front-end will be uploaded along with the database schema as soon as possible. Orange Stats working demo can be viewed here . Web front-end features a slight AJAX touch through PrototypeJS .

Back end runs a light PHP script.

Python script is located here .

Unreal Tournament 3 resource package explorer!

Upkextract is a very early release of a simple utility that can open and parse the binary .upk packages shipped with Unreal Tournament 3. These packages are designed to be used by the game engine as well as by Unreal Editor. Contents within these archive varies from textures to sounds and shaders.

Current release of Upkextract can parse a UT3 resource file and find any sounds contained inside it. Unreal Tournament 3 uses Ogg Vorbis files for sound effects and encodes them using Xiph.org’s libVorbis aoTuvb5 library.

Sound file metrics such as gain, channels and others are not extracted in this release.

Archive contains the executable and a sample resource file from UT3.

http://zenebo.com/upkvorbisextract.zip