Skip to main content Skip to navigation

Lab 1 Exercises


This lab is looking at a model we made of the Stargate. For those not familiar with the films and TV series take a look 'here' with particular reference to the paragraph entitled "Destiny's Gate" under Technical specifications. Empirical Modelling is an open exploratory process where there is some referent artifact (in this case the Stargate as seen in the film) and we are attempting by experiment to recreate this on the computer. The process of modelling the Stargate helps us understand its mechanics better. We are not trying to write a program to accurately simulate a Stargate efficiently but instead are looking to learn something about it and explore possibilities in an interactive fashion. The resulting model (if ever finished) should resemble our understanding of how it works and not be abstracted to how it can be best implemented on a machine. Once we have worked out how to model a Stargate it may then be possible to write an efficient program to do it but our modelling comes before a complete understanding exists.


To do this modelling we have, over the years, constructed our own tools and so the purpose of this lab is to make you familiar with them. The tool being used this year is a brand new hybrid of old and new technology. It should be remembered that this is an ongoing research project and the tools are prototypes only.


Getting Started

First take a look at our attempt to model the Stargate. Open up a shell window (can do this by pressing Alt+F2 and typing "konsole" into the search box) and copy the following into it:

~empublic/teaching/cs405/run stargate

Press enter and this should bring up our EDEN/DOSTE hybrid tool with a 3D visualisation of the Stargate and an input window.

There is also a small "Dial" button in the top left which when clicked should start an animation of the dialling process.

Take a look at the 'gate.dasm' file in the '~empublic/teaching/cs405/stargate' directory. You can use a text editor called 'kate' to open this file and this can also be run from Alt+F2 or from the start menu. This gate file describes the key components and behaviour of the model. Other files describe the visual effects and other structures which we are currently not concerned about. We hope that by the end of the labs you will understand the concepts behind this tool and that most of you will be able to understand this language as well.

There are actually many flaws in this model - i.e. respects in which the model is not faithful to the Stargate as it is portrayed in films - that we have yet to resolve. If you are familiar with Stargate then perhaps you will notice these.


Introducing the Notations

For the rest of the lab you will be working with a simplified version of the Stargate model which has had all our work on the dialling sequence removed. Close tkeden and then copy the next line into that same shell window:

~empublic/teaching/cs405/run lab1

Run the tool again to bring up another simpler version of Stargate.

Near the top of the input window you will see "%eden" and "%dasm". These select the notation you are currently using. As mentioned this is a hybrid tool and each part has its own notation. %dasm is the newer 3D and object-oriented part which will be the focus of the lab today. %eden will be used in later labs. So select %dasm. Some basic documentation of this notation can be found here.

Type the following into the input window:

@stargate chevrons 0 on = 1;

Click Accept and watch the light on the top chevron turn on. The same can be done for any of the chevrons and they can be turned off again by setting them to 0. Now try the next line:

@stargate ready = true;

This will reactivate the Stargate, turning the puddle effect on.

Finally we have the inner ring rotation which can be changed as follows:

@stargate rotation = 2.0;

This rotation is given in radians.

It is possible to bring up a list of all the observables in @stargate that you can observe or change. To do this type the following into the input window (Note: there is a single space before '%list'!):

 %list @stargate;

This prints out a list into the console window.

To query the value of a specific observable:

?@stargate rotation;

Play around with these for a bit and again take a look at the simplified 'gate.dasm' in '~empublic/teaching/cs405/lab1' to see what else there is. If you look in some of the other files you may find some really interesting observables to change.


Connecting with Definitions

So now that we know what we can change and what we can see let's try connecting things together using definitions which are similar to spreadsheet formula. A simple definition might be to say that the stargate is 'ready' when chevron 8 is turned on.

@stargate ready is { .chevrons 8 on == 1 };

What we have said is that 'ready' is true if the value of 'chevrons 8 on' is 1. Note the '.' (dot) before chevrons means 'this' or current context which corresponds to the object that the 'ready' observable is in, which in this case is '@stargate'. You could use '@stargate' instead of '.'.

Now try turning chevron 8 on and see what happens.

There is another observable in the stargate which may be of interest. It is called 'dial' and becomes true whenever the mouse is clicking on the 'Dial' button. Just to check this you can define chevron 8 to come on when that button is clicked:

@stargate chevrons 8 on is { if (@stargate dial) 1 else 0 };

The stargate will also activate when the button is clicked because of the previous definition. We now leave it to you to play with these definitions, ask questions and look at the code for the stargate model. Try getting the puddle to activate only when all the lights are on. We will look at animation and making objects next week.