RA - Tile Crap

Posted by RhysAndrews on March 26, 2007, 6:56 a.m.

Hi all!

Lately I've been working on some alternative methods for tiles. Why? Because tiles are good for memory shortage, however when you have a LOT of tiles visible at once, that's a lot of individual drawing 'functions' for the computer, and it gives an FPS drop. Now, tiles are brilliant for some games, but for Conflict: Online, we have to find another method, because it's really making an FPS drop for many computers.

So me, Scott, and Pim have been discussing various methods, and have been putting them into action in 'prototype' scripts. They've all got interesting results I'd like to show you guys.

Method One: Whole Room in Memory

This method is a pretty basic method, and follows an idea Tahnok100 had (thanks buddy) - pretty much, all objects are made invisible so only backgrounds and tiles are visible. Then, we create a surface the size of the room to capture the room, then save it to a background. The tiles are deleted, surface deleted, objects visibility restored, and then the new background is drawn at 0,0. Now, though this had perfect quality, we couldn't get the room to get very big before the game crashed from bogging up the memory. Quite obviously because you have a (say) 1500x1500 bitmap stored in the memory! So we then created a quality factor.

The quality factor stretches the tiles and background into a certain resolution - 1 = no stretching/scaling, 0.5 = stretch it half the size, and so on. This way, we can halve the memory it takes up by using half the quality. The background is then drawn at 0,0, and stretched across the room. We had this result:

However, we're still suffering with memory issues here. So, onto our next method.

Method Two: Load/Unload Segments

Here we used a similar method, however split the background into segments of (say) 640x480. We save each segment into a temporary folder, and so we only have to load between 2 and 4 segments at one time, depending where you are on the map. Then, when segments aren't needed at the moment, they're unloaded (or deleted) from the game's memory. This further caused problems. The memory was fine, but we returned to our root problem - the game ran a bit slow trying to figure out what segments needed to be loaded - plus loading the segment into the memory.

Method Three: Only Necessary Segments

This is the method we're still working on - and I have a lot of faith that if we get the scripts working properly, it'll serve a brilliant result. Instead of rendering the whole background, we only render places that has tiles on them. We scan through the room for a tile, if we find it, save the xmin/ymin location there, then keep moving until we can't find tiles anymore (meaning that should end the segment), save the xmax/ymax values and then move on to look for more segments - then a surface browses through the segment values, and takes 'snapshots' of each segment, saves them to backgrounds, and then builds a data-list with all the positions to place the relevant segment.

So yeah!

S'lata guys

-Rhys

Comments

GearGOD 17 years, 8 months ago

Bryan says:

http://64digits.com/users/index.php?userid=RhysAndrews&cmd=comments&id=15284

Bryan says:

it's not even hard -.-

Serge'' says:

my way is better

Serge'' says:

but I'll never tell them my way

Serge'' says:

because I hate them

Bryan says:

surface

Bryan says:

alph abug

Bryan says:

am I right? =)

Serge'' says:

nay

Bryan says:

damn

Bryan says:

then tell me

Serge'' says:

alpha not bug

Serge'' says:

multiple terain layers done properly

Bryan says:

ye

Bryan says:

mutliplying with alpha

Bryan says:

to take parts out

Serge'' says:

in layers-1 passes

Serge'' says:

it's easy on the memory and fairly fast

Serge'' says:

however, this is another place where gm sucks dick

Serge'' says:

tiles are cheap and fast to draw

Serge'' says:

there's no excuse for it being slow at all

Bryan says:

haha

Serge'' says:

there's games that have hundreds of thousands onscreen with no lag

Serge'' says:

mark is just a dipshit who's doing it wrong

Serge'' says:

in fact I bet I can write a better tile mechanism in GM than the native GM one

Bryan says:

hm

Bryan says:

gamemaker is slow

Bryan says:

so … I doubt it if you can get it faster

Serge'' says:

you really can't go wrong with this approach

Serge'' says:

you can try it yourself

Bryan says:

k

Serge'' says:

just promise not to release it so those faggots get it

Serge'' says:

I want them to suffer

Bryan says:

I will

Serge'' says:

<CENSORED MAGIC METHOD EXPLANATION>

Serge'' says:

<CENSORED MAGIC METHOD EXPLANATION>

Bryan says:

haha

Serge'' says:

<CENSORED MAGIC METHOD EXPLANATION>

Serge'' says:

<CENSORED MAGIC METHOD EXPLANATION>

Serge'' says:

<CENSORED MAGIC METHOD EXPLANATION>

Bryan says:

hm

Bryan says:

perfect =)

Serge'' says:

it's how most sane people go about it

Serge'' says:

but not mark, he's too cool for optimisations

Bryan says:

lazy

Serge'' says:

and rhys is just too fail

Bryan says:

he keeps trying to be um.

Bryan says:

how do you cal lit .. =/

Bryan says:

damn

Bryan says:

I don't know the english word for it

Bryan says:

*sigh*

Serge'' says:

trying to look cool?

Bryan says:

no..

Bryan says:

like hermoine in the harry potter movies

Bryan says:

someone who knows to much

Serge'' says:

problem is, he doesn't

Bryan says:

yea

Serge'' says:

I should post this chatlog as a comment to him

Serge'' says:

and censor out the technique

sirxemic 17 years, 8 months ago

DIE!

sirxemic 17 years, 8 months ago

Both of you (Bryan and GearGOD)!

sirxemic 17 years, 8 months ago

DIEEEEEEEEEEEEEEEEEE!

Bryan 17 years, 8 months ago

haha

sirxemic 17 years, 8 months ago

Yay Bryan quoted one line for me:

"and you don't clear it"

But that's all [:(]

GearGOD 17 years, 8 months ago

Adam says:

Understand understand

Adam says:

Understand understand

Adam says:

Understand understand the concept, the concept of love.

Serge'' says:

love is easy to understand

- Harley says:

Ever fallen in love with someone you shouldn't've fallen in love with?

Serge'' says:

love is miranda

Adam says:

Love is fake.

Serge'' says:

no you are

Adam says:

Lolol

Serge'' says:

YOU'RE FALING APART

Adam says:

LOVE IS A CHEMICAL SIR.

sirxemic 17 years, 8 months ago

I am sorry what are you trying to say with that?

flashback 17 years, 8 months ago

That it is most vital for the chicken-laced Tostitos to triumph over the Dorito hordes.

Requiem 17 years, 8 months ago

@ GearGOD:

A simple "I know how do it, but I won't tell you 'cause I hate you." would suffice.