Page 1 of 1

SGDK - Correct time to call VDP_setPlanSize?

Posted: Wed Mar 07, 2012 1:15 pm
by djcouchycouch
Hi,

I'm trying to resize the planes' size to 64x64 by calling VDP_setPlanSize(64,64) but it doesn't seem to have any effect. It looks like it still thinks it's in 32x32. Is the function not working because I can only call it at certain times?

I'm expecting my background to look like this (warning: gross simplification ahead)


0000000000000000
1111111111111111
2222222222222222
3333333333333333

But I'm getting this instead

00000000 // lines are stopped half-way and continues on the next line
00000000
11111111
11111111
// also cuts out the bottom half of the map.


I'm also calling VDP_setScreenHeight224() and VDP_setScreenWidth320() which I don't know if they would affect it.

What could I be missing?

Thanks!
DJCC

Posted: Wed Mar 07, 2012 2:06 pm
by djcouchycouch
Disregard above post. The problem was between keyboard and chair.

Thanks!
DJCC.

Posted: Mon Dec 17, 2012 9:46 pm
by oofwill
I have the same issue, but i don't really understand why.

For sure one thing i missed but could you help me on this point?
What was your reasoning?

Posted: Mon Dec 17, 2012 9:48 pm
by djcouchycouch
I occasionally get email updates about this thread even though there aren't actually any updates. Forum problem? Spammer getting booted before I check?

Also, I wish I had explained what my actual problem above was :)

Posted: Mon Dec 17, 2012 11:05 pm
by Chilly Willy
djcouchycouch wrote:I occasionally get email updates about this thread even though there aren't actually any updates. Forum problem? Spammer getting booted before I check?

Also, I wish I had explained what my actual problem above was :)
A spammer hit the forum this morning - Edisonrose - you can still see a couple of his posts on the board.

But the post above yours by oofwill is real.

Posted: Tue Dec 18, 2012 5:49 am
by oofwill
Yes, i'm not a bot :lol:

I posted the same post several days ago, that's probably why you receive email, but i delete it since i wanted to find the solution by myself.

Several days after, i realise i don't find the answer... :|

Posted: Tue Dec 18, 2012 9:43 pm
by oofwill
If i understand, a plan is 64 tiles wide (512pxls)

So, what is the method to use a big map, as in goplanes for exemple?

I don't really inderstand this thing...

Edit: ok, i understood. i have to redraw my plane as i go trough it...

Posted: Tue Dec 18, 2012 10:08 pm
by djcouchycouch
oofwill wrote:If i understand, a plan is 64 tiles wide (512pxls)

So, what is the method to use a big map, as in goplanes for exemple?

I don't really inderstand this thing...

If your level size is better than the plane size, then you can only put part of the level in the plane.

Example level:

[1][1][1][1][1][1][1]
[2][2][2][2][2][2][2]
[3][3][3][3][3][3][3]
[4][4][4][4][4][4][4]

Example Plane:

[][]
[][]

When you first show the level, copy only the area that fits into the plane. If the player is at the top left corner of the map, then your plane will look like:

[1][1]
[2][2]

Next is scrolling, which is tricky because you have to realize that planes, when scrolled in a direction farther than their width/height, wrap around.

Example Plane Filled with your tile data:

[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]

If you scroll the plane horizontally forever, it'll look like the level loops for infinity:

[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...

it'll loop that one part of the level you copied to the plane. But you want to make it look like you're scrolling through the level. In Goplanes, I use one method for doing that.

To do that, you need to update the row and columns just outside the screen in the direction of movement.

Player starts standing:
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]

Player moves towards the right:

[1][2][3][4][5][6] <- new column!
[1][2][3][4][5][6]
[1][2][3][4][5][6]
[1][2][3][4][5][6]

You copy the column from your level data to the plane just outside of the screen so that when the plane scrolls it looks seamless.

You'll need to keep in mind the case where you're adding a row or column at the border of the plane. Writing past a plane in memory will overwrite the next plane or whatever memory that comes after.

That's the very quick version of it.

Posted: Tue Dec 18, 2012 10:18 pm
by oofwill
Thanks for this detailed answer. I think i've understodd. I'll work on it now.

:)

Posted: Wed Dec 19, 2012 3:28 pm
by oofwill
Back for thank you again, i've managed to do a little map (just put some blocks to test) and it's working!

I'm sure my code is not optimal, but i will perfect it with time ^^