Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

svas_server.cc

Go to the documentation of this file.
00001 /*
00002   svas_server -- virtual World Server of Svas
00003   Copyright (c) 2001, 2002 David Moreno Montero
00004  
00005  
00006   This program is free software; you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation; either version 2 of the License, or
00009   (at your option) any later version.
00010  
00011   This program is distributed in the hope that it will be useful, but
00012   WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   General Public License for more details.
00015  
00016   You should have received a copy of the GNU General Public License
00017   along with this program; if not, write to the Free Software
00018   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00019   02111-1307, USA.  
00020 
00021 */
00022 
00023 /** \mainpage Simulacion de Vida Artificial -- SVAS
00024  *
00025  * \section intro Introduction
00026  *
00027  * SVAS is an alife 3d virtual enviroment with physic laws, and a
00028  * distributed design.
00029  *
00030  * There are four important distributed parts on the server: we have
00031  * on one side the grand master, CommCenter, that controls the flow of
00032  * execution, and then we have clients, each of them is executed in
00033  * parallel, using threads; they are Client, ControlClient and
00034  * GraphicClient, and all them are subclasses from BaseClient. Client
00035  * is the class that controls the agents.
00036  *
00037  * \section install Installation
00038  *
00039  * SVAS is really only the server, so you only need to compile it.
00040  *
00041  * A plain Makefile is included, so using the un*x command make is
00042  * enought, anyway if you compile it on another platform you only need
00043  * to note that svas_server uses the libcommonc++ libraries, so look
00044  * what they need on your platform, and just compile svas_server with
00045  * libcommonc++
00046  * 
00047  * There is also a graphic client, made with Qt/KDE 3.0/OpenGL in the
00048  * LiNUX platform, and a set of utilities made in Python that can be
00049  * used to display the world status with POVray raytracer.
00050  *
00051  * You need also at least one agent client if you want to make
00052  * something; there is a library made with python to help making
00053  * agents, and some examples are provided too.
00054  * 
00055  * \section reading Reading the code
00056  *
00057  * As SVAS is a full virtual enviroment it have lots of different
00058  * areas, as the physics, the communication, the world as container... 
00059  *
00060  * The easiest way to comprehend the system id to look at it as a
00061  * succesion of cycles, and then look a what one cycle does.
00062  *
00063  * \subsection overview A World Step
00064  *
00065  * First of all there are several threads of execution, the first is
00066  * the control one, that controls the creation of new threads
00067  * (clients), and checks when them have finished their works to begin
00068  * the physic simulation.
00069  *
00070  * While this check is being done, the other threads are receiving
00071  * data and only writting in the Cylinder::desiredAction attribute, so
00072  * no need of mutex nor any other type of synchronization is needed.
00073  * Of course they can read as much as they want, and when they end the
00074  * decrease the atomic counter that Wold::numClients is.
00075  *
00076  * Then, when all them finish, the physic simulation takes place.
00077  *
00078  * The physic simulation is done in the World class and on the
00079  * Cylinder one, using Collision.
00080  *
00081  * First at World::step() we begin the cycle, making the cylinders to
00082  * Cylinder::performActions() in the Cylinder::newCyle() method, then
00083  * we make one World::step(0,1), and it get subdivided if there is any
00084  * collision, if there is, we Cylinder::undoVelocity(), and make one
00085  * of the Collision::resolve() variants. So on until time is small
00086  * enought (COLLISION_TIME_EPSILUM), or no collision is
00087  * left... Contacts are solved too, but they do not need to be solved
00088  * until the end.
00089  *
00090  * \section contact Contact
00091  *
00092  * This program is being developed by David Moreno, who can be
00093  * contacted at the_hell@retemail.es. There is a project page at
00094  * http://savannah.gnu.org/projects/svas, and a CVS repository that
00095  * can be accesed at subversions.gnu.org:/cvsroot/svas,
00096  * http://savannah.gnu.org/cgi-bin/viewcvs/svas/.
00097  *
00098  * \section license License
00099  *
00100  * svas_server -- virtual World Server of Svas
00101  * Copyright (c) 2001, 2002 David Moreno Montero
00102  * 
00103  *
00104  * This program is free software; you can redistribute it and/or modify
00105  * it under the terms of the GNU General Public License as published by
00106  * the Free Software Foundation; either version 2 of the License, or
00107  * (at your option) any later version.
00108  *
00109  * This program is distributed in the hope that it will be useful, but
00110  * WITHOUT ANY WARRANTY; without even the implied warranty of
00111  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00112  * General Public License for more details.
00113  *
00114  * You should have received a copy of the GNU General Public License
00115  * along with this program; if not, write to the Free Software
00116  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00117  * 02111-1307, USA.  
00118  *
00119  */
00120 
00121 
00122 #include <thread.h>
00123 #include <math.h>
00124 #include "vector3d.h"
00125 #include "quaternion.h"
00126 #include "commcenter.h"
00127 #include "log.h"
00128 #include <iostream>
00129 #include <persist.h>
00130 
00131 /**
00132  * Main function.
00133  */
00134 int main(int argc, char **argv){
00135   log <<"Welcome to SVAS - Simulación de Vida Artificial SVAS"<<endl;
00136   try{
00137     CommCenter().loop();
00138   }
00139   catch(ost::Exception a){
00140     cerr <<"An unhandled exception occurred! Look at log!"<<endl;
00141   }
00142 }

Generated on Mon Jun 17 19:53:44 2002 for Svas Server by doxygen1.2.16