Could someone make Snake?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Vini
Posts: 12
Joined: Wed May 18, 2005 3:36 am

Could someone make Snake?

Post by Vini »

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!
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

....

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.
weak
Posts: 114
Joined: Thu Jan 13, 2005 8:31 pm
Location: Vienna, Austria

Post by weak »

http://forums.ps2dev.org/viewtopic.php? ... ight=snake

somewhere in that thread there's a link to snake. never checked it, just came to my mind that someone had mentioned it ...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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 :-)

Image
Smeg0rz
Posts: 4
Joined: Sun Jun 26, 2005 4:24 am

Post by Smeg0rz »

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
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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.
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.
Vini
Posts: 12
Joined: Wed May 18, 2005 3:36 am

Post by Vini »

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 :-)

Image
Oh thanks a lot man!
Smeg0rz
Posts: 4
Joined: Sun Jun 26, 2005 4:24 am

Post by Smeg0rz »

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.
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)
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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:

Image

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: Select all

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 &#40;x = 0; x < width; x++&#41; &#123;
			unsigned short color = vram&#91;y * lineWidth + x&#93;;
			unsigned char red = color & 0x1f;
			unsigned char green = &#40;color >> 5&#41; & 0x1f;
			unsigned char blue = &#40;color >> 10&#41; & 0x1f;
			lineBuffer&#91;x&#93; = blue | &#40;green<<5&#41; | &#40;red<<10&#41;;
		&#125;
		sceIoWrite&#40;fd, lineBuffer, width * 2&#41;;
	&#125;
	sceIoClose&#40;fd&#41;;
&#125;
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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:
Image
Image

And here are the snake skin:
Head:
Image
Image
Image
Image

Body:
Image
Image

Tale:
Image
Image
Image
Image

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

*Edit, I guess you need graphics for turning as well:
Image
Image
Image
Image
Last edited by gandalf the grey on Mon Jun 27, 2005 7:50 am, edited 2 times in total.
Fly you fools...
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

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.
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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:
Image

And the bg for the entire screen:
Image

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

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

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

Then it would look something like this:
Image
Fly you fools...
LiquidIce
Posts: 55
Joined: Mon Apr 04, 2005 1:15 am
Contact:

Post by LiquidIce »

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.
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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.
muha
Posts: 3
Joined: Mon Jun 27, 2005 1:42 pm

Post by muha »

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.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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.
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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([url=http://pspnorge.no[/url]PSPNorge[/url]

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...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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 :-)
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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.
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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?
Image

Here is a test of what the menu could look like:
Image
Fly you fools...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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.
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

Multiplayer would rock, I'm away most of Juli, but when I get back I can fix all the graphics needed :)
Fly you fools...
toddz
Posts: 5
Joined: Mon Jun 06, 2005 9:47 am

Post by toddz »

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
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

I just reliazed something that should be added, a pause button.(I would prefer start)
Fly you fools...
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

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 !
gandalf the grey
Posts: 34
Joined: Tue Apr 12, 2005 12:50 am

Post by gandalf the grey »

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)
Image
Image
Fly you fools...
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

Many thanks gandalf, i will use them for now :p
Post Reply