forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Could someone make Snake?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Vini



Joined: 18 May 2005
Posts: 12

PostPosted: Sun Jun 26, 2005 1:02 am    Post subject: Could someone make Snake? Reply with quote

First of all I'll say that I have no idea how to program anything, I've never been good in that field. I failed the c++ class ok!

Anyway, could someone make a snake game for the PSP. I know it would not be a very hard code to make, and people would appreciate it a lot.

Thanks!
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Sun Jun 26, 2005 1:37 am    Post subject: Reply with quote

....

I'd usually say there's a general "no request" rule here, but, a snake game... at least some people could take that project to learn how to code for the PSP...
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
weak



Joined: 13 Jan 2005
Posts: 114
Location: Vienna, Austria

PostPosted: Sun Jun 26, 2005 2:12 am    Post subject: Reply with quote

http://forums.ps2dev.org/viewtopic.php?t=1648&highlight=snake

somewhere in that thread there's a link to snake. never checked it, just came to my mind that someone had mentioned it ...
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sun Jun 26, 2005 5:43 am    Post subject: Reply with quote

Just coded, with full source code for beginners to start their own games: Snake

And some title graphics (my graphics pad and Photoshop helps, but I'm a coder, not an artist :-)

Back to top
View user's profile Send private message
Smeg0rz



Joined: 26 Jun 2005
Posts: 4

PostPosted: Sun Jun 26, 2005 5:45 am    Post subject: Reply with quote

shine, thanks for this man, i was hoping for the source to come out for this just to help me start getting on the right track... (after i get this hellopsp to compile correctly first :/)

after extracting this, how would i go about compiling the code, once clicking on mk.bat i get a 0kb map file :/

I changed the EBOOT path so it should appear in the same dir as where the map file does instead of what u had it set as, and it's still not making the PBP
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sun Jun 26, 2005 6:02 am    Post subject: Reply with quote

Smeg0rz wrote:
after extracting this, how would i go about compiling the code, once clicking on mk.bat i get a 0kb map file :/

I just downloaded the PS2Dev_Setup.exe for windows, setup the PS2DEV and PS2SDK enivronment variables and path as decribed and then a call to mk.bat produces the EBOOT.PBP, like for the hellopsp, on which Snake is based.
Quote:

I changed the EBOOT path so it should appear in the same dir as where the map file does instead of what u had it set as, and it's still not making the PBP

That's only the final copy to my PSP connected at the USB port, the EBOOT.PBP is generated earlier.
Back to top
View user's profile Send private message
Vini



Joined: 18 May 2005
Posts: 12

PostPosted: Sun Jun 26, 2005 8:01 am    Post subject: Reply with quote

Shine wrote:
Just coded, with full source code for beginners to start their own games: Snake

And some title graphics (my graphics pad and Photoshop helps, but I'm a coder, not an artist :-)


Oh thanks a lot man!
Back to top
View user's profile Send private message
Smeg0rz



Joined: 26 Jun 2005
Posts: 4

PostPosted: Mon Jun 27, 2005 12:15 am    Post subject: Reply with quote

Shine wrote:
Smeg0rz wrote:
after extracting this, how would i go about compiling the code, once clicking on mk.bat i get a 0kb map file :/

I just downloaded the PS2Dev_Setup.exe for windows, setup the PS2DEV and PS2SDK enivronment variables and path as decribed and then a call to mk.bat produces the EBOOT.PBP, like for the hellopsp, on which Snake is based.
Quote:

I changed the EBOOT path so it should appear in the same dir as where the map file does instead of what u had it set as, and it's still not making the PBP

That's only the final copy to my PSP connected at the USB port, the EBOOT.PBP is generated earlier.


Thanks i'll try installing the PS2 Dev kit then, then i'll see how it goes! Cheers for your reply! (hope this works)
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Mon Jun 27, 2005 1:54 am    Post subject: Reply with quote

I've been playing this game for over an hour now :p
It's simple yet very fun, I wish it had better response though :(

Hope you will keep updating this, maybe change the red squares into apples etc. and give the snake a skin?
_________________
Fly you fools...
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Jun 27, 2005 3:03 am    Post subject: Reply with quote

gandalf the grey wrote:
I've been playing this game for over an hour now :p
It's simple yet very fun, I wish it had better response though :(

Hope you will keep updating this, maybe change the red squares into apples etc. and give the snake a skin?


Yes, I can do this. Can someone provide good graphics (of course self made)? I need 16x16 pixel size lossless (PNG or BMP) graphics for this, which looks good when placed with no space side by side (so perhaps on the right and bottom side an empty line of pixel). And perhaps someone could enhance the title graphic. I can integrate it in a new version (of course, with credits to the artists).

Another idea: would be nice to have a graphic for the whole background, including the score. Use this screenshot as the base:



The area where the snake moves, needs not to be empty.

PS: if you want to do your own screenshots, this is the code:

Code:

void writeByte(int fd, unsigned char data)
{
   sceIoWrite(fd, &data, 1);
}

const char tgaHeader[] = {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0};

void screenshot()
{
   const int width = 480;
   const int lineWidth = 512;
   const int height = 272;
   unsigned short lineBuffer[width];
   unsigned short* vram = (unsigned short*) pgGetVramAddr(0, 0);
   int x, y;
   int fd = sceIoOpen("ms0:/screenshot.tga", O_CREAT | O_TRUNC | O_WRONLY, 0777);
   if (!fd) return;
   sceIoWrite(fd, tgaHeader, sizeof(tgaHeader));
   writeByte(fd, width & 0xff);
   writeByte(fd, width >> 8);
   writeByte(fd, height & 0xff);
   writeByte(fd, height >> 8);
   writeByte(fd, 16);
   writeByte(fd, 0);
   for (y = height - 1; y >= 0; y--) {
      for (x = 0; x < width; x++) {
         unsigned short color = vram[y * lineWidth + x];
         unsigned char red = color & 0x1f;
         unsigned char green = (color >> 5) & 0x1f;
         unsigned char blue = (color >> 10) & 0x1f;
         lineBuffer[x] = blue | (green<<5) | (red<<10);
      }
      sceIoWrite(fd, lineBuffer, width * 2);
   }
   sceIoClose(fd);
}
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Mon Jun 27, 2005 7:08 am    Post subject: Reply with quote

I know my way around PS so I had a go at some graphics:
What if you try to have to "sets" of food, apples and flies, here are some graphics:



And here are the snake skin:
Head:





Body:



Tale:





If you use them please credit me with the name "Gundrosen"

*Edit, I guess you need graphics for turning as well:




_________________
Fly you fools...


Last edited by gandalf the grey on Mon Jun 27, 2005 7:50 am; edited 2 times in total
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Mon Jun 27, 2005 7:26 am    Post subject: Reply with quote

BTW, you can make the controls more responsive by instead of:

waitvblank(5)
keyboardcontrol()

do

for (i=0;i<5; i++){
waitvblank(1)
keyboardcontrol();
}

that way, keypresses that are shorter than 5 vblanks won't be missed as easily.
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Mon Jun 27, 2005 7:32 am    Post subject: Reply with quote

ector wrote:
BTW, you can make the controls more responsive by instead of:

waitvblank(5)
keyboardcontrol()

do

for (i=0;i<5; i++){
waitvblank(1)
keyboardcontrol();
}

that way, keypresses that are shorter than 5 vblanks won't be missed as easily.


That will be a must :)
Finished the highscore background:


And the bg for the entire screen:


And here is a ss of what it might look like:


*Edit, here is a better ICON then the one you made:


*Edit 2, how about this for the "main" square:


Then it would look something like this:

_________________
Fly you fools...
Back to top
View user's profile Send private message
LiquidIce



Joined: 04 Apr 2005
Posts: 55

PostPosted: Mon Jun 27, 2005 11:00 am    Post subject: Reply with quote

It's amazing what people can come up with working together for a few hours. Great work Gundrosen and Shine!

Having one person do the graphics and one person do the code seems to work out well for homebrew game creation.
Back to top
View user's profile Send private message Visit poster's website
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Mon Jun 27, 2005 11:34 am    Post subject: Reply with quote

LiquidIce wrote:
It's amazing what people can come up with working together for a few hours. Great work Gundrosen and Shine!

Having one person do the graphics and one person do the code seems to work out well for homebrew game creation.


Ive been wanting to contribute to the homebrew communtiy for a long time, but I dont know any coding so this was a great opportunity for me to help out :)

Just hope Shine will have the code ready before I go to denmark :)
_________________
Fly you fools...
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Jun 27, 2005 12:25 pm    Post subject: Reply with quote

Nice artwork, gandalf! I've changed it a bit, because it looked better, if the red/green pattern was the same in every snake piece. The new version is finished. Now it is more responsive, too, thanks to the hint from ector.
Back to top
View user's profile Send private message
muha



Joined: 27 Jun 2005
Posts: 3

PostPosted: Mon Jun 27, 2005 2:08 pm    Post subject: Reply with quote

awesome program shine! and also great artwork gandalf. its rather addicting. my high score so far is 48. you should really send this program out to some of the other psp sites so they can post it with their other homebrew.
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Jun 27, 2005 5:36 pm    Post subject: Reply with quote

muha wrote:
awesome program shine! and also great artwork gandalf. its rather addicting. my high score so far is 48.


Thanks. I don't understand how someone can play this game more than some minutes, but it was fun to implement it :-)

muha wrote:
you should really send this program out to some of the other psp sites so they can post it with their other homebrew.


The game can be posted to other forums, too, if someone is already a member of it, but would be nice to mirror it in this case.
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Tue Jun 28, 2005 12:20 am    Post subject: Reply with quote

Shine wrote:
Nice artwork, gandalf! I've changed it a bit, because it looked better, if the red/green pattern was the same in every snake piece. The new version is finished. Now it is more responsive, too, thanks to the hint from ector.


It's most impressive now :)
Will post this on my own norwegian PSP site(PSPNorge

Can you code it so that the PSP will remember your last highscore?

And do you think it will be possible to make more levels?

BTW, Mirror
_________________
Fly you fools...
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Tue Jun 28, 2005 1:40 am    Post subject: Reply with quote

gandalf the grey wrote:

Can you code it so that the PSP will remember your last highscore?

And do you think it will be possible to make more levels?


Good idea. On my mobile phone I can select from a list of levels. I can implement it as a text file in the same directory, where one level has the size of 21x15 pieces and one piece the size 16x16 pixel, as usual. Maybe you can design some pieces? The easiest way would be just one square, but perhaps it would be better to have edges and corners, too. And in the mobile phone implementation you can choose mazes, where you can beam from the left border to the right border, this should be designed, too, perhaps blocking borders with parts, where you can't go from one side to another.

Some ideas for sound (from a sound collection CD, where the sounds can be used in own programs) :

intro
game over
apple or fly collected

And finally the game needs a multiplayer wireless mode. I can implement it with Irda, but would be cool to use the WIFI adhoc network. Does anyone have some (legal) sample code?

When the ps2dev PSPSDK is released, I'll port the game to it. Would be nice, if the PSPSDK has some support for the sceGU-library, because this would be a better base for other games, which requires faster screen refreshs. And I would like to access the PSP font library, if possible.

Ok, much to do, if someone wants to contribute, feel free to do so :-)
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Tue Jun 28, 2005 2:37 am    Post subject: Reply with quote

Sounds great :)
You need "blocks" in the size of 21x15?

BTW, what if you try to have three difficulties?
Slow
Normal
Fast


That would be cool.

The sounds were good :)
_________________
Fly you fools...
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Tue Jun 28, 2005 2:40 am    Post subject: Reply with quote

gandalf the grey wrote:
Sounds great :)
You need "blocks" in the size of 21x15?

no, the blocks needs to be 16x16 pixels and one level has 21x15 blocks.
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Tue Jun 28, 2005 2:54 am    Post subject: Reply with quote

Shine wrote:
gandalf the grey wrote:
Sounds great :)
You need "blocks" in the size of 21x15?

no, the blocks needs to be 16x16 pixels and one level has 21x15 blocks.


Ok, will do that right away(the 16x16 first and if I have time the 21x15)

What about a rock as a block?


Here is a test of what the menu could look like:

_________________
Fly you fools...
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Tue Jun 28, 2005 3:20 am    Post subject: Reply with quote

The rock is OK.

For the options we should think about how to display the menu:

- start game
- player name (perhaps I can read it from the system, but should be modifyable)
- speed: slow/normal/fast
- level: some small icons of all levels, which can be selected
- music: on/off (I plan to integrate a mod player I've written in Java and which is easy to port to C)
- sound: on/off
- start multiplayer WIFI server game (which displays a dialog, where the number of joined players are displayed and where you can start the game or cancel the server)
- join multiplayer game (which displays a dialog, where the player can cancel the join and where the player is informed, how many other players are already joined)

And instead of integrating the text in graphics, perhaps you can write all characters to a bitmap (black text, antialiased on white background), then I can display antialiased text in the game.

Looks like we need some weeks to make a real game of it :-)

PS: I don't have much time this week, but I can work on weekend on the game. I hope the PSPSDK is released then, because it is easier to program, if I don't need to write every libc function myself.
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Tue Jun 28, 2005 3:37 am    Post subject: Reply with quote

Multiplayer would rock, I'm away most of Juli, but when I get back I can fix all the graphics needed :)
_________________
Fly you fools...
Back to top
View user's profile Send private message
toddz



Joined: 06 Jun 2005
Posts: 5

PostPosted: Tue Jun 28, 2005 12:40 pm    Post subject: Reply with quote

You guys are all putting in some great work, I think doing a quick speed and a level selection would be great. Also, maybe you could drop the words from the speed selection PNG and turn that into a background screen (PIC1.PNG in the EBOOT.PBP) when people are selecting the application from the MemStick up and down list.

Keep up the good work,
Todd
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Tue Jun 28, 2005 11:40 pm    Post subject: Reply with quote

I just reliazed something that should be added, a pause button.(I would prefer start)
_________________
Fly you fools...
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Wed Jun 29, 2005 11:23 am    Post subject: Reply with quote

Hi people :)

I'm working on a "file manager" for the psp, and i was wondering if you would have the time to make a background GUI for the app gandalf.I can
move some variable on the screen if needed by the GUI background.
Of course if you have the time and the motivation...dont worry about it hehe.

Here is the tools im working on if someone want to take a look:

http://cpasjuste1.free.fr/psp/PspFileManager_v0.2.zip

See you soon, and keep your good work !
Back to top
View user's profile Send private message
gandalf the grey



Joined: 12 Apr 2005
Posts: 34

PostPosted: Thu Jun 30, 2005 12:49 am    Post subject: Reply with quote

I'm in a bit of a hurry, but here is a quick backgrond I made, I will probobly improve it when I get home in late Juli...
(I also made a better icon)


_________________
Fly you fools...
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Thu Jun 30, 2005 1:49 am    Post subject: Reply with quote

Many thanks gandalf, i will use them for now :p
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group