Results 1 to 4 of 4

Thread: Tileset loading...

  1. #1
    Serf
    Join Date
    Oct 2008
    Posts
    4

    Default Tileset loading...

    Has anyone considered loaders for Mappy http://www.tilemap.co.uk/mappy.php or Tile Studio http://tilestudio.sourceforge.net/ ? A search through the forum didn't turn up anything...

  2. #2
    Squire
    Join Date
    Jul 2008
    Posts
    12

    Default

    Quote Originally Posted by Sirius2D View Post
    Has anyone considered loaders for Mappy http://www.tilemap.co.uk/mappy.php or Tile Studio http://tilestudio.sourceforge.net/ ? A search through the forum didn't turn up anything...
    The editor itself has a built in pseudo tile editor. I recommend it over 3rd party editor since everything is more "integrated".(you know, edit tiles and add edit the game logic at the same time)
    Lua's io library is also disabled for security reasons but it's easy to re-enable it.
    However, the problem is:
    After reading the C++ code, I find no method to add a tile to the game world so that I can bind it to lua. I tried to trace the code to see how the editor add tiles and found out that the process is quite complex(cloning than add to the correct layer...).

    It would be nice to be able to add tiles from script. I'm planning to do a roguelike game. It's impossible for now to generate random dungeon.

  3. #3
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,377

    Default

    Sirius2D: Has anyone considered loaders for Mappy http://www.tilemap.co.uk/mappy.php or Tile Studio http://tilestudio.sourceforge.net/ ? A search through the forum didn't turn up anything...
    It surely would be possible... for an early test I wrote an importer that converted the entire Dink Smallwood map and that could be used as an example.

    It's in GeneratorDink.cpp, to see it you would have to enable it in the source by uncommenting:
    Code:
    //pItem = m_pMenu->create_item("Utilities/Import from Dink Map");
    //m_slot.connect(pItem->sig_clicked(),this, &EntEditor::OnGenerateDink);
    in EntEditor.cpp.

    bullno1: After reading the C++ code, I find no method to add a tile to the game world so that I can bind it to lua. I tried to trace the code to see how the editor add tiles and found out that the process is quite complex(cloning than add to the correct layer...).
    The editor methods are a little complex because of the way it saves everything into undo buffers.

    For a straightforward way to add a tilepic from C++ the Dink example shows a way:

    Code:
    	pTile = new TilePic;
    			CL_Vector2 localDestPos = CL_Vector2(x*tileSize, y*tileSize);
    			
    			pTile->SetPos(localDestPos+vecOffset);
    			
    			pTile->m_rectSrc = rectSrc;
    			pTile->m_resourceID = FileNameToID(st.c_str());
    			if (!GetHashedResourceManager->GetResourceByHashedID(pTile->m_resourceID))
    			{
    				throw CL_Error("Unable to locate tilescreen "+st);
    			}
    			//figure out where to put it
    
    			g_pMapManager->GetActiveMap()->AddTile(pTile);
    In the above, "st" is a string that holds the bitmap file name, and rectSrc holds the rect that it should use of the bitmap.

    You're right, it isn't possible to add a tilepic from lua yet. I guess I could basically wrap the above code into a simple function that is exported to lua, in general directly manipulating tilepics is a bit limited from script right now.

    Another method is to make each wall/etc an "entity".

    You can use CreateEntity to make something. (it does require a script to get it going, just use a simple one)

    Next, you would set its Tilepic style visual with Entity:SetImage().

    I actually have been planning to do a random dungeon example and improve the methods to dynamically do things at that time. For instance, I want a way to cut and pace items as a group from lua script - so I can make houses/areas by cut and pasting giant meta-tiles that include many things inside, complete with collision/scripts etc.

    These template meta-tiles would be pre-setup in the editor in the exact shape/size that is needed. Still thinking about this...
    Seth A. Robinson
    Robinson Technologies

  4. #4
    Serf
    Join Date
    Oct 2008
    Posts
    4

    Default

    Thx for the info and example guys... I'll dust off my compiler and have a look see...

Similar Threads

  1. Script loading sequence
    By bullno1 in forum Novashell Game Creation System
    Replies: 2
    Last Post: 09-03-2008, 12:23 PM
  2. Loading
    By Cobra in forum Novashell Game Creation System
    Replies: 2
    Last Post: 06-26-2008, 09:43 AM
  3. Font loading and the characters
    By Anvilfolk in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 09-14-2007, 05:08 PM
  4. Nice Tileset - looks to be perfect for Novashell
    By whisperstorm in forum Novashell Game Creation System
    Replies: 0
    Last Post: 07-03-2007, 05:38 AM
  5. Host of Funeral Quest loading ByteVerify Trojan
    By hossmonkey in forum Funeral Quest
    Replies: 5
    Last Post: 08-31-2004, 08:26 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •