1. Virtual displaying of images

I don't know if the term virtual is correct for what I want:

        I want to create a huge image containing all the map of the game, but to
create that I need a method for "displaying" an image in this big image, I
tried this:

-- bmp is the bmp to put on the MapBmp sequence
-- pos is the position
procedure VrDisplay(sequence bmp,sequence pos)
    integer BmpWidth,row
    row=pos[2]
    BmpWidth=length(bmp[1])
    for r=1 to length(bmp) do
        MapBmp[row][pos[1]..pos[1]+BmpSize]=bmp[r]
        row=row+1
     end for
end procedure

But it's extremely slow, do you know a better (faster) way for doing
        this
?

---
Ricardo Niederberger Cabral
<rnc at infolink.com.br>

new topic     » topic index » view message » categorize

2. Virtual displaying of images

I don't know if the term virtual is correct for what I want:

I want to create a huge image containing all the map of the game, but to
create that I need a method for "displaying" an image in this big image, I
tried this:

-- bmp is the bmp to put on the MapBmp sequence
-- pos is the position

procedure VrDisplay(sequence bmp,sequence pos)
    integer BmpWidth,row
    row=pos[2]
    BmpWidth=length(bmp[1])
    for r=1 to length(bmp) do
        MapBmp[row][pos[1]..pos[1]+BmpSize]=bmp[r]
        row=row+1
     end for
end procedure

But it's extremely slow, do you know a better (faster) way for doing this
or this is the best method ?

---
Ricardo Niederberger Cabral
rnc at infolink.com.br

new topic     » goto parent     » topic index » view message » categorize

3. Re: Virtual displaying of images

> I want to create a huge image containing all the map of the game, but to
> create that I need a method for "displaying" an image in this big image, I
> tried this:

        < ..some code.. >

> But it's extremely slow, do you know a better (faster) way for doing this
> or this is the best method ?

        Don't use a sequence, but allocated memory.
        You can use my GFX or you can simply rewrite it for allocated
memory.
        If you want to write your own routine, you need to calculate the
start offset, and add the widht of the inside image, then you skip
until your at your start offset + the width of the huge bitmap. Do
this for as many lines (height of inside bitmap) you want.

        If you would use my GFX you can use the function DisplayImageVS and
SaveImageVS. You simply make a screen as large as the huge bitmap,
then you display the huge bitmap on the screen. Then you set the
dimensions and location of the small/inside bitmap with SetView and
then you can use DisplayImageVS and SaveImageVS. THey will then only
work with the view/section you specified with SetView.

        Hope this helps (It was a bit complicated)

Ralf Nieuwenhuijsen
nieuwen at xs4all.nl
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
~~~~>> Ralf Nieuwenhuijsen <<~~~~
 ~~~>> nieuwen at xs4all.nl <<~~~~

new topic     » goto parent     » topic index » view message » categorize

4. Re: Virtual displaying of images

>> I want to create a huge image containing all the map of the game, but
to
>> create that I need a method for "displaying" an image in this big image,
I
>> tried this:
>> But it's extremely slow, do you know a better (faster) way for doing
this
>> or this is the best method ?
>        Don't use a sequence, but allocated memory.
>        You can use my GFX or you can simply rewrite it for allocated
>memory.
>        If you want to write your own routine, you need to calculate the
>start offset, and add the widht of the inside image, then you skip
>until your at your start offset + the width of the huge bitmap. Do
>this for as many lines (height of inside bitmap) you want.
>        If you would use my GFX you can use the function DisplayImageVS
and
>SaveImageVS. You simply make a screen as large as the huge bitmap,
>then you display the huge bitmap on the screen. Then you set the
>dimensions and location of the small/inside bitmap with SetView and
>then you can use DisplayImageVS and SaveImageVS. THey will then only
>work with the view/section you specified with SetView.
>        Hope this helps (It was a bit complicated)

Thanks, I'll try your code. The method I want doesn't need to be so
complex, I'm trying to do a game in the Warcraft style, a background that
scrolls one tile at a time (not like Command & Conquer, that scrolls pixel
by pixel). I'm testing to see wich is the best method: Reading a map
variable and displaying tile by tile the current screen or displaying the
entire region of the map, like a bitmap.
If I use the last method, I would need a 4096 X 4096 image (if the map size
if 128 X 128 tiles and each tile is 32 X 32 pixels), but when I fill this
huge image with the map data, it takes a lot of time using my code.
I think Warcraft II uses the second method, Am I right ?

---
Ricardo Niederberger Cabral
rnc at infolink.com.br

new topic     » goto parent     » topic index » view message » categorize

5. Re: Virtual displaying of images

> Thanks, I'll try your code. The method I want doesn't need to be so
> complex, I'm trying to do a game in the Warcraft style, a background that
> scrolls one tile at a time (not like Command & Conquer, that scrolls pixel
> by pixel). I'm testing to see wich is the best method: Reading a map
> variable and displaying tile by tile the current screen or displaying the
> entire region of the map, like a bitmap.
        Reading a map and only having image data for each different tile in
memory if more memory-friendly and it will not be a lot of speed
difference. Esspecially with win95 or when there is low mem, then the
memory swapping would be so slow that it would make the game
unplayable.

> If I use the last method, I would need a 4096 X 4096 image (if the map size
> if 128 X 128 tiles and each tile is 32 X 32 pixels), but when I fill this
> huge image with the map data, it takes a lot of time using my code.
> I think Warcraft II uses the second method, Am I right ?

        Yes, i think so too, if you want to scroll pixel by pixel you can
have a map of 1 tile horizontally and 1 tile vertically more on a
virtual screen. It would be memory-friendly, smooth scrolling and
fast enough for a 386. (with extensive background processing of AI
and other stuff)

        Anyway, you shouldn't have a large map anyway, memory will be more
of a problem than speed.
        If you want to i can write a fast routine to display the tiles on
the screen, however if you have the code by Micheal Bolin (his
extended memcopy) you don't even have to worry about speed at all.
Just one advise, in mode 19, use allocated memory, in all other
graphics mode you should use 2 or more dimension sequences. (If you
need to cut it in weird pieces a 3-dimensional image (??!!?) can be
a lot faster than a 2-dimensional image)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
~~~~>> Ralf Nieuwenhuijsen <<~~~~
 ~~~>> nieuwen at xs4all.nl <<~~~~

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu