1. RE: maps
- Posted by Ray Smith <smithr at ix.net.au> Feb 20, 2002
- 471 views
engale2000 at hotmail.com wrote: > My question has probaly been asked and answered. > > But I am trying to creat a game like diablo or Ultima Online. > > To do this I need to have the map to move the other direction of the > character you're playin' to give the illusion of the character moving. > If I just had one big map.bmp file how would I do such a thing? > > Side note: I want this gave to be played online so the other characters > might be a variable I don't know! These games are written using "tiles". The "big" map is made up of a series of smaller bitmaps (tiles) usually of a size like 32x32 or 64x64 pixels. if the player moves you repaint just the titles on the screen. The full world is kept in a 2d array (sequence) where the value of each element corrresponds to each tile. There is a fair amount of info available on tile based games on the net a search should bring up alot to read. euAllegro (yes it had to be mentioned!!!) has a built in library called Mappy that handles very well the creation of tiled based games. It also comes with a map editor and an example program. It will take a little effort to get it up and running but the results "in the long term" will be much quicker than doing it all yourself. To be honest I haven't looked at euAllegro long time and I never wrote more than a demo using Mappy BUT it all works ... just never been used. Ray Smith http://rays-web.com
2. Re: RE: maps
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 20, 2002
- 435 views
21/02/2002 9:05:35 AM, Ray Smith <smithr at ix.net.au> wrote: > > >engale2000 at hotmail.com wrote: > >> My question has probaly been asked and answered. >> >> But I am trying to creat a game like diablo or Ultima Online. >> >> To do this I need to have the map to move the other direction of the >> character you're playin' to give the illusion of the character moving. >> If I just had one big map.bmp file how would I do such a thing? >> >> Side note: I want this gave to be played online so the other characters >> might be a variable I don't know! > >These games are written using "tiles". >The "big" map is made up of a series of smaller bitmaps (tiles) >usually of a size like 32x32 or 64x64 pixels. >if the player moves you repaint just the titles on the screen. >The full world is kept in a 2d array (sequence) where the value >of each element corrresponds to each tile. > >There is a fair amount of info available on tile based games on the >net a search should bring up alot to read. > >euAllegro (yes it had to be mentioned!!!) has a built in library called >Mappy that handles very well the creation of tiled based games. >It also comes with a map editor and an example program. >It will take a little effort to get it up and running but the results >"in the long term" will be much quicker than doing it all yourself. >To be honest I haven't looked at euAllegro long time and I never >wrote more than a demo using Mappy BUT it all works ... just never >been used. > Well that's one way of doing it. Some games have maps that cannot be built from tiles as they are "hand-crafted" and/or computer generated (fractal images etc...). If you have the RAM, you will need to put the entire map into a PixMap type object and then as the character moves, bitBlt the a portion of the map to the screen using a new top-left offset value. For example, assuming you have a 4000 x 4000 pixel image to be shown on a 800 x 600 screen. set the initial offset to say (x,y) = (1000,1000) then bitBlt (x,y, 800, 600) to the screen. Then when the character "moves" to the left, you decrement the x offset, bitBlt (x,y, 800,600) and then redraw the character image at exactly the same spot it already is at. This will give the appearance of the character moving across the background. Once the x or y value reaches zero, you stop bitBlting and then you actually move the character image instead. Same when the bottom or right edge of the map is already visible. --------- Cheers, Derek Parnell