Game Development Team(s)

Talk about making games.

Re: Game Development Team(s)

Postby EvanBlack » Sun Oct 16, 2011 8:52 pm

You mean the images? Sure yeah that would be great! Right now they are just place holders. What I would like is a compiled list of each tiles name, description, use, so on.

Tiles are used like:

ACTOR NAME: ISO_FloorTile

Animation Names: Tile# , the number starts at 0 and goes up: 1, 2, 3, 4, .... 10, 20, 30... . 255 and up for now are considered unwalkable tiles. These are tiles that cannot be stepped on such as lava, water, walls, and other obstacles.


So the when listing the tiles should be like

Tile 255
Tile Name: Water
Notes: It's wet.

Tile256
Tile Name: Lava
Notes: Its hot.

Tile257
Tile Name: Acid
Notes: Very Acidy...


Try to name the images: Tile# , that way when adding them we just click add multiple files and boom they are all in.



The more generic the easy it will be to put it all together.

({Clean Copy))
Also anyone interested in the new global script:

Code: Select all
//Structures
struct WorldNode;
struct Tile;
struct Object;
struct Creature;

typedef struct WorldNode{
    double wn_GameX;
    double wn_GameY;
    int wn_NodeX;
    int wn_NodeY;
    int wn_NodeID;
    struct Tile *wn_pTile;
    struct FloatingTile *wn_pFTile;
    struct Creature *wn_pCreature;
    struct Object *wn_pObject;
    struct WorldNode *wn_pPrevYNode;
    struct WorldNode *wn_pNextYNode;
    struct WorldNode *wn_pPrevXNode;
    struct WorldNode *wn_pNextXNode;
}WorldNode;

typedef struct Tile{
    int t_Anim;
    int t_Unique;
    char t_CloneName[32];
    char t_Name[27];
    struct WorldNode* t_pWorldNode;
    struct Tile *t_pPrevY;
    struct Tile *t_pNextY;
    struct Tile *t_pPrevX;
    struct Tile *t_pNextX;
}Tile;


typedef struct FloatingTile{
    int ft_Unique;
    int ft_Anim;
    char ft_CloneName[32];
    char ft_Name[27];
    WorldNode* ft_pWorldNode;
}FloatingTile;
 
typedef struct Object{
    int o_Anim;
    char o_CloneName[32];
    char o_Name[27];
    WorldNode* o_pWorldNode;
    } Object;

typedef struct Creature{
    int cr_Anim;
    char cr_CloneName[32];
    char cr_Name[27];
    WorldNode* cr_pWorldNode;
    } Creature;



//IF YOU CHANGE MAPSIZE[] THEN YOU HAVE TO CHANGE cMAPSIZE TO EQUAL THAT AMOUNT IN TILES
//ALSO YOU HAVE TO EDIT YOUR MAP!!
const int g_SQVIEWMAPWIDTH = 5;
const int g_SQVIEWMAPHEIGHT = 5;
const int g_ISOVIEWMAPWIDTH = 35;
const int g_ISOVIEWMAPHEIGHT = 35;
const int g_SQTILESIZE[2] = {100, 100};
const int g_ISOTILESIZE[2] = {64, 32}; //size of each tile. W x H
const int g_UNREACHABLETILE = 255; //The start of the unwalkable tile animation

int g_MapHeight = 0;
int g_MapWidth = 0;
int g_MapSize = 0; //Amount of tiles to be created

int g_Move[4];


//2D Pointer Arrays for Structures
WorldNode *** g_WorldNodeList;
Tile *** g_TileList;


//2D array
int ** g_Map;

Tile *g_FirstTile, *g_LastTile;
Creature * g_Player;



//MISC variables
int g_TileClicked;
int g_Saved = 0;
int g_TextCloneCount = 0;
int g_ToggleGUI = 1;
int g_ToggleTP = 0;
int g_ToggleOP = 0;
int g_CurrentSelectedTile = 0;
int g_CurrentSelectedObject = 0;
int g_setTile = 0;



//Function Declarations
//MOVE VIEW
void MoveFloorRight(int VIEW_MH, int VIEW_MW);
void MoveFloorLeft(int VIEW_MH, int VIEW_MW);
void MoveFloorDown(int VIEW_MH, int VIEW_MW);
void MoveFloorUp(int VIEW_MH, int VIEW_MW);

//MAP CREATION
void CreateMap();
void CreateMapIso();
int GenerateMap(int VIEW_MH, int VIEW_MW);
void initalizeTile(Tile *pTile);
void initalizeWorldNode(WorldNode *pWorldNode);
void LinkWorldNodes();
void LinkTiles(int VIEW_MH, int VIEW_MW);

//MAP SCROLLING
void MoveTileToWorldNode(Tile *pTile, WorldNode *pWorldNode);
void UpdateTileActor(Tile* pTile);
void MovePlayerDown();
void MovePlayerUp();
void MovePlayerRight();
void MovePlayerLeft();
void LinkTile(Tile * pTile);



//MISC
int GetNodeIDFromXY(int x, int y);
int GetAIIDFromNode(int tID);
int GetAIIDFromXY(int x, int y);
void UpdateText(char string[40], int i);
void FreeMemory(int VIEW_MH, int VIEW_MW);
void PlaceTile(Actor* pTile, int nodeY,int nodeX);
Actor* getTileByNode(int node);
void MoveTileToArray(Actor* myActor);




//This is all the game data variables.



///////////////////////////////////////////////////////////////////////////////////////////////
//ALL FUNCTIONS BELOW

///////////////////////////////////////////////////////////////////////////////////////////////

void CreateMapIso()
{
 int mh=0;
 int mw=0;
 int tX = 0;
 int tY = 0;
 int tNum = 0;
 int tH = g_ISOTILESIZE[1];
 int tW = g_ISOTILESIZE[0];
 char tAnim[10];
 Actor* myActor = 0;

 g_FirstTile = g_TileList[0][0];
 g_LastTile = g_TileList[g_ISOVIEWMAPHEIGHT-1][g_ISOVIEWMAPWIDTH-1];


for(mh = 0; mh < g_MapHeight; ++mh)
 {
    for(mw = 0; mw < g_MapWidth; ++mw)
    {
 
        tX = (tW/2 * mw)+ tW + (tW/2 * mh);
        tY = (tH/2 * mh)-(tH/2 * mw);
 
        g_WorldNodeList[mh][mw]->wn_GameX = tX;
        g_WorldNodeList[mh][mw]->wn_GameY = tY;
        g_WorldNodeList[mh][mw]->wn_NodeX = mw;
        g_WorldNodeList[mh][mw]->wn_NodeY = mh;
        g_WorldNodeList[mh][mw]->wn_NodeID = tNum;
        tNum = tNum +1;
 
    }
 }

 for(mh = 0; mh < g_ISOVIEWMAPHEIGHT; ++mh)
 {
     for(mw = 0; mw < g_ISOVIEWMAPWIDTH; ++mw)
     {
 
         tX = (tW/2 * mw)+ tW + (tW/2 * mh);
         tY = (tH/2 * mh)-(tH/2 * mw);
 
 
         sprintf(tAnim, "tile%i", g_Map[mh][mw]);
         myActor = CreateActor("ISO_FloorTile", tAnim, "no parent", "no path", tX, tY, true);
         strcpy(g_TileList[mh][mw]->t_Name, myActor->name);
         strcpy(g_TileList[mh][mw]->t_CloneName, myActor->clonename);
         g_TileList[mh][mw]->t_Anim = g_Map[mh][mw];
         g_TileList[mh][mw]->t_pWorldNode = g_WorldNodeList[mh][mw];
         g_WorldNodeList[mh][mw]->wn_pTile = g_TileList[mh][mw];
         UpdateTileActor(g_TileList[mh][mw]);
 
     }
 }
 LinkWorldNodes();
 LinkTiles(g_ISOVIEWMAPHEIGHT, g_ISOVIEWMAPWIDTH);


  myActor = CreateActor("MiddlePoint", "Pointer", "no parent", "no path", 0, 0, true);
  strcpy(g_Player->cr_CloneName, myActor->clonename);
  g_Player->cr_pWorldNode = g_WorldNodeList[g_ISOVIEWMAPHEIGHT/2][g_ISOVIEWMAPWIDTH/2];
  myActor->x = g_Player->cr_pWorldNode->wn_GameX;
  myActor->y = g_Player->cr_pWorldNode->wn_GameY -50;
 
  //ChangeParent("view", "MiddlePoint");
}


////////////////////////////////////////////////////////////////////////////////////////////////////

void MoveFloorRight(int VIEW_MH, int VIEW_MW)
{
    Tile *pTile = g_FirstTile;
    Tile *tempTile;
    int x;
    int y;
    int count = 0;
 
    g_FirstTile = pTile->t_pNextX;
 
    while(pTile != NULL)
    {
        tempTile = pTile->t_pNextY;
        y = pTile->t_pWorldNode->wn_NodeY;
        x = pTile->t_pWorldNode->wn_NodeX+VIEW_MW;
        MoveTileToWorldNode(pTile, g_WorldNodeList[y][x]);
 
        UpdateTileActor(pTile);
        if(tempTile == NULL)
        {
            g_LastTile = pTile;
        }
        pTile = tempTile;
    }
 
    pTile = g_LastTile;
 
    while(pTile != NULL)
    {
        LinkTile(pTile);
        pTile = pTile->t_pPrevY;
    }
 
}


void MoveFloorLeft(int VIEW_MH, int VIEW_MW)
{
    Tile *pTile = g_LastTile;
    Tile *tempTile;
    int x;
    int y;
 
    g_LastTile = pTile->t_pPrevX;
 
    while(pTile != NULL)
    {
        tempTile = pTile->t_pPrevY;
        y = pTile->t_pWorldNode->wn_NodeY;
        x = pTile->t_pWorldNode->wn_NodeX-VIEW_MW;
        MoveTileToWorldNode(pTile, g_WorldNodeList[y][x]);
 
        UpdateTileActor(pTile);
        if(tempTile == NULL)
        {
            g_FirstTile = pTile;
        }
        pTile = tempTile;
    }
 
    pTile = g_FirstTile;
 
    while(pTile != NULL)
    {
        LinkTile(pTile);
        pTile = pTile->t_pNextY;
    }
 
 
}


void MoveFloorDown(int VIEW_MH, int VIEW_MW)
{
    Tile *pTile = g_FirstTile;
    Tile *tempTile;
    int x;
    int y;
 
    g_FirstTile = pTile->t_pNextY;
 
    while(pTile != NULL)
    {
        tempTile = pTile->t_pNextX;
        y = pTile->t_pWorldNode->wn_NodeY+VIEW_MH;
        x = pTile->t_pWorldNode->wn_NodeX;
        MoveTileToWorldNode(pTile, g_WorldNodeList[y][x]);
 
        UpdateTileActor(pTile);
        if(tempTile == NULL)
        {
            g_LastTile = pTile;
        }
        pTile = tempTile;
    }
 
    pTile = g_LastTile;
 
    while(pTile != NULL)
    {
        LinkTile(pTile);
        pTile = pTile->t_pPrevX;
    }
 
}


void MoveFloorUp(int VIEW_MH, int VIEW_MW)
{
    Tile *pTile = g_LastTile;
    Tile *tempTile;
    int x;
    int y;
 
    g_LastTile = pTile->t_pPrevY;
 
    while(pTile != NULL)
    {
        tempTile = pTile->t_pPrevX;
        y = pTile->t_pWorldNode->wn_NodeY-VIEW_MH;
        x = pTile->t_pWorldNode->wn_NodeX;
        MoveTileToWorldNode(pTile, g_WorldNodeList[y][x]);
 
        UpdateTileActor(pTile);
        if(tempTile == NULL)
        {
            g_FirstTile = pTile;
        }
        pTile = tempTile;
    }
 
    pTile = g_FirstTile;
 
    while(pTile != NULL)
    {
        LinkTile(pTile);
        pTile = pTile->t_pNextX;
    }
 
}
////////////////////////////////////////////////////////////////////////////////////////////////////
int GenerateMap(int VIEW_MH, int VIEW_MW)
{
    int i;
    int a;
 
    if(!g_MapHeight || !g_MapWidth || g_MapSize)
    {
        return 1;
    }
    g_MapSize = g_MapHeight * g_MapWidth;
 
 
    //Allocate memory for 2D array g_Map
    g_Map = malloc(g_MapHeight * sizeof(int *));
      if(g_Map == NULL)
        {
       UpdateText("ERROR: OUT OF MEMORY", 0);
       g_MapSize = 0;
           return 1;
      }
      for(i = 0; i < g_MapHeight; i++)
        {
            g_Map[i] = malloc(g_MapWidth * sizeof(int));
            if(g_Map[i] == NULL)
              {
            UpdateText("ERROR: OUT OF MEMORY", 0);
            g_MapSize = 0;
            return 1;
              }
        }


    //Allocate memory for 2D array g_WorldNodeList
    g_WorldNodeList = malloc(g_MapHeight * sizeof(WorldNode **));
      if(g_WorldNodeList == NULL)
        {
       UpdateText("ERROR: OUT OF MEMORY", 0);
           return 1;
      }
      for(i = 0; i < g_MapHeight; i++)
        {
            g_WorldNodeList[i] = malloc(g_MapWidth * sizeof(WorldNode*));
            if(g_WorldNodeList[i] == NULL)
              {
            UpdateText("ERROR: OUT OF MEMORY", 0);
            return 1;
              }
 
        }
    for(i = 0; i < g_MapHeight; i++)
        {
        for(a = 0; a < g_MapWidth; a++)
            {
                g_WorldNodeList[i][a] = (WorldNode *)malloc(sizeof(WorldNode));
                if(g_WorldNodeList[i][a] == NULL)
                  {
                UpdateText("ERROR: OUT OF MEMORY", 0);
                return 1;
                  }
            initalizeWorldNode(g_WorldNodeList[i][a]);
            }
    }


    //Allocate memory for 2D array g_TileList
    g_TileList = malloc(VIEW_MH * sizeof(Tile **));
      if(g_TileList == NULL)
        {
       UpdateText("ERROR: OUT OF MEMORY", 0);
           return 1;
      }
      for(i = 0; i < VIEW_MH; i++)
        {
            g_TileList[i] = malloc(VIEW_MW * sizeof(Tile*));
            if(g_TileList[i] == NULL)
              {
            UpdateText("ERROR: OUT OF MEMORY", 0);
            return 1;
              }
        }
    for(i = 0; i < VIEW_MH; i++)
        {
        for(a = 0; a < VIEW_MW; a++)
            {
                g_TileList[i][a] = (Tile *)malloc(sizeof(Tile));
                if(g_TileList[i][a] == NULL)
                  {
                UpdateText("ERROR: OUT OF MEMORY", 0);
                return 1;
                  }
            initalizeTile(g_TileList[i][a]);
            }
    }



    g_Player = (Creature *)malloc(sizeof(Creature));
    LinkWorldNodes();
    LinkTiles(VIEW_MH, VIEW_MW);
    UpdateText("GENERATED MAP, NUMBER OF TILES:", g_MapSize);
 
    return 0; //If failed return 1; If completed return 0;
}


void FreeMemory(int VIEW_MH, int VIEW_MW)
{
    int i;
    int a;
    for(i = 0; i < g_MapHeight; i++)
    {
        free(g_Map[i]);
    }
 
    for(i = 0; i < g_MapHeight; i++)
    {
        for(a = 0; a < g_MapWidth; a++)
        {
            free(g_WorldNodeList[i][a]);
        }
        free(g_WorldNodeList[i]);
    }
 
    for(i = 0; i < VIEW_MH; i++)
    {
        for(a = 0; a < VIEW_MW; a++)
        {
            free(g_TileList[i][a]);
        }
        free(g_TileList[i]);
    }
    free(g_Player);
    free(g_TileList);
    free(g_WorldNodeList);
    free(g_Map);
    UpdateText("Memory Freed", 0);
 
}
////////////////////////////////////////////////////////////////////////////////////////////////////

void UpdateText(char string[40], int i)
{
    Actor* NewText;
    Actor* OldText;
    char buffer[20];
    sprintf(buffer, "UPDATESTATUSTEXT.%i", g_TextCloneCount);
    OldText = getclone(buffer);
    ++g_TextCloneCount;
    NewText = CreateActor("UPDATESTATUSTEXT", "", "view", "no path", OldText->x, OldText->y+15, false);
 
    if(!i)
    {
        strcpy(NewText->text, string);
    }
    else
    {
        sprintf(NewText->text, "%s %i", string, i);
    }
 
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void PlaceTile(Actor* pTile, int nodeY,int nodeX)
{
    char tAnim[20];
    sprintf(tAnim, "tile%i", g_CurrentSelectedTile );
    ChangeAnimation(pTile->clonename,tAnim,NO_CHANGE);
    if(nodeY != -1){ g_Map[nodeY][nodeX] = g_CurrentSelectedTile; }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void initalizeTile(Tile *pTile)
{
    pTile->t_Anim = 0;
    pTile->t_Unique = 0;
    strcpy(pTile->t_CloneName,"\0");
    strcpy(pTile->t_Name, "\0");
    pTile->t_pWorldNode = NULL;
    pTile->t_pPrevY = NULL;
    pTile->t_pNextY = NULL;
    pTile->t_pPrevX = NULL;
    pTile->t_pNextX = NULL;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
void initalizeWorldNode(WorldNode *pWorldNode)
{
    pWorldNode->wn_GameX = 0;
    pWorldNode->wn_GameY = 0;
    pWorldNode->wn_NodeX = 0;
    pWorldNode->wn_NodeY = 0;
    pWorldNode->wn_NodeID = 0;
    pWorldNode->wn_pTile = NULL;
    pWorldNode->wn_pFTile = NULL;
    pWorldNode->wn_pCreature = NULL;
    pWorldNode->wn_pObject = NULL;
    pWorldNode->wn_pPrevYNode = NULL;
    pWorldNode->wn_pNextYNode = NULL;
    pWorldNode->wn_pPrevXNode = NULL;
    pWorldNode->wn_pNextXNode = NULL;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
void UpdateTileActor(Tile* pTile)
{
    char tAnim[10];
    Actor* pActor = getclone(pTile->t_CloneName);
    pActor->x = pTile->t_pWorldNode->wn_GameX;
    pActor->y = pTile->t_pWorldNode->wn_GameY;
    pActor->a_nX = pTile->t_pWorldNode->wn_NodeX;
    pActor->a_nY = pTile->t_pWorldNode->wn_NodeY;
    pActor->a_nID = pTile->t_pWorldNode->wn_NodeID;
    sprintf(tAnim, "tile%i", pTile->t_Anim);
    ChangeAnimation(pActor->clonename,tAnim,NO_CHANGE);
 
}

////////////////////////////////////////////////////////////////////////////////////////////////////
void LinkWorldNodes()
{
    int h;
    int w;

    //WorldNodeList[Y][X]
 

    for(h = 0; h < (g_MapHeight); h++)
    {
        for(w = 0; w < (g_MapWidth); w++)
        {
            if(h == 0)
            {
                g_WorldNodeList[h][w]->wn_pPrevYNode = NULL;
            }
            else
            {
                g_WorldNodeList[h][w]->wn_pPrevYNode = g_WorldNodeList[h-1][w];
            }
            if(h == g_MapHeight-1)
            {
                g_WorldNodeList[h][w]->wn_pNextYNode = NULL;
            }
            else
            {
                g_WorldNodeList[h][w]->wn_pNextYNode = g_WorldNodeList[h+1][w];
            }
            if(w == 0)
            {
                g_WorldNodeList[h][w]->wn_pPrevXNode = NULL;
            }
            else
            {
                g_WorldNodeList[h][w]->wn_pPrevXNode = g_WorldNodeList[h][w-1];
            }
            if(w == g_MapWidth-1)
            {
                g_WorldNodeList[h][w]->wn_pNextXNode = NULL;
            }
            else
            {
                g_WorldNodeList[h][w]->wn_pNextXNode = g_WorldNodeList[h][w+1];
            }
 
        }
    }
É
}
////////////////////////////////////////////////////////////////////////////////////////////////////

void LinkTiles(int VIEW_MH, int VIEW_MW)
{
    int h;
    int w;

    //TileList[Y][X]
 

    for(h = 0; h < (VIEW_MH); h++)
    {
        for(w = 0; w < (VIEW_MW); w++)
        {
            if(h == 0)
            {
                g_TileList[h][w]->t_pPrevY = NULL;
            }
            else
            {
                g_TileList[h][w]->t_pPrevY = g_TileList[h-1][w];
            }
            if(h == VIEW_MH-1)
            {
                g_TileList[h][w]->t_pNextY = NULL;
            }
            else
            {
                g_TileList[h][w]->t_pNextY = g_TileList[h+1][w];
            }
            if(w == 0)
            {
                g_TileList[h][w]->t_pPrevX = NULL;
            }
            else
            {
                g_TileList[h][w]->t_pPrevX = g_TileList[h][w-1];
            }
            if(w == VIEW_MW-1)
            {
                g_TileList[h][w]->t_pNextX = NULL;
            }
            else
            {
                g_TileList[h][w]->t_pNextX = g_TileList[h][w+1];
            }
 
 
        }
    }
 
}

////////////////////////////////////////////////////////////////////////////////////////////////////
void MoveTileToWorldNode(Tile *pTile, WorldNode *pWorldNode)
{
    //Link Top and bottom Tiles together
    if(pTile->t_pPrevY == NULL)  // If the back tile doesn't exist
 
    {   if(pTile->t_pNextY != NULL) // If the front tile Exists.
 
          {    pTile->t_pNextY->t_pPrevY = NULL; }  // The front tile's back Tile is NULL
 
        //else do nothing
    }
 
    else // If the Back Tile Exists
 
    {   if(pTile->t_pNextY == NULL) //If the Front Tile Doesn't Exist
 
        {    pTile->t_pPrevY->t_pNextY = NULL; } // The back Tile's Front Tile is Null
 
        else //If both Back and Front Tiles Exist
        {
            pTile->t_pPrevY->t_pNextY = pTile->t_pNextY; // The back tile points to the front tile
            pTile->t_pNextY->t_pPrevY = pTile->t_pPrevY; // The front tile points to the back tile
        }
    }
 
 
 
    //Link Back and Front Tiles Together
    if(pTile->t_pPrevX == NULL)
    {   if(pTile->t_pNextX != NULL)
          {    pTile->t_pNextX->t_pPrevX = NULL; }
 
        //else do nothing
    }
 
    else
    {   if(pTile->t_pNextX == NULL)
           {    pTile->t_pPrevX->t_pNextX = NULL; }
        else
        {
            pTile->t_pPrevX->t_pNextX = pTile->t_pNextX;
            pTile->t_pNextX->t_pPrevX = pTile->t_pPrevX;
        }
    }
 
    //Unlink Tile from current WorldNode
    pTile->t_pWorldNode->wn_pTile = NULL;
 
    //Link the Tile to the new World Node
    pTile->t_pWorldNode = pWorldNode;
    pWorldNode->wn_pTile = pTile;
 
    //Set the animation value
    pTile->t_Anim = g_Map[pWorldNode->wn_NodeY][pWorldNode->wn_NodeX];
 

}

////////////////////////////////////////////////////////////////////////////////////////////////////
void MovePlayerDown()
{
    Actor* pActor = getclone(g_Player->cr_CloneName);
    g_Player->cr_pWorldNode = g_Player->cr_pWorldNode->wn_pNextYNode;
    pActor->x = g_Player->cr_pWorldNode->wn_GameX;
    pActor->y = g_Player->cr_pWorldNode->wn_GameY - 50;
}

void MovePlayerUp()
{
    Actor* pActor = getclone(g_Player->cr_CloneName);
    g_Player->cr_pWorldNode = g_Player->cr_pWorldNode->wn_pPrevYNode;
    pActor->x = g_Player->cr_pWorldNode->wn_GameX;
    pActor->y = g_Player->cr_pWorldNode->wn_GameY - 50;
}

void MovePlayerRight()
{
    Actor* pActor = getclone(g_Player->cr_CloneName);
    g_Player->cr_pWorldNode = g_Player->cr_pWorldNode->wn_pNextXNode;
    pActor->x = g_Player->cr_pWorldNode->wn_GameX;
    pActor->y = g_Player->cr_pWorldNode->wn_GameY - 50;
}

void MovePlayerLeft()
{
    Actor* pActor = getclone(g_Player->cr_CloneName);
    g_Player->cr_pWorldNode = g_Player->cr_pWorldNode->wn_pPrevXNode;
    pActor->x = g_Player->cr_pWorldNode->wn_GameX;
    pActor->y = g_Player->cr_pWorldNode->wn_GameY - 50;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
void LinkTile(Tile * pTile)
{
    WorldNode * pWorldNode = pTile->t_pWorldNode;
 
    if(pWorldNode->wn_pNextXNode != NULL)
    {
        if(pWorldNode->wn_pNextXNode->wn_pTile != NULL)
        {
            pTile->t_pNextX = pWorldNode->wn_pNextXNode->wn_pTile;
            pWorldNode->wn_pNextXNode->wn_pTile->t_pPrevX = pTile;
        }
        else
        {
            pTile->t_pNextX = NULL;
 
        }
    }
    else
    {
        pTile->t_pNextX = NULL;
 
    }
 
    if(pWorldNode->wn_pPrevXNode != NULL)
    {
        if(pWorldNode->wn_pPrevXNode->wn_pTile != NULL)
        {
            pTile->t_pPrevX = pWorldNode->wn_pPrevXNode->wn_pTile;
            pWorldNode->wn_pPrevXNode->wn_pTile->t_pNextX = pTile;
        }
        else
        {
            pTile->t_pPrevX = NULL;
 
        }
    }
    else
    {
        pTile->t_pPrevX = NULL;
 
    }
 
    if(pWorldNode->wn_pNextYNode != NULL)
    {
        if(pWorldNode->wn_pNextYNode->wn_pTile != NULL)
        {
            pTile->t_pNextY = pWorldNode->wn_pNextYNode->wn_pTile;
            pWorldNode->wn_pNextYNode->wn_pTile->t_pPrevY = pTile;
        }
        else
        {
            pTile->t_pNextY = NULL;
 
        }
    }
    else
    {
        pTile->t_pNextY = NULL;
    }
 
    if(pWorldNode->wn_pPrevYNode != NULL)
    {
        if(pWorldNode->wn_pPrevYNode->wn_pTile != NULL)
        {
            pTile->t_pPrevY = pWorldNode->wn_pPrevYNode->wn_pTile;
            pWorldNode->wn_pPrevYNode->wn_pTile->t_pNextY = pTile;
        }
        else
        {
            pTile->t_pPrevY = NULL;
 
        }
    }
    else
    {
        pTile->t_pPrevY = NULL;
 
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////

void InitGame()
{
 
}

////////////////////////////////////////////////////////////////////////////////////////////////////



//CREATED BY EVAN BLACK, 2011
// www.game-editor.com/forum  USERNAME: EVANBLACK


Note: THE CODE ABOVE WORKS

I am trying to phase out the old arrays for linked lists and that means creating new functions to handle the lists and to move the tiles.

One of the issue I was trying to figure out was how to move the tiles across and I just figured it out. By having a pointer at the beginning and end of the tile list I can access the top left and bottom right corners. It seems natural enough that I would do that but I didn't think that by doing that I could have linear access to both sides without having conflicts at the corners, but I do. So I am going to get to work on doing that right away and quickly phasing out the old method which required more functions and more arrays.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: Game Development Team(s)

Postby EvanBlack » Mon Oct 17, 2011 11:13 pm

So I finished the linked list for the tiles with the Map Editor, the next step is to get the object lists working and linking it up. It should be a little easier now but there is still a lot of work to be done. Once the object list is finished its just a matter of using the nearly the same functions and stuff for the floating tile and creature list. Then figuring out how to save it all into one file.

Is there any way to port script into GE? Like making a second file script that can be used to dynamically insert content and functions into a game engine? I want to either add a quest editor to the map editor or make a new tool for quest scripts so that the game content can be updated.

The more tools we can produce to make game development faster, the easier and more professional quality our games can be.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: Game Development Team(s)

Postby Game A Gogo » Wed Oct 19, 2011 12:50 pm

I'm starting to learn a bit about linked list, but I still feel there's something escaping me from them.

With linked list I could successfully keep track of clone's right? Since clone index will end up having holes if you destroy an actor and create one afterwards.
I could use this for a mini-map probably! :) I'll probably try to implement this in my unfinished Space Traveler demo, so that all asteroids are accounted for in the mini map.

So should I be having structs that to points to next/previous and it's own asteroid or have a list inside an array that points to each asteroid with a function that keeps it clean?

Also I think my involvement will be lesser than I'd like it to be since I have to take care of things in college, I don't understand why I have to learn social skills to program! XD
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Game Development Team(s)

Postby EvanBlack » Wed Oct 19, 2011 3:32 pm

My new version of the map editor gives all the details you want to know about handling clones with a linked list.

But the beauty of a linked list is that you don't have to handle the clones because the list does it for you. You just put a pointer to the Actor created in your struct. Then when you destroy the actor you NULL the pointer.

Structs can be reused in cases where you are just destroying actors as well. You just need to reset the values of the struct and give it a new actor.

In my map editor, I only use enough structs to handle the positions on the map. If I want a new position for a tree, I just create a new struct and have my world node point to it. Then use functions to assign the struct an actor every time it comes into view.

Also, I never create/destroy any actors except for in the beginning when I am creating a fresh map. I use a stack of tree actors that I cycle through, I could have as many as 300 tree structs but only use 25 actors and you will still see every tree placed, (unless you place more then 25 trees per 35x35 tile area.) If you do manage to go over the amount of trees on the stack then you could use create/destroy to create a new actor when the stack is empty and destroy a new actor when the stack is full. (which I will implement in the map maker) cloneindexs are never stored or a problem.

The only use of an array with a linked list would be if your linked list doesn't have a linear structure and you need to access all the list elements in one run through. I also use an array of pointers to the list elements so that they can be initialized to 0 and I can free all the elements when the game ends.

If you study my code, I try to keep everything sorted, then you can see how everything works and interacts.

The easiest linked list example I have is this one:
viewtopic.php?f=1&t=11159&p=77564&hilit=Linked+List#p77564

But as I said, with linked lists you never have to really know the clone index, you just store a pointer directly to the Actor you want it to handle.

Basically, you could recreate the entire Actor struct and add a pointer to the next recreated Actor struct and just have the Actor variables point to your structs. So any time you move a struct, your actor move the same. You can also create functions to handle zDepth based on x/y positions, which is another thing I will be implementing for the map editor.

You are only limited by what you imagine you can do and the limitations of your hardware. Just be creative and think about the answer to your problem before you think about the problem itself.


Example:

Idea:
Make scaling and rotation possible in gE without the use of extra animations.

Answer:
Use the canvas to draw the sprite at different angles and sizes.

Problem:
Create functions to do what I need in the answer.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: Game Development Team(s)

Postby HitoV » Wed Oct 26, 2011 12:59 am

Here's some music to inspire! :D

http://soundcloud.com/issacv
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: Game Development Team(s)

Postby Fojam » Tue Nov 01, 2011 11:19 pm

i have been working on a game im puting in the appstore probably a little before christmas, so heres a preview.
http://dl.dropbox.com/u/8500676/BombRain%20beta9.exe

i would love to be on the dev team, in fact ive been planning out making a iPhone version of super smash bros to put on cydia (since obviously theres copywrite issues so i cant put it in the appstore...). the only problem i've run into are computer players.

I would love to help or be helped!
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Previous

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest