It is currently Tue Aug 21, 2018 10:34 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: 2d tiled map making
PostPosted: Tue Jul 31, 2018 8:44 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 45
Location: Netherlands
I was looking for map making program on the internet and not one tile map making program has a script or export to suit Purebasic.
Until i came across a program TileStudio. Its not realy designed for Purebasic. But it had a build in option to create a exporting script to make the export file ready to use in PureBasic.
The code was not easy but i got it right. And the export is error free as include file for Purebasic (I tested this on PB 5.62)
I uploaded the code to the real programmer for the program ts. Including animation and bounding boxes. Finnaly something thats work.

The program is a zip file that you can unfold where ever you want and run in any folder you want. The learning curve is a little bit hard and not always strait forward but when you got it, its very nice to use it.
The program is downloadable from:
http://tilestudio.sourceforge.net/

When the PureBasic export file is not in the zip file, please e-mail me and i wil send the file to you.
My e-mail: bart_fernhout@hotmail.com
N.B. Do not try the TileStudio2. Its far from complete and the export is only in lua. Unless you know how to use the LUA library.

When i got time i wil make a complete manual including examples to use the Ts.exe program.

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Sat Aug 04, 2018 6:15 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1981
Location: USA
I guess you didn't search this forum for one. Anyways, glad you got done what you needed.

viewtopic.php?f=16&t=51017&hilit=tiled

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.9.5 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: XP SP3 / AMD 64 4000+ / 1GB DDR / ATI 9250


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Mon Aug 06, 2018 10:54 am 
Offline
User
User
User avatar

Joined: Sun Jun 24, 2018 12:28 pm
Posts: 31
Location: Holland
bfernhout wrote:
I was looking for map making program on the internet and not one tile map making program has a script or export to suit Purebasic.
Until i came across a program TileStudio. Its not realy designed for Purebasic. But it had a build in option to create a exporting script to make the export file ready to use in PureBasic.
The code was not easy but i got it right. And the export is error free as include file for Purebasic (I tested this on PB 5.62)
I uploaded the code to the real programmer for the program ts. Including animation and bounding boxes. Finnaly something thats work.

The program is a zip file that you can unfold where ever you want and run in any folder you want. The learning curve is a little bit hard and not always strait forward but when you got it, its very nice to use it.
The program is downloadable from:
http://tilestudio.sourceforge.net/

When the PureBasic export file is not in the zip file, please e-mail me and i wil send the file to you.
My e-mail: bart_fernhout@hotmail.com
N.B. Do not try the TileStudio2. Its far from complete and the export is only in lua. Unless you know how to use the LUA library.

When i got time i wil make a complete manual including examples to use the Ts.exe program.



Hey bfrenhout...,

I plans for the next time, to try understand programming code (or train my self to understand code languale with read it),
so thad i hope to goes from beginner to more expert... now i am train code languale reading, just to read code thad i see
on google or forums per-rule and try play with it (do not think thad i make an 'copy paste' game..., only i try to play with
some codes, to understand programming more)...

Just this is an new training project for my programming study, and at the 'GlazenPui, i plans to try program the game,
called BouncingBall... and at hone, i try more to understand code programming in purebasic to looks at google and
this forum yet...


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Thu Aug 09, 2018 10:14 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 45
Location: Netherlands
Jamie that is very good.

Read at much as possible and try to understand why something is done. Then you can copy their code, and adjust it to your need.
When that is working you understand the coding and can go forward.

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Thu Aug 09, 2018 10:22 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 45
Location: Netherlands
To jbaker.
I did search the whole Pb forum and your stuff was never comming up. I tryed to search under
- Tile
- Tilemapping
- Tiled
- map making
- map
- maps

None of the above directed me to you page. But luckly you did see mine page.
Thanks for the direction. Many thanks.

N.B. There is a little drawback on a win 10 machine to use the Tiled program. When making a connected image, of a couple of tiles and you copied them, there is no way you can past them.
That is a shame, cause i liked the program a lot. Its easy and fast learning to. And the crap that all other tile map making programs give you is a lot of non essential stuff. wih make the files to big.
I hope you found already a to work with that.

Thanks again. I start reading your comment given and try to work it out.
bart.

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Thu Aug 09, 2018 10:29 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 45
Location: Netherlands
For the people who want to use the tiled app. Here a little add on:

This is the translation code for tiled:

Code:
; --------------------------------------------------------
; Tile Studio Definition file for use with PureBasic
; (http://www.purebasic.com/)
;
; PureBasic can include the file. Using IncludeBinary
; The include must be inclosed by DataSection ...
; EndDataSection.
;
; Version 1.01 - Juli 31, 2018
; Build 0005
; In this file the drawing tile is set with #PB_2DDrawing_Transparent
; This is done because all tiles are loade as sprite that can handle
; the transparent color
; Bart Fernhout (bart_fernhout@hotmail.com)
; --------------------------------------------------------

; --- bitmap file ----------------------------------------

#tileset
#tilebitmap graphics\\<TileSetIdentifier>.bmp 320
#end tilebitmap
#end tileset

; --------------------------------------------------------

#file <ProjectName>_include.pb
#; ---------- Generated by Tile Studio ----------
declare MapWidth(map)
declare MapHeight(map)
declare TileWidth(map)
declare TileHeight(map)
declare GetTile (Map, x, y)
declare GetBounds (Map, x, y)
declare DrawTile (Map, x, y, tile)

#tileset
#map
Global LAYER_<TileSetIdentifier>_<MapIdentifier> = (<TileSetNumber> \<\< 8) + <MapNumber>
#end map
#end tileset

#; get map width (tiles)
Procedure MapWidth (map)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      ProcedureReturn <MapWidth>
#end map
#end tileset
  EndSelect
 
EndProcedure

#; get map height (tiles)
Procedure MapHeight (map)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      ProcedureReturn <MapHeight>
#end map
#end tileset
  EndSelect
 
EndProcedure

#; get tile width (pixels)
Procedure TileWidth (map)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
     ProcedureReturn <TileWidth>
#end map
#end tileset
  EndSelect
 
EndProcedure

#; get tile height (pixels)
Procedure TileHeight (map)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      ProcedureReturn <TileHeight>
#end map
#end tileset
  EndSelect
 
EndProcedure


#tileset
Global <TileSetIdentifier>Bitmap = LoadImage (#PB_Any,"graphics\\<TileSetIdentifier>.bmp")
Global <TileSetIdentifier>_Width = <TileWidth>
Global <TileSetIdentifier>_Height = <TileHeight>
Global <TileSetIdentifier>_Count = <TileCount>
Global MaskImage.q = RGB(<TransparentColorR>, <TransparentColorG>, <TransparentColorB>)

Global <TileSetIdentifier>_Columns = ImageWidth(<TileSetIdentifier>Bitmap)/<TileSetIdentifier>_Width
Global <TileSetIdentifier>_Rows = ImageHeight(<TileSetIdentifier>Bitmap)/<TileSetIdentifier>_Height

#;Split all images to a Array
Global Dim <TileSetIdentifier>_Array(<TileSetIdentifier>_Columns * <TileSetIdentifier>_Rows)
#;Draw the image to the screen for sprite picking
startdrawing(ScreenOutput())
DrawImage (ImageId(<TileSetIdentifier>Bitmap),0,0)
StopDrawing()
z = 0
For y = 0 to <TileSetIdentifier>_Rows-1
  For x = 0 to <TileSetIdentifier>_Columns-1
    <TileSetIdentifier>_Array(z) = GrabSprite(#PB_any,x*<TileSetIdentifier>_Width,y*<TileSetIdentifier>_Height,<TileSetIdentifier>_Width,<TileSetIdentifier>_Height)
    TransparentSpriteColor(<TileSetIdentifier>_Array(z), MaskImage)
   z+1
  next
next

;#Remove the drawing drom the backbuffer
clearscreen(0)

#map
Global Dim <TileSetIdentifier><MapIdentifier>Map (<MapHeight>, <MapWidth>)
Restore <TileSetIdentifier><MapIdentifier>MapData
For y = 0 To <MapHeight> - 1
  For x = 0 To <MapWidth> - 1
    Read.i <TileSetIdentifier><MapIdentifier>Map (y, x)
  Next
Next

DataSection
<TileSetIdentifier><MapIdentifier>MapData:
#mapdata  "\nData.i "  ","  "\nData.i "  "\nData.i "  ""
<TileNumber:"%3d">
#end mapdata
EndDataSection

Global Dim <TileSetIdentifier><MapIdentifier>BoundMap (<MapHeight>, <MapWidth>)
Restore <TileSetIdentifier><MapIdentifier>BoundMapData
For y = 0 To <MapHeight> - 1
  For x = 0 To <MapWidth> - 1
    Read.i <TileSetIdentifier><MapIdentifier>BoundMap (y, x)
  Next
Next

#; tile size: w = <TileWidth>, h = <TileHeight>
DataSection
<TileSetIdentifier><MapIdentifier>BoundMapData:
#mapdata  "\nData.i "  ","  "\nData.i "  "\nData.i "  ""
 <BoundMapValue>
#end mapdata
EndDataSection
#end map


#sequence
#;Animation tile sequence
<TileSetIdentifier>Seq<SequenceNumber>$ = Chr(<SequenceNumber>) +
#sequencedata  ""   " + "  ""
Chr(<TileNumber>)+Chr(<FrameCount>)
#end sequencedata
#end sequence

global Dim <TileSetIdentifier>Sequences$ (<SequenceCount> + 1)
#sequence "\n"
<TileSetIdentifier>Sequences$ (<SequenceNumber>) = <TileSetIdentifier>Seq<SequenceNumber>$
#end sequence

#map
#; <TileSetIdentifier><MapIdentifier>Layer
#; movement (x, y) = (x = <ScrollX>, y = <ScrollY>)
#end map

#end tileset


#; get tile number at position (x,y)
Procedure GetTile (map, x, y)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      ProcedureReturn <TileSetIdentifier><MapIdentifier>Map (y, x) - 1
#end map
#end tileset
  EndSelect
 
EndProcedure

#; get bounds/map code at position (x,y)
procedure GetBounds (map, x, y)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      ProcedureReturn <TileSetIdentifier><MapIdentifier>BoundMap (y, x)
#end map
#end tileset
  EndSelect
 
EndProcedure

Procedure DrawTile (map, x, y, tile)

  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
     DisplayTransparentSprite(<TileSetIdentifier>_Array(tile), x, y)
#end map
#end tileset
  EndSelect
 
EndProcedure

#; ---------- end of generated file ----------
#end file

; --------------------------------------------------------


This code create a 100% pureBasic include file. Just export the file trough Shift F10 select code and then F10 to export the code.
When the notification comming up the creation of PureBasic file is done.

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Thu Aug 09, 2018 11:09 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 45
Location: Netherlands
A little extra information.

The file i put online is ment for the TileStudio.
You can download it:
http://tilestudio.sourceforge.net/

Keep in mind this is not TILED who is also a great map editor
I only like this more cause of the exporting option to 100% PureBasic.

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Fri Aug 10, 2018 6:24 am 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1981
Location: USA
bfernhout wrote:
To jbaker.
I did search the whole Pb forum and your stuff was never comming up.

That's ok. Now there's another option with a different tile app. The more the merrier. :D

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.9.5 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: XP SP3 / AMD 64 4000+ / 1GB DDR / ATI 9250


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Fri Aug 10, 2018 3:22 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 45
Location: Netherlands
Thank you.

Tiled is also a option i wil look into. I know there are some more option in tiled and sometimes i think why not do it ourself
and the make one only for PureBasic.

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2d tiled map making
PostPosted: Thu Aug 16, 2018 10:02 am 
Offline
User
User
User avatar

Joined: Sun Jun 24, 2018 12:28 pm
Posts: 31
Location: Holland
Hey Bart...,

Now i am still in programming level 1 and go forwards to programming level 2.... just i am at my
work (the Glazen Pui Arduin, Vlissingen), Working to write an klad, called for the game named Bouncing Ball...

But with the Sin and Cos, i must still try your code, you get written for my om an paper..., but to evening,
i think i don't get time to try your code, just my Personal Regisure is comming for me..., but i hope to do this to
morrow
or s'weekends (friday, saterday or sunday if i get time to try your code for the radian calculation)...

At my work, i am working on the game, named bouncing ball, still to write the code on an .txt klad document... now i get writted
the Main file and the Lib file in each an .txt doc (now i get two .txt documents, called the Main and the
Lib Script...)


bfernhout wrote:
Jamie that is very good.

Read at much as possible and try to understand why something is done. Then you can copy their code, and adjust it to your need.
When that is working you understand the coding and can go forward.


Thanks....,

But for understand high complex code, i think thad i must first grow further to an higher programming level to
understand more complexivity in programming....

In Programming Level 5, i want to learn write software, applications and even build robot machines with arduino and
even work with 3d-printing... But this is for an big time later, now i am still programming level 1 and later hope to goes
from level 1 to level 2 with programming... Even, if i am learn Programming Level 5, My main goal is to be an advanced
hobby programmer at complex graphical and sciensifical 2d and 3d software applications, website(s), 3d printing and
even robot machine building, called with CAD and Arduino... and even work in other languales like C++, Java and
Python...

But this is for an big time later..., first i am focus my self on 2D-Games to learn the basic principles of programming,
use PureBasic to learn programming... now i plans to round up programming level 1 and go rustly to programming level 2...,
in level 2, i hope to train my self in complexer programming techniques sush like platform games like zool and mario and
maby some 2d-librarys (.pbi scripts)...

Thanks for your programming teaching,
To Sunday, Jamie.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye