Author Topic: Tilemap Editor  (Read 26908 times)

0 Members and 3 Guests are viewing this topic.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #30 on: July 08, 2010, 06:10:39 pm »
found out why; i was using I as a tempvar in a for() loop.

also, once axe has geometry drawing i'll implement the menu for selecting tiles. the framework is all there, i literally just need the command to draw a hollow rectangle to select the correct tile. right now i've implemented saving/loading 3 tilemaps and their unique tilesets. if you try to load a tilemap/set that you have not saved to, you will get a RAM clear. i'm fixing this now.

quick question. if i wanted to archive an appvar, which of the following would work
Code: [Select]
"vMYAPPVAR"->Str1
Archive GetCalc(Str1)->I
Code: [Select]
"vMYAPPVAR"->Str1
Archive Str1

the way it's worded in the command index, it seems the second would work.



_player1537

  • Guest
Re: Tilemap Editor
« Reply #31 on: July 08, 2010, 08:10:21 pm »
The second one would work.  Glad you got your program to work ^_^

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tilemap Editor
« Reply #32 on: July 09, 2010, 01:28:26 am »
found out why; i was using I as a tempvar in a for() loop.
I hate when I try finding a bug and it takes me so long to discover it's a variable conflict x.x. Glad you got it fixed.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #33 on: July 09, 2010, 04:14:41 am »
alright, so i've managed to get it to work for the most part. loading a map that doesn't exist will not crash your calculator, just returns the program. once or twice i've had the problem where tileset 1 has size 4x4, tileset 2 has size 8x8 and for an odd reason when you load tileset 2, the tiles become 4x4. exiting the program and reloading the tileset fixes this, i'm not sure why since the bytes where the sizes of the tiles are stored aren't modified if you exit the program prematurely.


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tilemap Editor
« Reply #34 on: July 09, 2010, 05:53:28 pm »
4x4 tiles seems quite interesting. I wonder what could be causing the bug though?

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #35 on: July 16, 2010, 04:06:09 pm »
new release (:
some new things:
-primitive tile selection menu
-saving and loading!
-better navigation
those are the big improvements, now for describing how to use the program
main menu:
1- create a new tilemap and tileset, asks for size of tiles afterwards, 4-8.
2- load a map. if you try to load a nonexistent map, the program exits.
3- doesn't actually quit. what can i say? i'm lazy on the easy things.
clear- quits.


tileset editor:

arrow keys - move cursor
2nd - invert pixel
+ - go to the next tile, if tile number is not 15.
- - go to previous tile, if tile number is not 1.
mode - invert all pixels of the tile
del - clear the tile.
window/F2 - go to the tilemap editor

tilemap editor:

arrow keys - move cursor
2nd - display the next tile in the tileset. loops to 0 if the current tile is the last in the tileset
alpha - display previous tile in the tileset. loops to the end of the tileset if the current tile is blank.
clear - quit.
0 - clear the tile. (set it to 0 in the tilemap)
math - bring up tileset menu. press 2nd to select a tile in the tileset menu.
y=/F1 - go to tileset editor.
enter - save to the appvar. there are 3 slots to save to.

known bugs:
- sometimes the correct tile size will not be loaded from the appvar. to prevent this, restart the program then create a new tileset with the desired size. restart the program again and loading a tileset will have the desired size.
- in the tilemap editor, tile selection using 2nd and alpha will not work if you didn't exit the tileset editor on the last tile. so say you have five tiles 1 2 3 4 and 5. in order for the program to work, when you exit the tileset editor to the tilemap editor, make sure the tile you're on is tile 5. i *think* this is only a bug for loaded tilesets. it's especially annoying because i need 3 more bytes in the appvar to specify the number of tiles in the tileset so the tilemap editor will loops correctly.

let me know of any bugs... the appvar name is TILEMAP.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tilemap Editor
« Reply #36 on: July 19, 2010, 06:05:20 pm »
Wow just tried it and it's nice. However, I have some suggestions to make it easier to use:

It would be nice if we could assign specific tiles to number keys from 1 to 9, allowing us to instantly change to that tile when editing the map.

Another suggestion would be to not limit ourselves to 3 maps, else it would kinda suck if in a game, we only had 3 maps or if we had to split our map data in multiple appvars. Maybe when variable exporting is possible, add a feature to export a map into a string or an option to export the entire map data.

I made a screenshot of it in action, btw :)

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #37 on: July 19, 2010, 06:26:50 pm »
thanks DJ. i like the assigning specific tiles idea, though i'm not sure how the keypad hardware will cope with it. i'll experiment. also, i plan on not limiting to 3 maps. for now, how many maps do you suggest i permit? 1) later on i'm going to RLE compress all the maps in the appvar so you can have more maps. 2) once you can export maps into strings this program will become MUCH more useful. i'm planning on there being options to  have 1 byte = 1 tile in the map, have it half-byte compressed (limit on the tiles though), have it RLE compressed where 1 half byte is the frequency and another half byte is the tile number, and lastly have it RLE compressed where 1 byte is the frequency, and the next byte is the tile number (which would allow for 255 tiles to be fit into two bytes... imagine that.) if anyone has any other preferred compression algorithms i would love to hear them. especially pucrunch. all i need is a commented example of pucrunch and i can hopefully try to implement it.

just so i know where i'm headed, i'm going to make a quick checklist here. they're prioritized:

Tileset.
[] fix looping bug. use the max() command. add some bytes in the appvar.
[] export tiles as hex string
[] load tiles from within the tileset to another tile to make slight variations.
[] set specific tiles as corresponding keys for the tilemap editor
[] allow editing of 16x16 tiles.

*note: allowing more than 15 tiles isn't on here because that's really easy to implement. i'm keeping it basic for now.

Tilemap.
[] export map as hex string
[] compress the hex string in various ways
[] placing tiles via pressing specific keys (such as 1-9, though it may be sin, cos, tan, ",", "(", and ")".)
[] tilemaps greater in size than the screen.
[] 16x16 tile placement.

as soon as 4.0 comes out with BASIC vars, i'll crack away at this. until then, im going to work on my axe contest project (:


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tilemap Editor
« Reply #38 on: July 20, 2010, 12:00:16 am »
I think 10 maps would be enough. Maybe let the user decide? (as long as he has enough RAM)

Good luck on this and your Axe entry :)

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Tilemap Editor
« Reply #39 on: July 20, 2010, 12:54:57 am »
What about grayscale support?

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #40 on: July 20, 2010, 01:54:16 am »
in what way? since it's just a tilemap editor, it's really only a list of numbers that it'll output, and some hex strings for the corresponding tiles. adding in grayscale is a programmer's choice, since you represent grayscale through tiles and tilesets, not the actual tilemap. I don't think a grayscale tileset editor is necessary, seeing as you can always user Runer112's sprite editor to much more efficiently make grayscale tiles.


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tilemap Editor
« Reply #41 on: July 20, 2010, 02:07:46 am »
Nemo, I think you really need to be careful to how you reply to other people on the forums. Normally your posts are perfectly fine, but since the past 24 hours, I noticed a drastic change of tone in your messages, this one being an example. The way you are replying to graph (the "In what way?" part) sounds like you are jumping on him and are not welcoming any suggestion. If you don't want any suggestion then tell us, but remember that with certain other forum members, especially newbies, you could make people leave that way and then Omnimaga could get a reputation of being rude to new members, something UTI and TIBD got for a while (and killed them for a while too) and that I don't want here.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #42 on: July 20, 2010, 02:27:29 am »
Sorry DJ. i meant "In what way" as an actual opening to suggestions, as i do not know how i might implement grayscale into a tilemap editor. I want to know what exact type of grayscale support graphmastur means, to see if it would be a useful feature to the program.


Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Tilemap Editor
« Reply #43 on: July 21, 2010, 04:15:35 pm »
Well, like having grayscale tile support.  So I can actually see how it looks within one application.

It's okay, btw, I didn't find it rude, but like Nemo meant it.  I don't know how you would implement it.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Tilemap Editor
« Reply #44 on: July 21, 2010, 04:24:15 pm »
hmm, i see what you mean. i don't think i will though, because then i need to store more information in the appvar. especially with 4-level grayscale. right now with monochrome, each tile is 8 bytes. with 4-level grayscale, each tile is 24 bytes (8 bytes for the black layer, 8 for the light gray layer and 8 for the dark gray layer). so even if you just wanted 15 tiles in a tileset, that's already 360 bytes that has to be stored in the appvar. although i like the feature idea, it'd be more memory efficient to keep the tiles monochrome, and let the programmer add in shades of gray.