Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Block Tiles using 256 Colours and BG Mode 0   Message List  
Reply | Forward Message #4098 of 15019 |
RE: [gbadev] Re: Block Tiles using 256 Colours and BG Mode 0

That line of code is very ineficient but saves me the memory required for a
seperate map for collision detection. I would not recomend using it as it
is not the best way. But....
Basicaly link x and y are screen relative so they are converted to
world relative coordinants by multiplying world x(what screen link is in not
his actual worldx) times screen width(in pixels) plus link x. This gives
absolute x. I then divide by the width of a tile(16) and that gives my the
tile x coordant. Then the world y times screen height plus link y to get
absolute y. Divide it by tile height(16) to get tile y. Then my index into
the map array is map[ tile_x + tile_y * WorldWidthInTiles]. This gives me
the tile number that i am in. I then compare this against all the tiles i
can walk on and if it is not one i can walk on i restore the old x and y.
This method only checks one point so i add 8 to x and 9 to y to make the
point in the center of link. This way i can still walk halfway into most
tiles. But that looked better to me. This should be a little easier to
follow.
tile_x = ((link.x+8) + worldx * SCREENWIDTH) / 16; //the divides can be
converted to shifts so not too bad
tile_y = ((link.y+9) + worldy * SCREENHEIGHT) / 16;
temp = OverWorld[tile_x + tile_y * WORLDWIDTHINTILES];
SCREENWIDTH and SCREENHEIGHT are in pixels and are the width and height of a
single screen. Since my world only shows one screen at a time this was
easier for me to implement. If your world scrolls then you should allready
have your sprites in world x and y coordants then you just need to divide by
the width/height of your tiles to get what tile you are in. You should
either use a seperate array to store what tiles you can walk on or arrange
your tiles so that all the tiles you can walk on are at one end (you could
use
if(temp > BigestWalkableTile)
{ //cant walk here}
Adding more complex interactions with the background will almost certainly
require another layer to your map that holds just that data.
hoped this helped.
-dovoto


-----Original Message-----
From: Steven Bruce [mailto:kinetic_creationz@...]
Sent: Wednesday, May 30, 2001 1:12 PM
To: gbadev@yahoogroups.com
Subject: RE: [gbadev] Re: Block Tiles using 256 Colours and BG Mode 0


Yep, that's what I thought. :)

Dovoto you did that little Smelda game didn't you?
I've been having a look through it and decided I'd
like to copy your way of Collision Detecting. However
the real killer line is not very well explained in
comments:

temp =
OverWorld[((x+(16*x/240)+8)/16)+((y+(16*y/160)+9)/16)*16*(ScreensW)+
(16*(world_y*ScreensW)*11+16*(world_x))];


Could you please explain how you came up with this
extremely complicated looking algorithm please. I've
been pulling my hair out trying to write my own but it
just isn't working out at all. I'm doing
sprite-background collision detection for a 32x32
sprite and 32x24 size background that scrolls left and
right. Maths was never one of my strong subjects :o)

Steve B.


--- "Rogers, Jason L. ET2 (CVN71)"
<rogersjl@...> wrote: > Block 0 for
both background data and map is the same
> location in memory. If
> you are putting both tile data and the map at block
> zero you are overwriting
> one of then. It is best to place your map data at
> one end and your tile
> data at the other end.
> -dovoto
>
> -----Original Message-----
> From: kinetic_creationz@...
> [mailto:kinetic_creationz@...]
> Sent: Wednesday, May 30, 2001 11:48 AM
> To: gbadev@yahoogroups.com
> Subject: [gbadev] Re: Block Tiles using 256 Colours
> and BG Mode 0
>
>
> --- In gbadev@y..., Jimmy Mårdell <yarin@a...>
> wrote:
> > At 14:36 2001-05-30 +0000, you wrote:
> > >Hi
> > >
> > >A fairly straight forward question here. Can you
> have 4
> Backgrounds
> > >being shown at the same time using 1 256 colour
> palette for each
> > >background or can you only have 2x256 colour BGs.
> Surely you can
> have
> > >4 256 BGs being shown at the same time can't you.
> >
> > Yes, but "1 256 colour palette for each
> background"? All backgrounds
> > share the same 256 colour palette.
>
> Yeah, Sorry I didn't mean to say that. I meant 1 256
> colour palette
> for all backgrounds.
>
> >
> > > I'm trying to get
> > >it to work with mode 0 and it doesn't seem to
> like the same VRAM
> > >Character Block and VRAM Screen Block being used
> for Char and
> Screen
> > >data from the same map. In other words it seems
> to muck up
> somewhere
> > >and my tiles get corrupted if they're not in
> different VRAM
> blocks. I
> > >always thought you could have 4 simultaneous 256
> colour BGs in
> mode 0
> > >but maybe it's restricted to 4 16 Colour BGs
> > >only???????????????????????????????
> >
> > Remember that the screen data for each background
> layer has to
> > be stored in VRAM too! If you use all 256*4 tiles,
> that will
> > eat up all 64k VRAM (using 256 colours) and leave
> no room for
> > screen data.
> >
> > If all background layers are 256x256 in size, the
> screen data
> > for each layer will be 2048 bytes in size. One way
> to map the VRAM
> would
> > be to allow max 224 tiles for each layer; the
> screendata for
> > each layer would fit precisely then. Of course, if
> one layer uses
> > at most, say, 128 tiles, you could map the VRAM
> differently.
> >
>
> Well at the moment I'm only using a maximum of 30
> tiles for my
> 256x256 game screens. So should I be able to load
> straight into VRAM
> block 0 for both the Screen and Character Data? I
> should be able to I
> think. They both use exactly the same 64k RAM don't
> they so one of
> them would have to begin (in RAM location) where the
> other one ends.
> Am I right or am I talking utter rubbish :) This is
> where it gets
> confusing for me :o)
>
>
>
> > --
> > Jimmy Mårdell "Man with friend
> who run from tiger,
> > mailto:yarin@a... need not run faster
> than tiger,
> > http://www.acc.umu.se/~yarin/ but run faster
> than friend."
>
>
> unsubscribe: gbadev-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
> unsubscribe: gbadev-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

unsubscribe: gbadev-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




Thu May 31, 2001 11:04 pm

rogersjl@...
Send Email Send Email

Forward
Message #4098 of 15019 |
Expand Messages Author Sort by Date

Hi A fairly straight forward question here. Can you have 4 Backgrounds being shown at the same time using 1 256 colour palette for each background or can you...
kinetic_creationz@...
Send Email
May 30, 2001
2:37 pm

... Yes, but "1 256 colour palette for each background"? All backgrounds share the same 256 colour palette. ... Remember that the screen data for each...
Jimmy Mårdell
yarin@...
Send Email
May 30, 2001
3:23 pm

... Backgrounds ... have ... Yeah, Sorry I didn't mean to say that. I meant 1 256 colour palette for all backgrounds. ... Screen ... somewhere ... blocks. I ...
kinetic_creationz@...
Send Email
May 30, 2001
3:51 pm

You certainly can have 4 background layers in 256 colour using tiles from the same blockset, as it's exactly what I'm doing. But there is only enough palette...
Tom Prosser
tom@...
Send Email
May 30, 2001
3:36 pm

When you say "VRAM block 0" what do you mean? Tilesets can be stored starting from one of 4 base blocks (0x6000000, 0x6004000, 0x6008000 and 0x600C000),...
Tom Prosser
tom@...
Send Email
May 30, 2001
4:24 pm

... When I say VRAM Block 0 what I mean is Character Block 0 and Screen Blocks 00-07. What I'd like to do is load a bunch of tiles in cblock 0 and then stick...
kinetic_creationz@...
Send Email
May 30, 2001
4:49 pm

The 64k chunk in VRAM allows 4 character blocks, and 32 screen blocks of 2k for 256x256 sized backgrounds. the first 8 screen blocks are in place of the 1st...
Lyndon Tremblay
humasect@...
Send Email
May 30, 2001
4:50 pm

Block 0 for both background data and map is the same location in memory. If you are putting both tile data and the map at block zero you are overwriting one...
Rogers, Jason L. ET2 ...
rogersjl@...
Send Email
May 30, 2001
4:54 pm

Yep, that's what I thought. :) Dovoto you did that little Smelda game didn't you? I've been having a look through it and decided I'd like to copy your way of...
Steven Bruce
kinetic_creationz@...
Send Email
May 30, 2001
5:12 pm

Two wait states, mainly. Tom Prosser Director Escape Software Ltd. 1 Olympic Way Wembley Middlesex HA9 0NP Tel: +44 (0)20 8782 1170 Fax: +44 (0)20 8795 0099 ...
Tom Prosser
tom@...
Send Email
May 30, 2001
5:17 pm

... Internal RAM is only 32k, but its on the same die (chip) as the CPU, so access to it is extremely fast. One could think of it as a CPU cache, except that...
Jason Wilkins
fenix@...
Send Email
May 30, 2001
6:51 pm

umm i would think you would be much better off writing a different collision detection function, that one uses alot of division and multiplication one way to...
Kiasecto
kiasecto@...
Send Email
May 30, 2001
10:05 pm

That line of code is very ineficient but saves me the memory required for a seperate map for collision detection. I would not recomend using it as it is not...
Rogers, Jason L. ET2 ...
rogersjl@...
Send Email
Jun 1, 2001
7:53 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help