Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411617 Posts in 69390 Topics- by 58447 Members - Latest Member: sinsofsven

May 10, 2024, 11:32:23 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)caching of your scrollable tile-based world
Pages: [1]
Print
Author Topic: caching of your scrollable tile-based world  (Read 1500 times)
nikki
Level 10
*****


View Profile
« on: December 15, 2009, 11:54:24 AM »


Now iv'e finished the realtime generating loop of the tiles that make my world.
I started thinking of optimizing: drawing 48 * 64 * (posibbly more then one) tiles
every frame is possible, but not optimal I pressume,

I understand you could make a screen capture of this screen and keep it in your memory, and thus have only 1 draw command.

The thing i have troubles getting my head around is the scrolling.
since you only always add a row of column I am guessing there are some neat tricks out there.
What are your favourite techniques of making this world scrollable ?
Logged
Draknek
Level 6
*


"Alan Hazelden" for short


View Profile WWW
« Reply #1 on: December 15, 2009, 12:46:25 PM »

There certainly are techniques to do what you want, but I wouldn't bother until tile-rendering became a bottleneck.

Premature optimisation and all that...

That said, you're already on the right track: the basic idea would be to render to an image one tile wider and taller than the screen size. Then you scroll that image about until you step over the border and need to redraw parts of it.
Logged

Glaiel-Gamer
Guest
« Reply #2 on: December 15, 2009, 12:54:54 PM »

48x64x2xN textured triangles = 6144xN textured polys (max, there will probably be a lot of empty tiles anyway).

Pop them into a static vertex buffer, render in one call, every single tile.

You will get practically no slowdown, considering modern GPUs can render tens of millions of textured polys per second.
Logged
nikki
Level 10
*****


View Profile
« Reply #3 on: December 15, 2009, 03:45:25 PM »

Today I've made a little test app
http://www.mydatanest.com/files/nicholaspeanut/38757_ykzdi/scrollableworld2.exe

with the cursor keys you move (no smooth pixel scrolling, the hardcore tile by tile move)
and with the tab you switch between drawroutines

I am curious of your numbers, and tips!

Logged
nikki
Level 10
*****


View Profile
« Reply #4 on: December 15, 2009, 05:50:44 PM »

the test app 2 is just finished ! it has smooth scrolling now and multilayered drawing of shapes
http://www.mydatanest.com/files/nicholaspeanut/38800_thibo/scrollableworld3.exe


you move with cursor, change drawroutine with tab and change current tile to draw with space

I doubt any of your pc's will have speed issues.

Logged
Eraser
Guest
« Reply #5 on: December 16, 2009, 08:18:00 PM »

the test app 2 is just finished ! it has smooth scrolling now and multilayered drawing of shapes
http://www.mydatanest.com/files/nicholaspeanut/38800_thibo/scrollableworld3.exe


you move with cursor, change drawroutine with tab and change current tile to draw with space

I doubt any of your pc's will have speed issues.


Non optimized, I was getting ~25fps. Optimized, ~250fps. Spacebar had no visible effect. My computer is rather lacking in speed Sad
Logged
nikki
Level 10
*****


View Profile
« Reply #6 on: December 17, 2009, 04:57:56 AM »

the spacebar is for scrolling through the colors/tiles to draw.
the drawing is done with your left mouse button ,

i forgot to say that about the mouse before ... Smiley
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic