PSP Hacks - Forums

Go Back   PSP Hacks - Forums > PSP Community > PSP Programming & Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2009, 10:30 PM
Gblo6689 Gblo6689 is offline
PSP Newbie
 

Join Date: Nov 2008
Location: Tampa, Florida, USA
Posts: 21
Gblo6689 Has a Beginner Reputation
Default Using Tiles in 2D Games

I was looking around the web looking for some tutorials on using tiles in games.
I realized that doing collision detection for semi-complicated walls in a 2D game would be a lot easier if I was using tiles rather than pixels. I haven't really found anything but tutorials for other languages than C that I only partially understand.
What I have found so far, is that to make the map I would declare a two dimensional array of the size I want the map to be. This would be to store the map variables. Pretty much this:
if (myArray[0][1]==0) {
walkable=0;}
(I know that's not exactly it but I'm pretty sure that you and I are getting the gist of what I mean from that snippet.)
My questions are: where do I go from here, how do I set the tile sizes, what is a good tile size for the psp screen.
If someone could advise me on these questions and/or point me in the direction of some good tutorials in C it would be great.
Reply With Quote
  #2  
Old 05-24-2009, 11:09 PM
roe-ur-boat roe-ur-boat is offline
Programmer
PSP Smarty
 

Join Date: Apr 2007
Location: Ireland
Posts: 192
roe-ur-boat Has a Beginner Reputation
Default

It would probably be a good idea to create a struct containing all the information a tile needs(e.g. walkable, position) then creating an array of this struct so you can use it like this:
Code:
typedef struct Tile {
	u8 walkable;
	u32 x, y;
} Tile;

Tile map[sizeX*sizeY] = {
	{1, 0,0},
	//etc...
};
Reply With Quote
  #3  
Old 05-25-2009, 03:25 AM
SG57's Avatar
SG57 SG57 is offline
Homebrew Idol 2 Winner
PSP Guru
 

Join Date: Apr 2007
Location: Washington
Posts: 1,607
SG57 is on a distinguished road
Default

Well if you're using C++ take advantage of the object-oriented aspect as what you are planning to do is a prime example of why it can be beneficiary. Something worth looking into, even if you arent using SDL the concept itself is there

http://lazyfoo.net/SDL_tutorials/lesson29/index.php

By using classes you can later subclass your 'Tile' class to create specialized tiles. The Tile baseclass could have a virtual function like 'OnPlayerEnter()' which could then be overriden by other classes to create traps that kill the player, teleporters that send the player across the map, or whatever.
__________________

...at what speed must I live.. to be able to see you again?...

Projects
Reply With Quote
  #4  
Old 05-25-2009, 09:22 PM
Gblo6689 Gblo6689 is offline
PSP Newbie
 

Join Date: Nov 2008
Location: Tampa, Florida, USA
Posts: 21
Gblo6689 Has a Beginner Reputation
Default

Quote:
Originally Posted by SG57 View Post
http://lazyfoo.net/SDL_tutorials/lesson29/index.php

By using classes you can later subclass your 'Tile' class to create specialized tiles. The Tile baseclass could have a virtual function like 'OnPlayerEnter()' which could then be overriden by other classes to create traps that kill the player, teleporters that send the player across the map, or whatever.
Thanks for that web site. I'm going to download SDL and work my way through the tutorials. They seem like they are full of really useful info. After that I'll come back to writing stuff in oslib for the PSP.
Reply With Quote
  #5  
Old 05-26-2009, 12:23 AM
SG57's Avatar
SG57 SG57 is offline
Homebrew Idol 2 Winner
PSP Guru
 

Join Date: Apr 2007
Location: Washington
Posts: 1,607
SG57 is on a distinguished road
Default

Gblo6689 - Nahh don't bother learning SDL just for the sake of using that tutorial.

Use Oslib to begin with SDL is clunky and ugly anyways if you ask me.. If you don't understand C++ classes and the scope of that tutorial is just over your head, I recommend doing whatever you want to begin with to gain experience. Programming something the 'wrong' way is a good step towards understanding and comprehending the programming concept and game programming theory. Soon as you get those two (it'll just 'click') you build on your understanding by introducing new techniques and means of optimization and efficiency, ie object-orientation (classes), polymorphism (virtual functions), inheritance, etc.
__________________

...at what speed must I live.. to be able to see you again?...

Projects
Reply With Quote
  #6  
Old 05-26-2009, 01:13 AM
dark_banana dark_banana is offline
PSP Neophyte
 

Join Date: May 2007
Posts: 79
dark_banana can only hope to improve
Default

Quote:
Originally Posted by SG57 View Post
Gblo6689 - Nahh don't bother learning SDL just for the sake of using that tutorial.

Use Oslib to begin with SDL is clunky and ugly anyways if you ask me.. If you don't understand C++ classes and the scope of that tutorial is just over your head, I recommend doing whatever you want to begin with to gain experience. Programming something the 'wrong' way is a good step towards understanding and comprehending the programming concept and game programming theory. Soon as you get those two (it'll just 'click') you build on your understanding by introducing new techniques and means of optimization and efficiency, ie object-orientation (classes), polymorphism (virtual functions), inheritance, etc.
Im working on this exact same thing currently and i wanted to use the oslib map thing but the converter provided was a dead link and i googled it and cant find it

But i have been working witht he image collision but no luck

so i decided 32x32 tiles
but what im trying to figure out is like

how do i find that program and make my entire map an array so i can have it move up in the array rather then move pixals and just display the array with certain values for different areas
Reply With Quote
  #7  
Old 05-26-2009, 01:34 AM
kronicali kronicali is offline
PSP Smarty
 

Join Date: Feb 2009
Posts: 113
kronicali will become famous soon enough
Default

Code:
#include <oslib/oslib.h>

#include <math.h>

#define BLANK_TILE 0
#define MAX_MAP_X 49
#define MAX_MAP_Y 29

#define TILE_SIZE 10




//Necessary to create eboot
PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);

//declaration of the pointers of our images
OSL_IMAGE *background,*A,*B,*C;


 
int move=1;


int tile[MAX_MAP_Y][MAX_MAP_X];

int MAPS=1;


 int Map1[28][49] =
 {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0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,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
{1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};


bool FghrCollision( float fighterposX, float fighterposY, float fighter2posX, float fighter2posY)
{
int collision,collide=0;
collision = 0;



fighterposY=B->y;
fighterposX=B->x;
fighter2posX=A->x;
fighter2posY=A->y;


float fighterwidth =16;
float fighterheight =16;
float fighter2width =32;
float fighter2height =32;





if ((fighterposX + fighterwidth > fighter2posX) &&
(fighterposX < fighter2posX + fighter2width) &&
(fighterposY + fighterheight > fighter2posY) &&
(fighterposY < fighter2posY + fighter2height))
{
collision = 1; collide=1;
}

return collision;
}



void drawMap()
{
    int x, y;

        
    /* Draw the map */

    for (y=0;y<MAX_MAP_Y;y++)
    {
        for (x=0;x<MAX_MAP_X;x++)
		{   
			
			if (Map1[y][x] != 0 && MAPS==1)
            {
                oslDrawImageXY(B, x * TILE_SIZE, y * TILE_SIZE);
              
			}

             if((FghrCollision( B->x , B->y, A->x, A->y )))oslPrintf_xy(10,90,"collided");

		}
	}

			

         
}

int main(int argc, char **argv)
{
	//Initialization of the Oslib library
	oslInit(0);

	//Initialization of the graphics mode
	oslInitGfx(OSL_PF_8888, 1);

	oslInitConsole();				//Text

	oslSetTransparentColor(RGB(255,0,255));
	
	//loads our images into memory
	A = oslLoadImageFile("A.png", OSL_IN_RAM, OSL_PF_5551);
	B = oslLoadImageFile("brick2.png", OSL_IN_RAM, OSL_PF_5551);
	C = oslLoadImageFile("C.png", OSL_IN_RAM, OSL_PF_5551);
	background = oslLoadImageFile("background.png", OSL_IN_RAM, OSL_PF_5551);
	

 
  
    
	//position
	A->x =100;
    A->y =150;
    
    C->x=250;
	C->y=120;


	 //main while loop
	while (!osl_quit)
	{
		//To be able to draw on the screen
		oslStartDrawing();

		//Clear the screen
		oslCls();

		//initiate the PSP's buttons
		oslReadKeys();
		oslDrawImage(background);
        oslDrawImage(C);
	    drawMap();
	    oslDrawImage(A);
      

         
		 
		 if(osl_keys->held.left) {
			 A->x-=1;

		 }

		 
   

	
		 if(osl_keys->held.right){
			 A->x+=1;

		 }

		  if(osl_keys->held.up) {
			 A->y-=1;

		 }

		 
   

	
		 if(osl_keys->held.down){
			 A->y+=1;

		 }

		//Ends drawing mode
		oslEndDrawing();

		//Synchronizes the screen
		oslSyncFrame();		
	}

	//Terminate the program
	oslEndGfx();
	oslQuit();
	return 0;
}
ok here is something i wrote awhile back for my game..its was just to test the map system..am not a very good programmer so maybe someone with more experience cud clean it up a bit an optimize it i think it works though, the collision part i did it differently in my game...cnt remember how exactly that source is on my pc(some where).hope it helps you guys understand
Reply With Quote
  #8  
Old 05-26-2009, 02:34 AM
Gblo6689 Gblo6689 is offline
PSP Newbie
 

Join Date: Nov 2008
Location: Tampa, Florida, USA
Posts: 21
Gblo6689 Has a Beginner Reputation
Default

Quote:
Originally Posted by SG57 View Post
Gblo6689 - Nahh don't bother learning SDL just for the sake of using that tutorial.

Use Oslib to begin with SDL is clunky and ugly anyways if you ask me.. If you don't understand C++ classes and the scope of that tutorial is just over your head, I recommend doing whatever you want to begin with to gain experience. Programming something the 'wrong' way is a good step towards understanding and comprehending the programming concept and game programming theory. Soon as you get those two (it'll just 'click') you build on your understanding by introducing new techniques and means of optimization and efficiency, ie object-orientation (classes), polymorphism (virtual functions), inheritance, etc.
Yeah, I'm actually going to college for Computer Science, I just haven't started my major yet, and I want to get a head start. I figured I would learn basic concepts on the PSP and eventually, once I started my coding classes, go to the PC. Either way, I'm going to end up doing both.
Though my real problem is how much I abhor making sprites.
Reply With Quote
  #9  
Old 06-11-2009, 11:13 AM
Gblo6689 Gblo6689 is offline
PSP Newbie
 

Join Date: Nov 2008
Location: Tampa, Florida, USA
Posts: 21
Gblo6689 Has a Beginner Reputation
Default More help needed

ok, so after tinkering with drawing the tiles and what not I decided to then put them in structures and advance the code a little. This of coarse led me to my current state. I keep receiving compiling errors and after a few days of trying to figure it out myself I put it to everyone here. Here is the code:

(The lines with the errors are marked above their respective lines. errors at bottom.)

struct square {
int Walkable;
} ;

struct World {
square Tile;
int yPos, xPos;
} stage[MAPWIDTH][MAPHEIGHT];


Line:96->
void DrawMap(){
int x,y;
for (y=0; y<MAP_HEIGHT; y++){
for (x=0; x<MAP_WIDTH; x++){
/*switch (stage[y][x]){
case 1:
oslSetImageTileSize(room_tileset, 0,0,16,16);
oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
stage[y][x].yPos=(y*TILE_HEIGHT);
stage[y][x].xPos=(x*TILE_WIDTH);
stage[y][x].Tile.Walkable=0;
break;
case 2:
oslSetImageTileSize(room_tileset, 16,0,16,16);
oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
stage[y][x].yPos=(y*TILE_HEIGHT);
stage[y][x].xPos=(x*TILE_WIDTH);
stage[y][x].Tile.Walkable=1;
break;
default:
oslDebug("Problem loading tiles to map");
break;
}*/
Line:119->
if (stage[y][x]==1){
oslSetImageTileSize(room_tileset, 0,0,16,16);
oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
stage[y][x].yPos=(y*TILE_HEIGHT);
stage[y][x].xPos=(x*TILE_WIDTH);
stage[y][x].Tile.Walkable=0;
}
Line:126->
if (stage[y][x]==2){
oslSetImageTileSize(room_tileset, 0,0,16,16);
oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
stage[y][x].yPos=(y*TILE_HEIGHT);
stage[y][x].xPos=(x*TILE_WIDTH);
stage[y][x].Tile.Walkable=0;
}
else {
oslDebug("Problem loading tiles to map");
}

void initializeMap(){
while (initialize==0){

Line:162->
stage [MAPHEIGHT][MAPWIDTH]={
{02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,02,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,0 1,01,01,01,01,01,01,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,01,02},
{02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,0 2,02,02,02,02,02,02,02,02}
};


DrawMap();
player->x=stage[1][1].xPos;
player->y=stage[1][1].yPos;
initialize=1;
};
Line:187->
}

119:error: no match for "operator==" in 'stage[y][x] == 1'
126:error: no match for "operator==" in 'stage[y][x] == 2'
162:error: expected primary expression before '{' token
162:error: expected ';' before '}' token
187:error: expected '}' at end of input
187:error: expected '}' at end of input

(also the switch that is in there for some reason will not work either but it did before. If anyone sees what would be wrong with that let me know also.)

(If anyone can tell me how to place my code in a scrolling box it would be appreciated.)
Reply With Quote
  #10  
Old 06-11-2009, 03:53 PM
dark_banana dark_banana is offline
PSP Neophyte
 

Join Date: May 2007
Posts: 79
dark_banana can only hope to improve
Default

Im not sure where you ment to close certain things but this should compile a bit less errored also not sure if the map should be like {01,02} but rather (01,02) but you know im not that good at c so =/

Code:
 
struct square {
int Walkable; 
}
struct World {
square Tile;
int yPos, xPos;
} 
stage[MAPWIDTH][MAPHEIGHT];
void DrawMap(){
int x,y;
for (y=0; y<MAP_HEIGHT; y++){
    for (x=0; x<MAP_WIDTH; x++){
        switch (stage[y][x]){
            case 1:
                oslSetImageTileSize(room_tileset, 0,0,16,16);
                oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
                stage[y][x].yPos=(y*TILE_HEIGHT);
                stage[y][x].xPos=(x*TILE_WIDTH);
                stage[y][x].Tile.Walkable=0;
                break;
            case 2:
                oslSetImageTileSize(room_tileset, 16,0,16,16);
                oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
                stage[y][x].yPos=(y*TILE_HEIGHT);
                stage[y][x].xPos=(x*TILE_WIDTH);
                stage[y][x].Tile.Walkable=1;
                break;
            default:
                oslDebug("Problem loading tiles to map");
                break;
        }
 
        if (stage[y][x]==1){
            oslSetImageTileSize(room_tileset, 0,0,16,16);
            oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
            stage[y][x].yPos=(y*TILE_HEIGHT);
            stage[y][x].xPos=(x*TILE_WIDTH);
            stage[y][x].Tile.Walkable=0;
        }
        if (stage[y][x]==2){
            oslSetImageTileSize(room_tileset, 0,0,16,16);
            oslDrawImageXY(room_tileset, x*TILE_WIDTH, y*TILE_HEIGHT);
            stage[y][x].yPos=(y*TILE_HEIGHT);
            stage[y][x].xPos=(x*TILE_WIDTH);
            stage[y][x].Tile.Walkable=0;
        }
        else {
        oslDebug("Problem loading tiles to map");
        }
 
void initializeMap(){
while (initialize==0){
 
stage[MAPHEIGHT][MAPWIDTH]={
{02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,01,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,01,02},
{02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02,02}
}
    DrawMap();
    player->x=stage[1][1].xPos;
    player->y=stage[1][1].yPos;
    initialize=1;
}
}
}
}
Also wondering if youd like to release this source if you get it working

Last edited by dark_banana; 06-11-2009 at 03:55 PM.
Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:14 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©