Rayman PSP Homebrew

For discussions about the Rayman series.
Forum rules
Please keep the forum rules and guidelines in mind when creating or replying to a topic.
Post Reply
Chilly Willy
Elder Teensy
Posts: 108
Joined: Tue May 26, 2009 1:37 am
Contact:
Tings: 4230

Re: Rayman PSP Homebrew

Post by Chilly Willy »

alfman wrote:And thanks for Chilly WIlly for the enlightenment :D it was a great post. However, you're saying that porting it to PC won't be any trouble at all? it'll be rather easy for you?
Well, to linux at any rate. I'm not really set up for Windows programming at the moment, however, CygWin should be able to handle it assuming a PC port stuck to cross-platform packages like SDL. Porting is usually not that tough as long as the systems are roughly comparable or better. It's when you have to port DOWN that the work becomes significant - like trying to make a Genesis or SNES port of a PSP game. :sad:
alfman
Tentacle claw
Posts: 105
Joined: Thu Nov 12, 2009 12:51 am
Tings: 525

Re: Rayman PSP Homebrew

Post by alfman »

hehe, yea i can see the problem there :P

But i dont think a N64 or JAG version of a new game will be very needed, as nobody really needs it :P
Rayman9930
Master Kaag
Posts: 1074
Joined: Tue Nov 04, 2008 2:26 am
Location: Somewhere searching for Rayman's old enemies and maybe a few Rabbids.
Tings: 6790

Re: Rayman PSP Homebrew

Post by Rayman9930 »

spiraldoor
Umber
Posts: 12392
Joined: Tue Jul 15, 2008 3:13 pm
Tings: 156600

Re: Rayman PSP Homebrew

Post by spiraldoor »

Equilibrium369 wrote:Image
Do you think there's any way you could have the stars twinkling in the background, like in the PS1 version? The sky looks kind of lifeless here.

It might also be cool to have different background animations, like the clouds in the Dream Forest in the PC version.
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:18 pm, edited 1 time in total.
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Rayman PSP Homebrew

Post by PluMGMK »

I would think that it's the same as the tilesheets, but then the PSX version uses palette-swapping, doesn't it? :boon:
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:18 pm, edited 1 time in total.
PluMGMK
Annetta Fish
Posts: 40508
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 136606

Re: Rayman PSP Homebrew

Post by PluMGMK »

I meant the tilesheets for the respective worlds. I know they're not all the same, having worked with Rayman Designer PCXs.
Rayman9930
Master Kaag
Posts: 1074
Joined: Tue Nov 04, 2008 2:26 am
Location: Somewhere searching for Rayman's old enemies and maybe a few Rabbids.
Tings: 6790

Re: Rayman PSP Homebrew

Post by Rayman9930 »

So do you think you can do it? May not be easy, but I know you can do it, equilibrium! So any more designs?
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:18 pm, edited 1 time in total.
Rayman9930
Master Kaag
Posts: 1074
Joined: Tue Nov 04, 2008 2:26 am
Location: Somewhere searching for Rayman's old enemies and maybe a few Rabbids.
Tings: 6790

Re: Rayman PSP Homebrew

Post by Rayman9930 »

Isn't there a way around the problem or an alternate solution?
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:18 pm, edited 1 time in total.
bunnieblaster
Master Kaag
Posts: 812
Joined: Thu Mar 22, 2007 4:43 pm
Location: The Netherlands
Tings: 6995

Re: Rayman PSP Homebrew

Post by bunnieblaster »

Can you post some screens? Btw I can't use newlines (enters) at the moments because of some weird virus thing... :\
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:19 pm, edited 1 time in total.
Rayman9930
Master Kaag
Posts: 1074
Joined: Tue Nov 04, 2008 2:26 am
Location: Somewhere searching for Rayman's old enemies and maybe a few Rabbids.
Tings: 6790

Re: Rayman PSP Homebrew

Post by Rayman9930 »

Exams, hate them. I had another benchmark(test) this week on US history, and I got one on science soon after the math and reading last week two days in a row :sad: .
Chilly Willy
Elder Teensy
Posts: 108
Joined: Tue May 26, 2009 1:37 am
Contact:
Tings: 4230

Re: Rayman PSP Homebrew

Post by Chilly Willy »

Equilibrium369 wrote:I've been trying to fix some bug for the last few days with no hope :? It has something to do with drawing about 3 or more objects that have a size greater than 0 (repeated images) to the screen at once. Basically the whole game just slows down when I draw certain images with a large size.

Chilly Willy: I'm under the impression that blitting images to the screen which are outside the bounds of the screen are just ignored, is this true? It seems that if I have an object with a large size (several repeated images) and its drawn somewhere off the screen it still has the same bad affect as when I draw it inside the screen bounds. To me that just makes it seem like it must be my code but I just can't see a problem. I could be completely wrong, but maybe swizzling would help. I might upload the source code if it's ok?

Edit: I think I might have fixed it now, although everytime I think that it keeps coming back to bite me lol :P
I changed the image display system to use a similar one to the collision engine. There is an array of image boxes (a structure with coordinates and index of the Image data) and it gets added to each time a new object is placed when the level is loaded. Then I made it loop through the image boxes array and only blit the ones which have at least some part inside the screen bounds. I still think it might be best to add texture swizzling support though, if it makes that much of a difference.
The rendering on the PSP uses a local coordinate system of 2048 by 2048. As part of the initialization, you generally set some scissors so that only the screen (which is set at the center) actually gets written to the display ram. That's what these lines do:

Code: Select all

	sceGuOffset(2048 - (SCREEN_WIDTH / 2), 2048 - (SCREEN_HEIGHT / 2));
	sceGuViewport(2048, 2048, SCREEN_WIDTH, SCREEN_HEIGHT);
	sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
	sceGuEnable(GU_SCISSOR_TEST);
Note that objects are always fully processed, even if outside the scissors, just not written to ram. Therefore, you don't want to render objects completely outside the screen as that's wasting time, however, a BIG object that is partially rendered and partially clipped could waste time if it's mostly outside the screen as well. Because of that and the small texture cache, people generally use "slices" to do blits to the display. The texture cache can only hold a certain width and height of the texture data, which depends on the number of colors in the texture. Most people settle for what fits using 32 bit or 16 bit textures, but if you use 8 bit, or 4 bit textures, you can increase the width of the slices to take better advantage of the texture cache. The cache is 8KB, and is organized as 64x32 with 32 bit textures, 64x64 for 16 bit, 128x64 for 8 bit, and 128x128 for 4 bit. Note that the nibbles for 4 bit textures are swapped from the normal convention! That is, bits 0-3 are the leftmost pixel, and bits 4-7 are the rightmost pixel. So if you use 4 bit textures, you need to swap the nibbles when you copy the texture to ram.

Anywho, because the cache only holds a certain width, attempting to use more than that width causes the cache to be reloaded. Because the PSP GE renders a line at a time, you'll reload the texture cache SEVERAL TIMES for EVERY SINGLE LINE if you exceed that width. That's why blitting lots of "big" textures gets slow. Slicing the texture into widths that fit in the cache is a tremendous speed boost. A typical blit with splicing looks like this:

Code: Select all

	int j = 0;
	while (j < width) {
		Vertex* vertices = (Vertex*) sceGuGetMemory(2 * sizeof(Vertex));
		int sliceWidth = 64;
		if (j + sliceWidth > width) sliceWidth = width - j;
		vertices[0].u = sx + j;
		vertices[0].v = sy;
		vertices[0].x = dx + j;
		vertices[0].y = dy;
		vertices[0].z = 0;
		vertices[1].u = sx + j + sliceWidth;
		vertices[1].v = sy + height;
		vertices[1].x = dx + j + sliceWidth;
		vertices[1].y = dy + height;
		vertices[1].z = 0;
		sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, 0, vertices);
		j += sliceWidth;
	}
Notice how the slice width is set to 64, which is the most a 32 bit texture can be. You step across the texture being blitted, doing 64 pixels (wide) at a time. Note that you could slice vertically as well, but there's usually no need. The texture cache holds 32 lines at 32 bits - if you blit more than 32 lines, it will reload the cache after 32 lines have been blitted. So the entire cache is used as long as you slice the horizontal dimension. Notice that slicing also stops when you reach the edge of the display. By slicing an object, you limit the amount of the object that gets processed outside the display for no reason.
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:19 pm, edited 1 time in total.
Chilly Willy
Elder Teensy
Posts: 108
Joined: Tue May 26, 2009 1:37 am
Contact:
Tings: 4230

Re: Rayman PSP Homebrew

Post by Chilly Willy »

Sounds good! If you have any other questions, just ask. The PSP is nice, but there are a few quirks that sometimes take a little experience to figure out.

I kind of figured that most of the engine shouldn't be a problem - how often do 2D games have object cells bigger than 64x64? It would be backgrounds that ran into the slicing issue more often.
Equilibrium369
Electoon
Posts: 98
Joined: Wed Dec 30, 2009 5:34 pm
Tings: 0

Re: Rayman PSP Homebrew

Post by Equilibrium369 »

-
Last edited by Equilibrium369 on Mon Aug 16, 2010 7:20 pm, edited 1 time in total.
Rayman9930
Master Kaag
Posts: 1074
Joined: Tue Nov 04, 2008 2:26 am
Location: Somewhere searching for Rayman's old enemies and maybe a few Rabbids.
Tings: 6790

Re: Rayman PSP Homebrew

Post by Rayman9930 »

Keep this going, I can't wait to play it.......................soon :roll: .
Post Reply