Wednesday, December 29, 2010

Code::Blocks(5) C++ SDL and Life "life.cpp"

Here is the code for the main program file, just copy and paste into file life.cpp in the project, then save the project:

#include <SDL/SDL.h> //SDL library
#include <SDL/SDL_image.h> //+SDL_image library (I use it for loading .png files)

#include "engine.h" // The simple engine class

#include <sstream> // I use it to work with text streams

int main ( int argc, char** argv ) //when you use a SDL c++ app you have to initialize main that way
{

Engine myengine; //Create a object from the type "Engine"
myengine.SetVga(); //Start graphics mode
myengine.LoadTileset(); //Load the image tileset to a SDLSurface

std::stringstream text; //Variable used to display text
Uint8 CellMap[50][50]; //The cell map, here qe store the cell state
Uint8 x,y; //variables used to travel across the cell array
int xmax, ymax; //Max size of tiles to display on screen
Uint8 Counter; //Counter of the surrounding cells
bool Paused; //Game paused?

Paused=false;//Let's start with the game running

xmax=myengine.ScreenX / myengine.TileSize; //calculate maximun number of cells (x-width)
ymax=myengine.ScreenY / myengine.TileSize; //calculate maximun number of cells (y-height)

 for (x=0;x<50;x++){
    for (y=0;y<50;y++){
        CellMap[x][y]=0; //clean the cell map so everything is "0"
    };//end y for
 };//end x for

//I put just 5 cells, into a "slider" configuration
CellMap[1][3]=1;
CellMap[2][3]=1;
CellMap[3][3]=1;
CellMap[3][2]=1;
CellMap[2][1]=1;



    // program main loop
    bool done = false;
    while (!done) // will loop infinite times until we set done = true
    {
        // message processing loop
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            // check for messages
            switch (event.type)
            {
                // exit if the window is closed
            case SDL_QUIT:
                done = true;
                break;

                // check for keypresses
            case SDL_KEYDOWN:
                {
                    // exit if ESCAPE is pressed
                    if (event.key.keysym.sym == SDLK_ESCAPE)
                        done = true;
                    break;
                }
            } // end switch
        } // end of message processing



myengine.Frames++;//increase frame counter

myengine.FillColour(200,200,200);//Clear screen with grey color
if (myengine.TimeElapsed()>=1000) // every second (1000ms)
{
    myengine.UpdateTimer(); // reset time counter
    myengine.FPS = myengine.Frames; // update the frames per second counter
    myengine.Frames=0; // reset frame counter

    text.str(""); //clean variable "text"
    text << "FPS:" << myengine.FPS; //will set text = "FPS: number"
    SDL_WM_SetCaption(  text.str().c_str(), NULL ); //set the title of the window to "text">>"FPS: number"

if (Paused==false){ //If the game is not paused, process cell map (step 1)
    for (x=1;x<=(xmax-1);x++){
        for (y=1;y<=(ymax-1);y++){
            Counter=0;//now we count the number of surrounding cells
            if (CellMap[x-1][y-1]==1 or     CellMap[x-1][y-1]==3)Counter++;
            if (CellMap[x-1][y]==1 or       CellMap[x-1][y]==3)Counter++;
            if (CellMap[x-1][y+1]==1 or     CellMap[x-1][y+1]==3)Counter++;
            if (CellMap[x][y-1]==1 or       CellMap[x][y-1]==3)Counter++;
            if (CellMap[x][y+1]==1 or       CellMap[x][y+1]==3)Counter++;
            if (CellMap[x+1][y-1]==1 or     CellMap[x+1][y-1]==3)Counter++;
            if (CellMap[x+1][y]==1 or       CellMap[x+1][y]==3)Counter++;
            if (CellMap[x+1][y+1]==1 or     CellMap[x+1][y+1]==3)Counter++;

            if (CellMap[x][y]==0 and Counter==3)CellMap[x][y]=2; //Born
            if (CellMap[x][y]==1){
                if (Counter<2 or Counter >3)CellMap[x][y]=3; //Die
                };

            //myengine.BlitTileset(x,y,CellMap[x][y]);  >>DISABLED

        }; //End for y
    };  //End for x

    //myengine.Flip();                                  >>DISABLED

}//enf if pause
}//end if time elapsed >= 1 second


for (x=1;x<=(xmax-1);x++){//Process cell map (step 2)
    for (y=1;y<=(ymax-1);y++){

        if (CellMap[x][y]==2)CellMap[x][y]=1; //Born
        if (CellMap[x][y]==3)CellMap[x][y]=0; //Die

        myengine.BlitTileset(x,y,CellMap[x][y]); //Display cell on screen
    };
 };


myengine.UpdateMouse();//update x and y mouse position + mouse buttons pressed

if(myengine.MouseButtons ==SDL_BUTTON(SDL_BUTTON_LEFT)){//Pressed left mouse button
    int sx,sy;
    /*   That code shows how to do a simple mouse maping:
    we have the physicall position where mouse is (myengine.MouseX,myengine.Mousey)
    but we need to know which tile correspond to that physicall position
    so we make an integer division between mouse (x, y) and the tilesize,
    the resulting sx, and sy is the tile where we have our mouse cursor    */
    sx=myengine.MouseX/myengine.TileSize;
    sy=myengine.MouseY/myengine.TileSize;

    //swap cell state: dead>living living>dead
    if(CellMap[sx+1][sy+1]==0) //It the cell is dead
        {
            CellMap[sx+1][sy+1]=1;//Cell is living
        }else{ //else cell is living
            CellMap[sx+1][sy+1]=0;//kill the cell
        }

    text.str("");//clean variable "text"
    text << "Left mouse pressed at:X:" << sx <<  " Y: "<< sy;//will set text = "Left mouse pressed at:X: number Y: number"
    SDL_WM_SetCaption(  text.str().c_str(), NULL );//set the title of the window to "text">>"Left mouse pressed at:X: number Y: number"

};//end left mouse button if

if(myengine.MouseButtons ==SDL_BUTTON(SDL_BUTTON_RIGHT) ){//Pressed right mouse button
    if (Paused ==true)//if the game is paused
        {
            Paused =false;//continue game
        }else{
            Paused=true;//else the game is running , pause it
        };
   if (Paused==true) SDL_WM_SetCaption( "PAUSED" , NULL );//if the game is paused, show it in the title bar
};//end right mouse button if

myengine.Flip();//Finally, update the screen from the back buffer :)
myengine.Wait(1); //prevent application from freezing OS
    } // end main loop

myengine.~Engine(); //Destroy object myengine >> that will free the SDSSurfaces and close SDL

return 0; //Everything is ok
}

Code::Blocks(4) C++ SDL and Life "engine.cpp"

Here is the code for the engine class implementation, just copy and paste into file engine.cpp in the project, then save the project:

#include "engine.h"

Engine::Engine()//Create the class and assign default values
{

SDL_Init( SDL_INIT_VIDEO ); //We start SDL, just video at the moment

screen=NULL;
tileset=NULL;

SDL_WM_SetCaption( "Life Game - Tile test", NULL ); //Caption of the window

SDL_ShowCursor(SDL_DISABLE); // hide system mouse

TileSize =50; // size of the default tile 50 pixels x 50 pixels

ScreenX=800; //screen width
ScreenY=600; //screen height
bpp=32; //screen bpp

StartTick = SDL_GetTicks();//Initialize timer
Frames=0; //Initialize frames = 0
}

Engine::~Engine()//Destructor
{
    //Free all the surfaces
    if (screen!=NULL)SDL_FreeSurface(screen); //Free screen surface
    if (tileset!=NULL)SDL_FreeSurface(tileset); //Free tileset surface

    SDL_Quit(); //Close SDL
}

void Engine::SetVga() // set video mode
{
screen = SDL_SetVideoMode(ScreenX, ScreenY, bpp,SDL_SWSURFACE|SDL_DOUBLEBUF);
/* It will set up a windowed video mode (width=screenx, height = screeny, bpp = bpp)
if we want to use a fullscreen mode we have to add
"|SDL_FULLSCREEN" after SDL_DOUBLEBUF  */
}

void Engine::FillColour(Uint8 r, Uint8 g, Uint8 b)//Fill the screen with a colour
{
    SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, r, g, b));// r-ed, g-reen,b-lue
}

void Engine::Flip()//flips backbuffer into primary buffer(screen)
{
    SDL_Flip(screen);
}

void Engine::LoadTileset() //loads an image into a memory (tileset), assigns the colorkey
{
    SDL_Surface* TmpSurface = NULL; //Temporary surface for loading
    TmpSurface = IMG_Load( "tileset.png"); //Load the image into a temporary surface
    if( TmpSurface != NULL )
    {
        tileset= SDL_DisplayFormat( TmpSurface );//optimize surface
        SDL_FreeSurface( TmpSurface); //free temporary surface
    }
    SDL_SetColorKey(tileset,SDL_SRCCOLORKEY | SDL_RLEACCEL,SDL_MapRGB(screen -> format, 255, 0, 255)); //set the color key
}

void Engine::UpdateMouse()
{
MouseButtons = SDL_GetMouseState(&MouseX, &MouseY); //Update mouse state
SDL_Rect start,end;
//set the cliping for the source surface (the tileset)
start.x= 200;
start.y=0;
start.w=TileSize;
start.h=TileSize;
//set the cliping for the destination surface (the screen)
end.x = MouseX;
end.y = MouseY;
end.w = TileSize;
end.h = TileSize;
SDL_BlitSurface(tileset, &start, screen, &end); //Blits the mouse pointer into the screen
}

void Engine::BlitTileset(int x, int y, int tile) //Blits a tile from our tileset to the screen
{
SDL_Rect start,end;
//set the cliping for the source surface (the tileset)
start.x= tile*TileSize;
start.y=0;
start.w=TileSize;
start.h=TileSize;
//set the cliping for the destination surface (the screen)
end.x = (x-1)*TileSize;
end.y = (y-1)*TileSize;
end.w = TileSize;
end.h = TileSize;
SDL_BlitSurface(tileset, &start, screen, &end); //Blits a tile from our tileset to the screen
}

void Engine::Wait(Uint32 ms) //Just pause for ms miliseconds
{
    SDL_Delay(ms);
}

int Engine::TimeElapsed() //Count time elapsed
{
    return SDL_GetTicks() - StartTick;
}

void Engine::UpdateTimer() //Reset time counter
{
    StartTick = SDL_GetTicks();
}

Code::Blocks(3) C++ SDL and Life "engine.h"

Here is the code for the engine class header, just copy and paste into file engine.h in the project, then save the project:


#ifndef ENGINE_H
#define ENGINE_H

#include <SDL/SDL.h> //SDL library
#include <SDL/SDL_image.h> //+SDL_image library (I use it for loading .png files)

class Engine
{
    public:

    SDL_Surface* screen; //The screen
    SDL_Surface* tileset; //A simple tileset for testing purposes only

    int ScreenX;//Width of the screen
    int ScreenY;//Height of the screen
    int bpp;//Bit Per Pixel (colour depth)

    int MouseX; //Mouse x position
    int MouseY; //Mouse y position
    Uint8 MouseButtons; //Mouse button pressed

    int Frames; //Actual frame
    int FPS;      //Frames per second
    int StartTick;
    int LastTick;

    Uint8 TileSize; //size of the default tile


        Engine(); //creator
        virtual ~Engine(); //destructor
        void SetVga(); //Set the video mode
        void FillColour(Uint8 r,Uint8 g,Uint8 b); //fill screen with a colour
        void Flip(); //Flips the backbuffer to the primary buffer
        void LoadTileset(); //loads a test tileset
        void UpdateMouse(); //refresh mouse position and buttons pressed
        void BlitTileset(int x,int y, int tile); // Blit a tile from our tileset to the screen
        void Wait(Uint32 ms); //waits ms miliseconds
        int TimeElapsed(); //Get the time passed since last time control
        void UpdateTimer(); //Update the start time control
    protected:
    private:
};

#endif // ENGINE_H

Wednesday, December 22, 2010

Code::Blocks(2) C++ SDL and Life

Now it's time to open Code::Blocks:
-Go to "Applications" > "Programming" > "Code::Blocks"



The first time we open Code::Blocks it will ask you which compiler to use, we have to select the GNU GCC compiler:
Now we have the start screen and a tip window will pop up, close the tips window and you will see basically four areas:
    • On the left, the current project files (header (.h) and source (.cpp))
    • On the right the code from the opened files
    • On the top, the menus and the toolbars
    • On the bottom, Code::Blocks messages, such as debugger messages, etc.
Now we are going to create the project, select "File" > "New"  > "Project" :


Select "Empty project" and press "Go"



Just press "Next"



Now write the project name (i have used "Life"), then select where do you want to save it (which folder) and press "Next" again.




Defaults are ok now, press "Next"





We have a new, empty project, let's add the first file, press the new button:


And select "Empty file", then press "Yes" to save the new file




This project is going to have three files:
  1. life.cpp
  2. engine.h
  3. engine.cpp
life.cpp is the main program, engine.h is the simple engine header, and engine.cpp the implementation, let's start first to code the engine, so write "engine.h" and "save"


Finally, we have to tell code::block to include the file in the project, so it can compile and debug them properly, just press ok


Notice now the workspace "Life" has a new folder "headers" inside you will find the new file "engine.h", time to create the other two files and save them:

-Press "New file" > "empty file" > "yes"> write the name (engine.cpp then life.cpp) and "save" , "ok"

Project should look like that now:


Now let's open "Project" > "Build options",In  "Linker settings" > "Other linker options" write: -lSDL -lSDL_image, that will make the compiler to link the program against the right libraries (SDL and SDL_image).



Last thing before we start to write down the c++ code:


Save the upper image as "tileset.png" to the "life" directory, other way the project won't work at all.

In the next 3 posts the code for: "engine.h", "engine.cpp" and finally "life.cpp"

Monday, December 13, 2010

Code::Blocks(1) C++, SDL and Life

Time to finally start using code::blocks, we are going to create a simple first project:



Conway's Game of life

We have a few objectives to accomplish with the tutorial:

  • Use Code::Blocks to create projects, add classes, configure libraries, etc.
  • Setting up SDL with Code::Blocks
  • Creating a simplistic game engine.
  • Loading and displaying a image tile set on the screen.
  • Basic use of mouse, keyboard, timing.



Our prerequisite for the tutorial is a simple tile set image:


I have made it using Gimp, we have 5 different tiles, from left to right: empty cell, living cell, new born cell, death cell and the mouse cursor.


Conway's Game of Life is a simulation of "living" cells, let's suppose our world is a big 2D grid, now let's suppose again that each cell in the grid can have 4 different states :
  • 0 > Empty cell , a void in the map.
  • 1 > A living cell.
  • 2 > A new born cell.
  • 3 > A dying cell.
Actually, only the first to states are really important, the other are only used in an intermediate state to process correctly the map, the time is measured in "ticks" every tick if an empty cell has exactly 3 adjacent living cells will generate a new born cell, and a living cell that has less than 2, or more than 3 adjacent cells will die, I'm going to show a way of making a program to simulate the game with c++ and then i will start with code::blocks + SDL:

//We need a grid to store data, we have a map of 50 x 50 cells
Uint8 CellMap[50][50];

// A temporary counter of surrounding cells 
Uint8 counter;

// Variables used when working with the 2d array "CellMap" 
Uint8 x,y;

//Now let's initialize the array, it's always a very good idea to initialize variables to prevent unexpected results in the program.

 for (x=0;x<50;x++){
     for (y=0;y<50;y++){
         CellMap[x][y]=0; //We will start with an empty map
     }; //end y for
 }; // end x for

//We will start with just 5 living cells in a configuration called "slider"
CellMap[1][5]=1;
CellMap[2][5]=1;
CellMap[3][5]=1;
CellMap[3][4]=1;
CellMap[2][3]=1;

 // program main loop
    bool done = false;
    while (!done) //Will make an infinity loop unless we set done=true
    {
//Clear screen with a light grey
myengine.FillColour(200,200,200);
//FIRST LOOP //x loop for for (x=1;x<50;x++){         //y loop for         for (y=1;y<50;y++){              //Counter of the adjacent cells                        Counter=0;             //Count the number of adjacent living cells             if (CellMap[x-1][y-1]==1 or     CellMap[x-1][y-1]==3)Counter++;             if (CellMap[x-1][y]==1 or       CellMap[x-1][y]==3)Counter++;             if (CellMap[x-1][y+1]==1 or     CellMap[x-1][y+1]==3)Counter++;             if (CellMap[x][y-1]==1 or       CellMap[x][y-1]==3)Counter++;             if (CellMap[x][y+1]==1 or       CellMap[x][y+1]==3)Counter++;             if (CellMap[x+1][y-1]==1 or     CellMap[x+1][y-1]==3)Counter++;             if (CellMap[x+1][y]==1 or       CellMap[x+1][y]==3)Counter++;             if (CellMap[x+1][y+1]==1 or     CellMap[x+1][y+1]==3)Counter++;             //minimum adjacent cells = 0             //maximum adjacent cells = 8             //if a cell has is dead "0" and is surrounded by 3 cells will born             if (CellMap[x][y]==0 and Counter==3)CellMap[x][y]=2; //Born            //if a cell is living "1" and is surrounded by less than 2 cells,            //or more than 3 cells, will die            // the problem is that if we change the state from 0 to 1 or 1 to 0,            //when we continue counting, the results will not be correct, so we           //use a temporary state (2 for new born and 3 for dying cell), so           //when we continue counting adjacent cells the result will be ok                     if (CellMap[x][y]==1){                 if (Counter<2 or Counter >3)CellMap[x][y]=3; //Die                 }                 //draw the cell on the screen                myengine.BlitTileset(x,y,CellMap[x][y]);         }; //End for y     };  //End for x //Update the screen with the back buffer
myengine.Flip();
} //SECOND LOOP //x loop for for (x=1;x<50;x++){         //y loop for         for (y=1;y<50;y++){         //now we clean the map with the final cell state (1 or 0)         if (CellMap[x][y]==2)CellMap[x][y]=1; //Born         if (CellMap[x][y]==3)CellMap[x][y]=0; //Die         //draw the cell on the screen         myengine.BlitTileset(x,y,CellMap[x][y]);     };  }; //update the screen
myengine.Flip();
//wait 50 miliseconds to limit frame rate
myengine.Wait(50);
} //End of main loop

Notice i have written a few lines of code with red color, I'm going to create a c++ class to encapsulate a simple engine so many SDL functions will be integrated in it, making easier the process to write programs; i have removed too code from the program to make it more readable, I will show the complete code later.

On the next post, our first Code::Blocks c++ project!

Software Packages

That is a recompilation of all the needed /recommended / useful packages to use the tutorials:

(In blue the linux / Debian packages, in red link to other sites)

GNU c and c++ compilers:
  • gcc
  • g++

Code::Blocks IDE:
  • codeblocks

SDL library and add ons:
  • libsdl1.2-dev
  • libsdl-image-1.2-dev
  • libsdl-mixer-dev
  • libsdl-net-1.2-dev
  • libsdl-ttf-2.0-dev
The GNU image manipulation program:
  • gimp


Other useful packages:


A nice web browser:
  • Firefox 

A great Version control tool
  • subversion
Make and c-style make
  • make ->Not used in the tutorials, but very useful
  • cmake ->Not used in the tutorials, but very useful
Sprig, the definitive add on library for SDL:
A library to draw almost any shape, scaling and rotating images by Jhony D


Box 2D: 2D physics:

Tuesday, November 9, 2010

Ubuntu(4) Software, Tools and Libraries

Software, Tools and Libraries

Now we will install software / tools and libraries to start working, Ubuntu is quite flexible in the way you can install new apps: we can use a GUI to do it (Ubuntu Software center / Synaptics), or  we can use the command line (Terminal) old but trusty way.. I will show you both ways but i prefer the terminal because it's just faster and simpler to install packages, (You can choose anyway):

Installing software using the terminal


To open the terminal just press Applications > Accesories > Terminal


The black screen is the terminal, not very impressive, but it's very powerful, the $ prompt is waiting us to type commands....



Now for installing software we will use the command "sudo apt-get install X", where X is the package you want to download and install, notice "sudo" > su-peruser do > that means the next command will be executed with super user privileges , after we type the command (in the screen i use it to install codeblocks), Ubuntu will ask for the user password, and then if the package is found in the software repositories you will have to type "y"es to continue with the installation.


Here you see the process, finally we have the prompt again $: the software is installed, now we are going to install all those packages :


  • "codeblocks" > The c++ IDE
  • "g++" > The G++ command line compiler
  • "libsdl-dev" > The development SDL libraries
  • "gimp" > The GNU image manipulation program
So we will be using the commands:
-sudo apt-get install codeblocks
-sudo apt-get install g++
etc,etc

Installing software using the Ubuntu Software Center

Now i will install codeblocks using  the ubuntu software center:



Open Aplications > Ubuntu Software Center



Now you can browse for new software or search, we will search typing on the search bar (top right) "codeblocks".



Ubuntu has found it on the repositories, now just press Install



Type the user password to install.



Installing packages...



It's installed , you can get more info about the software or uninstall it.

We will install more software later but now we have a basic pack to start:
  • Openoffice (Already installed with Ubuntu)
  • Gimp (We have to install it)
  • Codeblocks + libraries (We have to install them)
In the next Post we will be programming our first  c++ SDL aplication with codeblocks!


Monday, November 8, 2010

Ubuntu(3) Updating Ubuntu

Security Updates

After installing Ubuntu we will  continue with some basic settings to start using codeblocks.

First we will update Ubuntu, it's important to always keep the system updated to prevent security problems.



Go to System > Administration > Update Manager.



Select Check and all the available updates will pop up, then push Install Updates.



Ubuntu will ask your password to install the updates.



Now it downloads the packages...



Then it will install the updates...



You are done!

Tuesday, November 2, 2010

Ubuntu(2) Installing Ubuntu

Let's install Ubuntu!

We already have the cd with the recorded ubuntu image, we just need to:
  • Insert the ubuntu cd into the CD/DVD drive from our PC.
  • Make our PC start from the CD/DVD drive: depending in the brand and model you will need to set up the pc to arrange the boot order in the computer BIOS so the CD/DVD drive is the first bootable medium in the list (to get into the BIOS you have to press a particular key when booting like "Delete" (Award BIOS),  "F10" (HP computers), "F2"(Other models).
  • After that when we turn on the PC it should start booting from the Ubuntu CD, after a while you'll get that screen:
  • Here we will select the language used to install ubuntu, select it from the left combo, and then push "Install Ubuntu"
  • I select the option "Download updates while installing" becouse there will always be updated packages since the ubuntu iso image was launched, then push "Forward"

  • Now we have arrived to the dreaded "Partitioning hell". We have two possibilities here:
  1. We don't have any operating system installed (So we can just "Erase and use the entire disk" and press "Forward").
  2. We do have other operating systems: Before you ever think in taking any step I encourage you to make a complete backup from your data, (not joking, you can loose all the data on your hdd), then we can get rid of the other OSs just pressing "Erase and use the entire disk" and press "Forward", but probably we will want to keep both OSs working on the same HDD, so just select "Install alongside other operating systems" and "Forward".

  • If we are just installing Ubuntu , then select "Install Now", other way we will have to assign the size of the partitions for every OS installed on the HDD, if we select a size for a partition smaller than the data stored we will loose data and probably completely break the operating system, so be careful!, if you don't know what to do just accept the partitioning offered by Ubuntu and continue without making any changes.


  • Here we select the timezone where we live and "Forward".

  • Select the keyboard from our pc and "Forward"...



  • That's a very important step, now we are going to create the user to work with Ubuntu, just write down the name desired for your user , the password twice , the "Computer name" is not really important unless you want to create a network with other computers, so you can just ignore it, and always select "Require my password to log in" to prevent anybody to get inside your computer just turning on the computer... , if you feel paranoyd or plan to travel with a laptop with sensitive data inside, you can "Encrypt my home folder" to increase the security.


  • Now we can just sit and relax, ubuntu will partition the HDD, copy files, download updates , and install the packages, depending on your PC it will be faster or slower...



  • Ubuntu with the installation slideshow..


  • Finally Ubuntu is installed! just press "Restart Now" and the computer will restart.


  • That's the login dialog for Ubuntu, just type the username and password, and Ubuntu will load the desktop.


Wednesday, October 27, 2010

Ubuntu(1) ¿Why Ubuntu?

Gnu
+Linux
 


          Hello, today I'm going to start with the first writing into the operating system installation and setting up series.

          I have chosen Linux to work, and from all the Linux distributions i have chosen Ubuntu 10.10; Why Linux? and why Ubuntu? for the first question the answer is simple, it's a free operating system , stable, very easy to upgrade and update, and although I want to make the project compatible with Windows and i will compile the Client in Windows later, i must stick to my Rule nº1 to develop the Game.

        The second answer is more complicated, i have used a few operating systems in my live, I started with MS-DOS 4.0, then 5.0,6.0, windows 3.0, 3.1 Windows 95, 98 Me , NT 4, 2000, XP , Vista 7, .net server 2003, Solaris 5, 7, 8, 9 and 10, but even if i count all them it's nothing compared with the Linux world: there are so many distributions(distros) that you can get lost easily ... , i started with Slackware (year 97-98), then Red Hat , Suse , Knoppix, Debian, and finally Ubuntu... from every distro i have used from one version (slackware) to many (Suse, Red Hat, Ubuntu), when i first started with Slackware Linux it was not designed for the final user, not at all! , if i wanted to use a CD i had to manually mount it, (and unmount it when i wanted to eject it), it took me about 4 hours to configure my video card, and when i tried to set up my modem to configure a Dial-Up connection to Internet i finally quit, it wasn't until i bought Suse Linux 6.4 on a box (yes i bought a Linux distro) when i really had the opportunity to use Linux, it was much more "user-friendly" , it was easy to set up the drivers for the system and i got connected to Internet in minutes, and today Internet means everything speaking about computing, but even then i had the feeling that "something is missing", something that got filled with Ubuntu:
  • Ubuntu is made to simplify things, not to make them more complicated, from the installation process to the user interface, if you want, you don't have to use the terminal (no more bash and derivatives sir!).
  • It's quite user-friendly, very configurable and a real alternative to other OS's that aren't free.
  • You can install a complete system , ready to navigate into Internet, work with office documents , everything in a single CD, and that's really important for me, i remember the time i was using suse 6.4, it came with 6cds! and the problem was not which packages to install, but which ones you shouldn't!, today it's much more easier.
  • Today most of the operating systems are bloated: , Vista and "7" need a core duo or athlon x2 with 2gb ram to "start"  (guess why Intel has a prototype of processor with 80 cores?) , mac OS X snow leopard needs ... a MAC(even more expensive) and what about Linux? D.S.L. works with a 486DX with 16MB Ram, OK!, but if you go to gnome most of the distros think in the user in the same way Microsoft does: if the user can't install the os, he should buy a new computer, I'm writing this blog with a net-book: atom processor and 1gb ram, Ubuntu runs smoothly on it.

I think i have given a few good reasons to use Ubuntu, but of course many people won't like it, people should be free to think the way they like ...
 
       So after all the chat , let's start downloading it, let's go to http://www.ubuntu.com, then push the "Download Ubuntu" button and then "Start Download",  and save the file ubuntu-10.10-desktop-i386.iso to your hard disk, now you just have to burn the iso image to a blank CD: now you are ready to start installing the system.
      In the next post we will see how to install and set it up.

Tuesday, October 19, 2010

THE RULES

All the games have rules, mine's are:

  1. I will only use free software for my project, it's not I'm against the companies that sell software, it's that i want to make my project accessible to everybody, so my OS is a Linux sistem (Ubuntu), my IDE (code::blocks) my tools (gimp, open office, etc), my database (mysql), everything must be free , but i'm not "narrow minded", i want to make my project compatible with others OSs like Windows  (in fact i suppose it will be compatible to any OS with c++ compiler and SDL port).
  2. I will do the project alone, it's just something i want to make since long, long time ago, it doesn't mean i refuse help, i know that i will need it in the graphics and sound, so at least at the beginning i'll be using free tile graphics, and of course i will accept it when i start with coding.. but i want to make it by my own resources. 
  3. I have 1 year to complete the development, at least to have a working client and the server and database online (at least to have something playable working).
  4. I will post all the ideas and portions of code or pseudo-code of everything, the objective is not just accomplish my goal but to help other people to make their dreams come true.
My game, my rules

And thats all for now!

Sunday, October 3, 2010

The design

For the programmers and for all the people that are just curious, my mmorpg it's gonna be a 2D view rpg, my programming language c++ , my graphic library libsdl, networking with sdl_net and my database mysql, my development computer is a linux computer but i want to make it as portable as possible so the client will work in Linux and Windows at least. I'm going to start with the client, when i get it to show what i want to see on the screen i will put the database online, finally i'll get with the core networker program.

I'm an army of one so my objective is not making things looking perfect, but making them to work so don't expect WOW , I'll be posting pictures and my thoughts about the development.

In the beginning...

It all starts with simple ideas: sometimes you want to make big things, sometimes you just want to achieve objectives like and old project:

I'm a Programmer I've always liked computers even when i didn't had one; I've worked, played ,repaired and assembled them;  sometimes i love them sometimes i have really hated them, but always , always i wanted to make a big project with them and in my life i  have learned enought to realize that "i can do it!", so here i am, telling to all the people that want to listen and myself too that i'm starting the project not in X time, but NOW.

Finally here's my project: an MMORPG, it doesn't looks very impressive,  i know today you have thousands of them around, but i want to make mine, it's an old project I've played around over and over but now i feel ready to begin, i have the tools , the history, the design , and the faith..

It all Starts one day, and for me the day is Today.