Results 1 to 8 of 8

Thread: 2D tileset generator

  1. #1

    2D tileset generator

    Before i start reinventing the wheel again, time to ask if anyone has done Tileset generator yet, or know of such existence? I didn't find any with Google at least. Idea is roughly:
    - Have basic tiles unrotated, just 1 image of each type such as stone, dirt, metal, iron brick etc.
    - Make some settings for each of them.
    => Click of a Generate button we have full tileset and its data ready to be saved in files (texture and data separate, so final touches can be made to texture by hand). By full tileset i mean that there can be different blends between blocks, corners, straights and so on.

    I suppose the tool would have second operating mode for creating a map with any previously saved tileset. I have a game project in mind which will not need any static map though, just the tileset data. It will randomize the map, for sidescroller type world. But i can imagine there being projects which would find world editing useful.

    Now if i start making this, i would likely make sort of standalone header file for this, with class that anyone would be able to integrate into their pascal projects. It could be published along nxPascal, but i'd use none of its units. The class could give texture coordinates possibly but not actually render anything. That's programmers job.

  2. #2
    One of my projects is to make program for creating textures. The program would have support for making various tilesets (rectangular for topdown view, diamond and hexagonal for 2D isometric, and aditional tilesets used for wals in isometric games).
    So far I haven't thought of making support for blending two existing textures together but it could be doable since I do have alpha chanell support.

    But due to the rate my programing is progressing lately I'm afraid it won't be finished for anytime soon.

  3. #3
    To get some idea of the program i'm after, thought to show first fademask i drew:
    fade3x.png
    With these it can generate the blends that are configured for each tile. What fademask looks like is free to change, and remake per tileset. Each tile can blend with many others, so it can come up alot of patterns for the final texture. I didn't want to go and draw these by hand for the game, and there could be over 30 base images to make the blends for. Besides if i'd want to remake, fix or make higher quality texture set, it will be much faster when it's automated.
    Last edited by User137; 12-02-2013 at 09:36 PM.

  4. #4
    This is great idea and it is already on To-Do list for my program. But as I sad before you probably don't wanna wait for me as my program probably won't be finished soon.

  5. #5
    Yep, i won't wait You can track progress here if want:
    http://code.google.com/p/nxpascal/so...ools%2Ftilegen

    It is much more complicated structure than one could imagine at first glance. I'm still working out some details, but i believe that after (propably) finishing "Tile styles"-dialog today, it cleared up alot. Also found and reported a Lazarus bug in the process... everybody benefits, lol.

    Also experimented temporarily with class default properties with record array as type, it failed. I won't need it now, but is it even possible to get such working? Something like (simplified):
    Code:
    type
      TTileStyle = record
        name: string;
        ...
      end;
    
      TTileStyles = class
      private
        FStyle: array of TTileStyle;
        function GetStyle(index: integer): TTileStyle;
        procedure SetStyle(index: integer; value: TTileStyle);
      public
        property style[index: integer]: TTileStyle read GetStyle write SetStyle; default;
      end;
    ...
    function TTileStyles.GetStyle(index: integer): TTileStyle;
    begin
      result:=FStyle[index];
    end;
    
    procedure TTileStyles.SetStyle(index: integer; value: TTileStyle);
    begin
      FStyle[index]:=value;
    end;
    I tried above'ish code, it compiles and all. But when i changed value from some record, it didn't change. Reading propably worked. I have a guess that it should've been pointer to record, so writing would work.
    Also another problem with "name" clashing with propably some internal "name" related to default parameter.

  6. #6
    A quick glympse at your code shows that you are using dynamical array but have no mechanizm for modifying array size. You can't save any data into array if it doesn't have any elemets as newly created dynamica arrays have.

  7. #7
    I am using SetLength(). See function TTileStyles.Add() or Delete():
    http://code.google.com/p/nxpascal/so...leUnit.pas#164

    You don't even need to have variable to track array size. Length() and High() ( = Length()-1 ) can be used to retrieve that information.

  8. #8
    Oh, as you saw in other thread, i took an entirely different approach for tile blending. Making of this tool was cancelled for few other reasons aswell... to put it with simple words: it was complicated, and no clear purpose.

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
  •