Author Topic: Tile Map Editor  (Read 9094 times)

0 Members and 1 Guest are viewing this topic.

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Tile Map Editor
« on: February 19, 2021, 04:17:44 pm »
Hi All

I guess this has already been done before but as its on my to do list and I want my next game to be tile based (struggling for a theme) I decided to have a go.

This version only works with tiles as individual png files the zip includes a set I made in MS Paint if you want to add tiles they need to have "tile" in the file name and be saved into the images folder.

It can save and load maps using the buttons across the top of the screen.
 
Screenshot tile map editor 4.png


 

The next version will include the option to use tile sheets.

Looking for feedback and suggested improvements or features to add.

Usage
Set map & tile size with buttons, use mouse to select a tile from the columns on the right then mouse click on the map to place the tile.

Brian ...
« Last Edit: March 20, 2021, 12:17:05 pm by 191Brian »
Brian ...

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tile Map Editor prototype
« Reply #1 on: February 19, 2021, 06:26:20 pm »
Where's Steve? I see his farm... but where's Steve-O?

Nobody cares if it's been done before, we only care that it's done better than before! Actually, we don't really care about that, either. Whatever trips your trigger, and you are willing to share, is a win around here. From the screen shot, it looks like you have a first rate project coming along. Now back to the other important stuff, where's Steve?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tile Map Editor prototype
« Reply #2 on: February 19, 2021, 07:14:54 pm »
I luv this, simplicity and specially the size that is less than Pete's string math by couple of 100 lines!

@191Brian  You might separate tiles a tiny bit so you can see the edges. Man I admire the dedication, time and energy all you guys take to get all these tiles going in a game.

@johnno56 should check this out!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tile Map Editor prototype
« Reply #3 on: February 22, 2021, 06:36:11 am »
Tile map Editor... Cool.

Took it for a spin. No errors. But no tiles either... I'm going to guess the 'Shell' function could be my problem as it does note produce a list of tiles... I think this might be another Windows / Linux thing... Time for research...
Logic is the beginning of wisdom.

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Tile Map Editor prototype
« Reply #4 on: February 22, 2021, 06:48:46 am »
Hi Johno

Yes I should have mentioned it uses a shell cmd to get a list of tile file names.

Lines 388 & 395 would need to be changed to the Linux command line syntax and maybe change \ to / .I sold my only Linux PC last month and haven't got around to setting up a spare laptop with some flavour of Linux yet which distro do you use?.

Brian ...
Brian ...

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Tile Map Editor prototype updated version 0.3
« Reply #5 on: February 22, 2021, 10:16:08 am »
Hi All

See attached an updated version.
Added the ability to load tile/sprite sheets, assumes the file is in the images folder and that the individual tiles are the current tile size without any padding. I have included a sheet for a house called housered128x128.png. If you save a map which uses a tile sheet you need to load the sheet before you load the map currently.
Added outline around the tiles.
Added _KEYCLEAR to the user input routine to fix a bug were it jumped past the input statement.
Added a couple more tile images.
 
Screenshot tile map editor 5.png


Brian ...
Brian ...

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tile Map Editor prototype
« Reply #6 on: February 22, 2021, 11:09:53 am »
The reason I drag @johnno56 in, is that we worked (or he started I took over) on what he calls Sprite Editor but I would call Tile Editor, piece of cake to adapt to 32 x 32, just 2x's the demo screen shot sizes we were doing. Towards end I had it setup for N x N tiles (I think, its been awhile).  We got it working in Linux then Johnno abandoned?
 
Anyway if you are interested, the resizable version are here if I recall:
https://www.qb64.org/forum/index.php?topic=313.msg122756#msg122756

I think his flavor is Mint chocolate chip, wait... is that my mother's favorite ice cream?

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tile Map Editor prototype
« Reply #7 on: February 23, 2021, 05:42:56 am »
Oh. Very funny.... Chocolate is NO laughing mater... lol

Very nice program....

I had already cobbled together some changes so I could load the tiles... Not 100% but close enough to create and save a 'map'... This is way faster than creating a single sprite at a time with our editor,,,

Just downloaded v 0.3 and will try it out after posting....

J
« Last Edit: February 23, 2021, 06:00:31 am by johnno56 »
Logic is the beginning of wisdom.

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Tile Map Editor prototype
« Reply #8 on: February 23, 2021, 06:20:44 am »
Very true chocolate is a serious subject.

Great idea I hadn't thought of using it as a pixel editor but as it has the scale option it would work fine and you could easily generate a sheet of coloured pixels as your pallet.

Have some more updates planned now i have heard about filedrop plus giving you the option to choose the folder it looks for images a couple more tweaks and refactoring some code.
Brian...


Oh. Very funny.... Chocolate is NO laughing mater... lol

Very nice program....

I had already cobbled together some changes so I could load the tiles... Not 100% but close enough to create and save a 'map'... This is way faster than creating a single sprite at a time with our editor,,,

Just downloaded v 0.3 and will try it out after posting....

J
Brian ...

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tile Map Editor prototype
« Reply #9 on: February 23, 2021, 06:36:01 am »
Ok. Installed and edited the new version. I already had a tile sheet to test. It's an 8x8 sheet of 32x32 pixel tiles.

I found 8x8 was too many. See attached. I think the problem is: When the program starts, it automatically loads the tiles in the list first in the background, then when 'load sheet' is selected it then 'adds' the sheet tiles to the already displayed list tiles. Program caters for 4 columns of 20 tiles (80). 8x8 sheet of 64 plus the already loaded 20.... (see attached)
 
Screenshot from 2021-02-23 22-07-00.png


Perhaps,  the option of selecting a list of tiles OR a sheet of tiles when load is selected? Or maybe I could have used a smaller sheet... lol

Changed the sheet to 7x7 tiles and that worked fine. (see attached)
 
Screenshot from 2021-02-23 22-33-21.png


J
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tile Map Editor prototype
« Reply #10 on: February 23, 2021, 06:39:08 am »
No. No. Don't use it as a pixel editor... Far too many headaches. Tile map editor is cool...
Logic is the beginning of wisdom.

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Tile Map Editor prototype
« Reply #11 on: February 23, 2021, 08:02:16 am »
Its great to see it being used!

The next update should address some of those issues and retain the ability mix individual tiles and sheets.

Brian ...
Brian ...

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Tile Map Editor prototype Question
« Reply #12 on: February 23, 2021, 09:17:04 am »
Hi All

As I have no experience of creating tile based games I would like to know what is reasonable of size map the editor should cater for?

Also is it fair to assume any potential user would have a screen at least 1366x768 ?

Brian ...
Brian ...

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tile Map Editor prototype
« Reply #13 on: February 23, 2021, 03:44:29 pm »
Interesting question. Not easily answered. Ok. My opinion.... Standard screen size for a tile-based game.... Because everyone has the potential of having different screen dimensions, going with what "fits all", is the place to start. Tile size has a say in it as well. If you are using 8x8 or 16x16 or 32x32 etc, make sure that your map can fit evenly for the screen you chose. eg: 640x480 @ 32x32 will give you 20x15 tiles. 1024x768 @ 32x32 will give you 32x24 etc.. Starting with either of these sizes would be fine.

Old classic tile-based games were "fixed screen". ie: Get across the screen to exit; new screen is drawn; player back to left of screen. Then along comes screen scrolling. Suddenly the "camera" can now "follow" the player across, what seems to be, an "endless loop" of scenery. ie: Mario Brothers. My suggestion. Start with a "fixed" screen. "Scrolling" will give you a "nicer feel" to the game but as I have almost no experience with scrolling, fixed is all I can suggest.....

I not sure if all this helps. If not, I 'am' sure, that the other guys would have better suggestions... lol

J
« Last Edit: February 23, 2021, 03:49:16 pm by johnno56 »
Logic is the beginning of wisdom.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Tile Map Editor prototype
« Reply #14 on: February 23, 2021, 03:58:55 pm »
My suggestion is to draw whatever size map you need, up to 65,535x65,536 pixels in size.  With a 64x64 sprite, you can have 1024x1024 squares on your grid...

Then simply _PUTIMAGE the segment you want onto the display screen.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!