3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Dragon Mission. Again  (Read 463 times)

« on: December 30, 2013, 01:28:24 AM »
Hey everybody. Im working on this project for a really long time, you maybe saw my 2 topics about this game. And a lot of time i failed making this, but i change a lot the idea of the game. The first is change the concept of the game, i don't use models of human soldiers anymore and the same with the guns, now i use cube models, i know its very simplistic but is the best way to make my own models and my own animations. I change the third person camera to a first person camera, because i love the idea of aim to get a better shoot accuracy.

I failed a lot of times on making this because i had some problems on the client and the server character, now i guess i have the "formula" or the solution of the problem. Anyway, im working on the save and load gun ID. What is this?, is very simple and here is an explanation:

You (the player) can buy guns in the shop, i made a way to organize the guns in "Packages". A package contains the gun and depending the package you will get some parts to modificate the gun.

I made 4 packages for the AK-47, the packages have differents combinations of parts and you can choose your preffer.

1st Package: Standard

Is very simple, you have a simple metal sight, with a long cannon and a 30 rounds magazine.
Here some images of the gun

This is the gun on the simple view


This is the sight of the gun


2nd Package: Assault.

This package contain a short cannon (for less recoil) and a red dot sight





And one shooting ;D


And later you have the heavy package and the tactic package, but i don't put information because you get how this works ;D. So every package have an ID Number. When you buy a gun a script save the ID Number and when you play the script load the value saved on a .mdb file (a random file extension i use because nobody can modify it :P) and the gun skinmesh appears.

This is the script to save the ID Number, Jestermon made this and i modify a little bit:
Code: [Select]
///=============================================================================
/// Global Hash Pool, A simple mini database for 3d Rad                       
///=============================================================================

///=============================================================================
string[] GHPSplit(string s, string c)
{
   int p;
   string[] strList();
   int valve = 0;
   bool done = false;
   string s1,s2,s3;
   int Idx = 0;

   s3 = s;
   strList.resize(0); //clear the array
   while (!done)
   {
      valve++; if(valve == 1000) break; //while pressure valve
      p = iStringFind(s3,c,0,false); //find splitter
      if(p != -1)
      {
         iStringLeft(s1,s3,p-1); //get the 1st part
         iStringRight(s2,s3,iStringLen(s3)-p); //get the second part
         Idx = strList.length();
         Idx++;
         strList.resize(Idx);  //increase list size
         strList[Idx-1] = s1;  //stort string part in array
         s3 = s2;
      }
      else
      {
         if(iStringLen(s3) > 0)  //tail piece of the string
         {
            Idx++;
            strList.resize(Idx);
            strList[Idx-1] = s3;
            done = true;
         }
      }
   }
   return strList;
}

///=============================================================================
string GHPJoin(string[] array, string c)
{
   string s = "";
   int i;
   int L = array.length();

   for(i=0; i<L-2; i++)
   {
      s = s + array[i] + c;
   }
   s = s + array[L-1];
   return s;
}

///=============================================================================
int GHPFindKey(string key)
{
   string buffer;
   int res;
   int i;
   for(i=0;i<1000;i++){
      iGlobalStringGet(buffer,i);
      res = iStringFind(buffer,key+",",0,true);
      if(res != -1){
         return i;
      }
      if(iStringLen(buffer) == 0){
         return i;
      }
   }
   return -1;
}

///=============================================================================
///GHPLoad: Loads the global has pool from a disk file                         
///---------------------------------------------------------------------------
bool GHPLoad(string filename)
{
   string data;
   int i;
   int fh = iFileReadOpen(filename); //open file for read
   if(fh == -1) return false; //if no file, get out with indicator
   for(i=0;i<1000;i++) iGlobalStringSet("",i); //clear globals
   for(i=0;i<1000;i++){  //for all records
      iFileStringRead(fh,data);
      if(iStringLen(data) < 1) break; //if empty recored, stop reading
         iGlobalStringSet(data,i); //load data record t oglobals
   }
   iFileClose(fh);  //close the file
   return true;  //we have lift off
}

///=============================================================================
///GHPSave: Saves the global has pool to a disk file                         
///---------------------------------------------------------------------------
bool GHPSave(string filename)
{
   string data;
   int i;
   int fh = iFileWriteOpen(filename); //open file for write
   if(fh == -1) return false; //if no file, get out with indicator
   for(i=0;i<1000;i++){ //for all recored
      iGlobalStringGet(data,i);  //read global data
      if(iStringLen(data) < 1) break; //no more data, get out
      if(iStringLen(data)>0){ //if there is data
         iFileStringWrite(fh,data,true); //write to file
      }
   }
   iFileClose(fh);  //close the file   
   return true; //we have closure
}

///=============================================================================
///GHPSetInt: Sets an int to the global hash pool by key name                             
///=============================================================================
void GHPSetInt(string key, int data)
{
   int i,idx;
   string ghdata = key + ","+data;
   idx = GHPFindKey(key);
   if(idx == -1) return;
   iGlobalStringSet(ghdata,idx);
}

///=============================================================================
///GHPSetFloat: Sets a float to the global hash pool by key name                             
///=============================================================================
void GHPSetFloat(string key, float data)
{
   int i,idx;
   string ghdata = key + ","+data;
   idx = GHPFindKey(key);
   if(idx == -1) return;
   iGlobalStringSet(ghdata,idx);
}

///=============================================================================
///GHPSetString: Sets a string to the global hash pool by key name                             
///=============================================================================
void GHPSetString(string key, string data)
{
   int i,idx;
   string ghdata = key + ","+data;
   idx = GHPFindKey(key);
   if(idx == -1) return;
   iGlobalStringSet(ghdata,idx);
}

///=============================================================================
///GHPSetVector: Sets a vector to the global hash pool by key name                             
///=============================================================================
void GHPSetVector(string key, Vector3 data)
{
   int i,idx;
   string buffer;
   string ghdata = key + ","+data.x+","+data.y+","+data.z;
   idx = GHPFindKey(key);
   if(idx == -1) return;
   iGlobalStringSet(ghdata,idx);
}

///=============================================================================
///GHPSetQuat: Sets a quaternion to the global hash pool by key name                             
///=============================================================================
void GHPSetQuat(string key, Quaternion data)
{
   int i,idx;
   string buffer;
   string ghdata = key + ","+data.x+","+data.y+","+data.z+","+data.w;
   idx = GHPFindKey(key);
   if(idx == -1) return;
   iGlobalStringSet(ghdata,idx);
}


///=============================================================================
///GHPGetInt: Gets an int from the global hash pool by key name                             
///=============================================================================
int GHPGetInt(string key)
{
   int i,idx;
   string []list;
   float num;
   string buffer;
   idx = GHPFindKey(key);
   if(idx == -1) return -1;
   iGlobalStringGet(buffer,idx);
   list = GHPSplit(buffer,",");
   if(list.length() > 1){
      num = iStringVal(list[1]);
      return num;
   }
   return -1;
}

///=============================================================================
///GHPGetFloat: Gets a float from the global hash pool by key name             
///=============================================================================
float GHPGetFloat(string key)
{
   int i,idx;
   string []list;
   float num;
   string buffer;
   idx = GHPFindKey(key);
   if(idx == -1) return -1;
   iGlobalStringGet(buffer,idx);
   list = GHPSplit(buffer,",");
   if(list.length() > 1){
      num = iStringVal(list[1]);
      return num;
   }
   return -1;
}

///=============================================================================
///GHPGetString: Gets a string from the global hash pool by key name             
///=============================================================================
string GHPGetString(string key)
{
   int i,idx;
   string []list;
   string buffer;
   idx = GHPFindKey(key);
   if(idx == -1) return -1;
   iGlobalStringGet(buffer,idx);
   list = GHPSplit(buffer,",");
   if(list.length() > 1){
      buffer = list[1];
      return buffer;
   }
   return "-1";
}

///=============================================================================
///GHPGetVector: Gets a vector from the global hash pool by key name             
///=============================================================================
Vector3 GHPGetVector(string key)
{
   int i,idx;
   string []list;
   string buffer;
   Vector3 v = Vector3(-1,-1,-1);
   idx = GHPFindKey(key);
   if(idx == -1) return v;
   iGlobalStringGet(buffer,idx);
   list = GHPSplit(buffer,",");
   if(list.length() > 3){
      v.x = iStringVal(list[1]);
      v.y = iStringVal(list[2]);
      v.z = iStringVal(list[3]);
      return v;
   }
   return v;
}

///=============================================================================
///GHPGetQuat: Gets a quaternion from the global hash pool by key name             
///=============================================================================
Quaternion GHPGetQuat(string key)
{
   int i,idx;
   string []list;
   string buffer;
   Quaternion q = Quaternion(-1,-1,-1,0);
   idx = GHPFindKey(key);
   if(idx == -1) return q;
   iGlobalStringGet(buffer,idx);
   list = GHPSplit(buffer,",");
   if(list.length() > 4){
      q.x = iStringVal(list[1]);
      q.y = iStringVal(list[2]);
      q.z = iStringVal(list[3]);
      q.w = iStringVal(list[4]);
      return q;
   }
   return q;
}

///=============================================================================
///END OF GLOBAL HASH POOL FUNCTIONS - Add your script below                 
///=============================================================================


int score;

void Main()
{
   if(iInitializing()){
      if(GHPLoad(".\\Filear32_30_9ma.mdb")){  //only if the file exists - do something
         score = GHPGetInt("score");  //get scorer from database
         OUT_0 = score;                //update the counter value
      }
   }

   if(iDeinitializing()){
      GHPSetInt("score",score);    //put score in database
      GHPSave(".\\Filear32_30_9ma.mdb");   //save database file
   }


  score = IN_0;   //put the score into the global variable
  OUT_44 = IN_0;  //show the score with the valueprint
}

And i made this script to show the gun depending of the ID Number loaded before:

Code: [Select]
void Main()
//ARMA ID 0, AR-18
{
      if (IN_22 == 0)
    {
       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 0 AR-18\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada SIN MIRA.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 0 AR-18\\dragon mission AR 18 fire.wav");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 0 AR-18\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 0 AR-18 MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 1, AK-47 PAQUETE ESTANDAR
      if (IN_22 == 1)
    {
       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 1 AK-47 PAQUETE ESTANDAR\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada SIN MIRA.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 1 AK-47 PAQUETE ESTANDAR\\rifle_fire_1.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 1 AK-47 PAQUETE ESTANDAR MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 2, AK-47 PAQUETE DE ASALTO
      if (IN_22 == 2)
    {
       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 2 AK-47 PAQUETE DE ASALTO\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada RED DOT.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 1 AK-47 PAQUETE ESTANDAR\\rifle_fire_1.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 2 AK-47 PAQUETE DE ASALTO MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 3, AK-47 PAQUETE PESADO
      if (IN_22 == 3)
    {
       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 3 AK-47 PAQUETE PESADO\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada EOTECH.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 1 AK-47 PAQUETE ESTANDAR\\rifle_fire_1.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 3 AK-47 PAQUETE PESADO MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 4, AK-47 PAQUETE TACTICO
      if (IN_22 == 4)
    {

       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 4 AK-47 PACK TACTICO 1\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada EOTECH.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 4 AK-47 PACK TACTICO 1\\ak-47 disparo silenciado.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 4 AK-47 PACK TACTICO 1 MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 5, G3 PAQUETE ESTANDAR
      if (IN_22 == 5)
    {

       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 5 G3 PAQUETE ESTANDAR\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada SIN MIRA.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 5 G3 PAQUETE ESTANDAR\\g3sg1-1.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 5 G3 PAQUETE ESTANDAR MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 6, G3 PAQUETE DE ASALTO
      if (IN_22 == 6)
    {

       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 6 G3 PAQUETE DE ASALTO\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada EOTECH 3.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 5 G3 PAQUETE ESTANDAR\\g3sg1-1.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 5 G3 PAQUETE ESTANDAR MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 7, G3 PAQUETE PESADO
      if (IN_22 == 7)
    {

       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 7 G3 PAQUETE PESADO\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada RED DOT.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 5 G3 PAQUETE ESTANDAR\\g3sg1-1.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 6 G3 PAQUETE DE ASALTO MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
//ARMA ID 8, G3 PAQUETE TACTICO
      if (IN_22 == 8)
    {

       //Refresh the room SkinMesh to load the new .x file
      iObjectRefresh(OBJ_44,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 8 G3 PAQUETE TACTICO\\000_mesh.x");
      iObjectRefresh(OBJ_66,".\\3DRad_res\\objects\\Sprite\\data\\Bala dorada EOTECH.png");
      iObjectRefresh(OBJ_88,".\\3DRad_res\\objects\\Skinmesh\\data\\Bala Dorada ARMAS ID 8 G3 PAQUETE TACTICO\\g3sg1-1 silencer.ogg");
      iObjectRefresh(OBJ_110,".\\3DRad_res\\objects\\SoundSource\\data\\dragon mission ARMAS ID 0 AR-18 RECARGA.ogg");
      iObjectRefresh(OBJ_132,".\\3DRad_res\\objects\\SkinMesh\\data\\Bala Dorada ARMAS ID 8 G3 PAQUETE TACTICO MUZZLEFLASH\\000_mesh.x");
      iScriptStop();
    }
}

So basically that is what i made for now i will put more progress later ;)
« Last Edit: December 30, 2013, 01:31:41 AM by Facujk101 »
See my web:
« Reply #1 on: December 30, 2013, 10:28:35 PM »
More progress, the menu. Its almost done, i need make some buttons and some eventoninputs, but the idea is this:

I use the same buttons on the past project:



But i changed the background look, i now use a white room and the gun of the player:


This is the AR-18 Standard Package, is the first gun of the player.

Here some work on AKs:

AK-47 Standard Package: Long cannon, Metal sight




AK-47 Assault Package: Short cannon, Red Dot Sight:




AK-47 Heavy Package: Long cannon, EOTech Sight, 75 Rounds Drum Magazine:




AK-47 Tactic Package: Long cannon supressed, Hybrid Sight (Aimpoint and EOTech, long scoping) Double 30 rounds magazine (more faster reload).


See my web:
« Reply #2 on: December 31, 2013, 04:34:14 AM »
Nice to see that youre back on your project! :) Happy new and hopefully productive year! :)
« Reply #3 on: December 31, 2013, 10:26:27 AM »
yeah... good to see this project back on track...

honestly, the top menu with the buildings looks better...  unless, that is, you're changing the entire look and feel of the game...

--Mike
« Reply #4 on: December 31, 2013, 04:45:00 PM »
Thanks!, this project is the most ambitious im working on, so it will be very hard to do.

Yeah, i was thinking the same about the background but for now i will keep this because im testing the gun system so i need look only the gun :D. I hope the best for you and everyone for this new year :)
See my web:
« Reply #5 on: January 14, 2014, 12:51:43 AM »
A lot of progress!!. I made 3 videos about the new progress, but they are in spanish. I will show you some pictures of the new look of the map and the videos of the game if you wanna see them.

Here some screenshots of the map:



















And here the videos:

The first:
http://www.youtube.com/watch?v=ZCDUcFyWq3w&list=PLSuUSrar0yDnaUYeD6gM_PiuInd_kfWUI&index=2

The second:
http://www.youtube.com/watch?v=otU3-F5ST5A&list=PLSuUSrar0yDnaUYeD6gM_PiuInd_kfWUI&index=1

The last:
http://www.youtube.com/watch?v=PABJr6Wva_k&list=PLSuUSrar0yDnaUYeD6gM_PiuInd_kfWUI&index=3


If you can understand something, i hope you like it ;D
See my web:
« Reply #6 on: January 14, 2014, 02:17:36 PM »
I have one question. Why are you making it in the "lego" style?
« Reply #7 on: January 14, 2014, 04:15:00 PM »
I have one question. Why are you making it in the "lego" style?
Because its more easy for me to make the gun models, and the player models, also i can make the animations
See my web:
Pages: [1]