|
This document is last updated to state of Teddy version 1.63. Please send me email to tksuoran@cc.helsinki.fi and tell me what things you have had trouble with, so I can improve this text. Thank you. Getting Started with glElite and Teddy
This document describes briefly how to get started working on this project. I will refer to this project as 'Teddy' from now on; it will also cover anything for glElite as well though. I will separate Teddy and glElite documentation in near future. ToCNotes about environment, library and tool requirementsTeddy is intendent to work on multiple platforms, although only Win32 and linux environments have been tested so far. FreeBSD and Amiga versions have been known to be built at least once. Teddy is written in C++, and uses STL, so you will need a compiler which supports these; LCC for example will not work. I have used Visual Studio 6 in Win32 environment and g++ in linux. Project and workspace files are provided for Visual Studio 6, and configure script is provided for linux. I have been trying to make Teddy build with Cygwin / MingW as well, but so far I have not succeeded. Teddy depends on several libraries, which you need before you can build Teddy. The SDL library is the only absolutely required library. Others are optional, but highly recommended. The most important library is the Simple Directmedia Library - SDL. On linux environment SDL is easy to setup for development using standard configure && make && make install procedure. In Win32 it is best to use the libraries included in my source release archive, or rebuild the library yourself. You need to be familiar with building and installing libraries and their headers. I recommend following settings for all libraries: debug: 4 byte structure alignment, debug multithreaded dll runtime libraries, release: 4 byte structure alignment, multithreaded dll runtime libraries. That will make sure the structures are compatible with SDL, and that the runtime libraries are compatible with Teddy. Postfix debugging versions of the libraries with 'D'. Windows users should notice that libjpeg, libpng and libz are packed together with SDL_image. So if you are Windows developer, you will only need SDL and optionally SDL_image and SDL_mixer. Documentation for Teddy is generated using Doxygen. Doxygen is not required to build and test Teddy, but reading it's documentation of Doxygen might be a good idea, so that you know how to place documentation into sourcecode. Doxygen is only required to regenerate and update documentation from the sourcecode. ToCRegistering at sourceforge and getting sourcesFirst you should register yourself at sourceforge and let me know about you so I can add you to the team. At the moment our team is small, and anyone who is willing to contribute is welcome. You should also join the glElite developers mailinglist. There has been hardly any traffic at all there yet, so don't be afraid of getting flooded. I would very much like to use the mailing list for all glElite and Teddy related discussion as primary forum and media. To get started, you need sources. You can grab almost latest source .zip or .tar.gz directly from the glElite web page for quick look (also remember to get the separate data file). For any real work though you really should use the concurrent version control system, CVS. If you are not familiar with CVS, go to The CVS Book. When you are more familiar with CVS (basics), you can access Teddy CVS here. ToCFiles in the source packageFiles in Teddy are arranged as follows:
Source treeOnce you have got your working copy of sources, browse them. I have arranged sources into sub-directories, each of which make up static library, which are linked together with sources in the root source directory to make up the executable.
ThreadsTeddy uses two threads: the main thread, and simulation timer. The main thread sits in a loop updating graphics display and polling events, running as fast as possible (we might want to add limit here on really superfast machine, no need to render more frames that refresh frequence of monitor..). The simulation thread maintains system time. It also processes currently active events (keys pressed down etc) as updated by the main thread. Events are forwarded to Input::FocusManager, which eventually forwards events to individual physical user interface components. Components then invoke user interface logical actions, which are part of UI class in the testing environment. Finally, the simulation thread updates physics simulation. At the moment there is very little concurrency management. ModelInstances are can be locked. This is done by the simulation update thread and some other routines which access attitude etc. information. ToCCurrent statusAt the moment there is a lot of work that needs to be done. The list below contains some things in unsorted order. Feel free to attack any of these problems, and or list new ones! I am sure we can make this list a long one..
Frequently asked questions about glElite / Teddy developmentToCWhat is CVS, must I use it, and how do I do that?CVS is concurrent version control system. It maintains file consistency when multiple users are working on the project at same time. It even enables to users to modify same files at the same time. It is essential that everyone uses CVS when working with Teddy. When you use CVS, everyone has his or her own working copy of all files. Additionally there is a single repository, which maintains official version of files. The repository is maintained and located in Sourceforge. There are few important basic operations that you need. Two most important operations are update and commit. Commit command compares your files to the reposity and sends the changes you have made to the repository. Update commands gets the latest versions of files from the reposity to your working copy. The changes that others have committed are now in your working copy. You may wonder: If I make some changes and use update, will I lose my changes? No. Good. Wait. What if someone else has also changed the file, and committed changes before I have? Still no problems; when you make commit, CVS may tries to merge your changes. Sometimes it is not sure how this should be done, and you may have to manually decide what to do; CVS commit will abort and ask you to solve the conflict. Just open the file and edit it so that it will build again. You will notice that CVS has included both versions of parts that you both have changed. You will have to manually add each new files to the CVS. Same applies to remove. Note that CVS interpretes files as text by default, and expects that it can make some changes to the file. This means that binary files are effectively corrupted by CVS unless you explicitly tell CVS that it should leavy this file exactly as it is given. To do this, add files using -kb options. It would be a good convention to always update before commit, and never do commit until you are sure that it builds without any errors - at least on your favorite platform. ToCProblems with configureWindows and linux file systems are slightly incompatible. Some times it may happen that files execution permission flags get lost. You may have to chmod a+rx ./configure in order to be able to execute ./configure Additional trouble can be caused by different line endings. You may have to run fix.sh in the root directory of Teddy to fix line endings in all text files. Different line endings can cause many different problems, so try this first if you get really weird and unexpected error messages. The configure script may have trouble locating SDL. This usually means that you have not SDL installed, or you SDL is not in your path (SDL contains configuration script which gets to path when you install it), or your SDL is too old. It is also possible (even likely if you have specific linux distribution and install newer SDL manually) that you have several versions of SDL in your system, and they mess up each other. At the moment I require SDL 1.2.2 or newer. If you are trying to build Teddy on multiuser system where you are not superuser, there might be SDL installed on the system, but it might not be in the default path. Ask if SDL is present and where it would be. You have also option to install your own version of SDL using prefix option of SDL configure script. You may get it work even on top of older version of SDL if you set paths correctly. It may happen that ./configure is totally missing too, or does not work properly somehow (this is indicated by building problems). In this case you may have to run aclocal and autoconf which (re)generate the ./configure script. ToCCompiling problemsCompiling may fail for several reasons. If you get errors about SDL or other library includes in Win32 MSVC environment, you must add SDL includes (also libs) to Tools/Options/Directories in Visual Studio. In linux the ./configure -script usually makes sure SDL and other libraries will work. Compiling may also fail if for some reason platform dependent code is tried to be built on alien platform. This will happen when someone who has written the code has not been careful. You will have to isolate the offending code and disable it for your platform, or write implementation. I mean, you could, if you wanted to. Usually you should just let me know. Compiling may also fail just because there is error in the code. This can happen when someone fixes the code when resolving CVS Visual studio project and workspace files may be corrupted in some weird way. This may happen when development takes place in linux side and things change. You may need to add and or remove files or even add new projects. If you use the same directory on multiple machines, from network filesystem, or simply pack and copy to other machine, or upgrade you machine, you should remember to clean the old working files. This problem is severe in linux environment; configure cache may be incorrect for the new system; Makefile generated by configure may be outdated, etc. In linux environment source dependencies are generated by Makefile by scanning source directories for sources. Thus if new files are added or got from CVS update, you will have to make clean, maybe rerun configure and make sure Makefile is updated. ToCLinking problemsIn linux environment you may get errors about missing symbols even though source code is fine and compiles without errors. It turns out that gcc processes files in the order which they are given on the command line. When gcc is linking libraries, it only picks those symbols that have been referenced so far. This is why Maths library currently is last in the list for gcc. It is possible that when sources are edited, a new dependency is created, and the order of libraries in the Makefile.in must be changed. If you have not set up SDL and other libraries correctly you will have problems with linking, too. You will need SDL library. Other libraries, SDL_image and SDL_mixer, are optional. SDL_image further requires libpng, libz, and libpng. ToCRunning problemsTeddy happily crashes if it can not find some crucial data files. Teddy looks for all datafiles in current directory. The normal ./configure && make procedure in linux will copy Teddy executable to the TeddyRelease directory, which is outside the CVS, but part of the source archive. You must run Teddy there. Notice that some release of Teddy / glElite do not all data files in TeddyRelease directory within the LGPL source archive. Some copyrighted Elite and or Frontier: First Encounters derived data files are distributed separately. You can get the datafiles from the internet address You can also use getdata.sh to download and unpack this file. Contents of data.tgz are required to run Teddy if you want to see Elite or Frontier: First Encounters ship models. Currently no such data is being used though. ToCAre there any coding conventions?I would very much like that you would use real tabs for indentation. And never use tabs for anything else. It does not matter what value for tabs you use. Linux kernel coding conventions have not yet figured it out, but it is possible to write sourcecode which looks perfectly good with variable tab settings. The way to do it is to:
For other things (naming, layout..), you have two options. Use consistently your own conventions; this is fine - or look at my source code. It is not good example at some places, but looking around here and there you should get the idea. One thing is that I hate is prefixing class names with C, but I can live with that if you really have to do it. I would like to have one class per .h / .cpp file. Large classes can be divided into several .cpp files. ToCCopyright issuesElite is copyrighted, and GNU licences do not allow to include copyrighted material. Thus Teddy is under LGPL, but glElite is, urm, well, under no license at all. There may be some lightwave files in Teddywhich remotely look like Archimedes Elite ships, but erm, we'll fix that. We should make separate distribution on glElite and something.. ToCWho is making glElite / TeddyThe core of Teddy is written by Time Suoranta. Sean O'Neil wrote the ROAM code and some data structures. Russell L. Smith wrote Open Dynamics Engine. Fabrice Bellard wrote TinyGL. |