[Wiki]Everything there is to know about TAS Mode

Supergood!

3 Likes

Hi guys,

So, some good news in PyInSky:

Did a simple print of memory free and this is the results:

# Lowres
#21696 - buffer
#24064 - tas

#highres
#7488 - buffer
#23296 - tas

Iā€™m blown away that highres TAS leaves more RAM than lowres buffer mode!

Some questions:

  1. Iā€™m not sure how to draw the sprites and tiles in Python as Iā€™ve yet to find an example/wiki that shows it. Maybe someone can add/update the Tilemap example in the editor?
  2. How do you set the tile size and sprite amount?
3 Likes

Itā€™s all the same as one of the buffered modes. Just switch to TAS and thatā€™s it.
For now, youā€™ll still be limited to 16 colors. Iā€™m not sure if it makes sense to try to use 256 in MP as flash space would run out more quickly.

Oops, I forgot to add that. :eyes:
I just added them to the flags tab, below resolution.

3 Likes

Tested the TAS modes with a tilemap example:

  • Normal low res: free: 21072 bytes
  • TAS lowres&hires (max 10 sprites): free: 24848 bytes

That is like expected and really good to have the extra memory!

The tilemap and sprites work really well in emulator and HW. The only problem I found is that text drawing do not work (should it work yet?). Only the end of the text is visible:

I also tweaked the tilemap example. Made the map bigger and adapted the game to the high resolution also. It works now in all modes: lowres/hires & normal/TAS.
Tilemap (4).zip (7.3 KB)

4 Likes

You ran out of sprites. If you set the max back to 100 it should show the entire text.

Oh, I did not rememeber that each character takes a sprite :slight_smile:
Works now!

The text in the settings could be ā€œTAS max sprite count / text lengthā€.
Edit: Or rather "TAS max sprite and char count.

1 Like

@jvdw007 please ask the q you had to me.about sprites to get a faster answer

Ok. So now I understand it a bit better now: you use the same commands as before. Nothing changes. Same screen.blits, same tilemap.draws.

So my questions are:

  1. If I use screen.blit for each thing on the screen, that is assumed to be a single sprite, yes?
  2. What if i use screen.blit for a background that covers the screen? How does that affect/work with TAS then?
  3. Am I misunderstanding the purpose of pygame.display.flip() ? I thought that was using buffer mode, and if so, then why is it still needed in TAS?
  4. In your discussion furrther up in the thread, you speak about drawing HUDs (Masking for text/graphics etc). How would that work in Python?
2 Likes

Yes. Just watch out for text where each character is a single sprite as well.

Sprites can be of any size, so that will work. It just wouldnā€™t be very efficient because it would still be drawing tiles behind your background sprite.

Just think of flip as the function that displays the result of your drawing operations.

Instead of having a buffer that gets uploaded to the screen when you call flip, TAS has a list of sprites that get composited together with the tiles and the result gets sent to the screen in flip.

It isnā€™t available to Python yet. Iā€™m open to suggestions on what the best way to do this would be.

One alternative that is being considered is adding an optional Menu layer over the TAS for things like windows and monospaced text.

1 Like

Thanks for clarifying Filippe. Makes much more sense now. What about if wanted, say, to keep the bottom two rows of 16px high tiles for a permanent HUD? Can I specify how many rows of tiles to draw so as not to waste ram and CPU rendering tiles underneath that?

1 Like

Thatā€™s exactly what masks are meant to do. Making full use of masks is going to be tricky in python, though, so weā€™re going to have to think about this specific scenario a bit.

2 Likes

@FManga When you have a chance, please update the tile map demo in Pyinsky with this: Tilemap5.zip (7.3 KB)
Very little have changed, but this demo works out-of-the-box with ā€œTAS Hiresā€ mode.
No need to update before the Punk Jam, if you are in a hurry.

When you are at it, please update this too :wink:

1 Like

How do I use a map other than gardenpath?

  • Put your own TMX in the maps folder.
  • Click on Scripts -> Convert TMX
  • Call tilemap.set with your own map, the same way that is done with gardenPath.
1 Like

Does my own map need to formatted a specific way? have specific layers or layer names? anything like that, because I already tried that.
My map is called level01.tmx and i get the following error -

'int main()':
C:\\Program Files\\FemtoIDE\\projects\\Joe\\main.cpp:17:17: error: 'level01' was not declared in this scope
     tilemap.set(level01[0], level01[1], level01+2);
                 ^~~~~~~

Havenā€™t tried it myself, but are you missing an include?

Do you see it in maps.h?

Nope, only gardenpath.

Do you get any error when you run Convert TMX?

Edit: Can you send me the project?
Edit 2: Problem solved.

I made a separate demo which is set in the TAS Hires mode already (ā€œTilemap TASā€), the other one is in the normal (non-TAS) low-res mode ("Tilemap). Please, put both these demos in PyInSky. Even if they use exactly the the same source code it is more clear to have separate demos.
Tilemap TAS (1).zip (7.7 KB)
Tilemap5.zip (7.3 KB)

4 Likes