Samapico Posted June 28, 2009 Report Posted June 28, 2009 This is just a little something I did quickly as a special request as it was required for the C&C zone. It's a feature that I wanted to implement eventually, but not in that way Basically, if you draw with a particular LVZ image, some tiles will be drawn with it automatically.To make this work: Right-click on the image in the LVZ library tileset, and choose 'Edit animation settings...'It will ask you each animation setting, and it will ask you something like 'how many tiles you want to associate with this lvz image?' If you want to lay solid tiles under a 48x48 pxl LVZ image, for example, you enter 9 tiles (3x3).Then it will successively ask you where and what each tile is. The X and Y settings are relative coordinates, relative to the top-left tile of the map object. So if you want each of these tiles to be tiles #26, except the center one, where you want tile #28, your answers will look like: Tile 1 X: 0Tile 1 Y: 0Tile 1: 26 Tile 2 X: 1Tile 2 Y: 0Tile 2: 26 Tile 3 X: 2Tile 3 Y: 0Tile 3: 26 Tile 4 X: 0Tile 4 Y: 1Tile 4: 26 Tile 5 X: 1Tile 5 Y: 1Tile 5: 28 Tile 6 X: 2Tile 6 Y: 1Tile 6: 26 Tile 7 X: 0Tile 7 Y: 2Tile 7: 26 Tile 8 X: 1Tile 8 Y: 2Tile 8: 26 Tile 9 X: 2Tile 9 Y: 2 Tile 9: 26 These are not saved for the moment... so each time you re-open the map you'll have to specify them again.This is a very temporary solution, as a real implementation will require a lot of tweaking and would have taken me much more time to finish up. I hope this can save you some time I attached the source for this, feel free to tweak my tweak as you see fit. Search the project for 'ASSOCIATE TILES WITH LVZ' to find where I modified the code for this.It probably wouldn't be hard to make DCME save the tile pattern to some external file, if you really need to.DCME3414 lvztiles.zip Quote
JoWie Posted June 29, 2009 Report Posted June 29, 2009 It works! Nice, thanks. Maybe I can get it to save later. But a bit to busy atm Quote
JoWie Posted July 10, 2009 Report Posted July 10, 2009 (edited) I added a menu option in file named "Import LVZ Tiles" which reads a simple text file and adds the lvz tiles. You have to re-import it everytime you open the mapThe text file looks like: @rocks.lvz #rocks_image0.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 #rocks_image1.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 0,2,192 1,2,192 2,2,192 #rocks_image2.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 0,2,192 1,2,192 2,2,192 #rocks_image3.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 0,2,192 1,2,192 2,2,192 #rocks_image4.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 #rocks_image5.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 0,2,192 1,2,192 #rocks_image6.png 0,0,192 1,0,192 2,0,192 0,1,192 1,1,192 2,1,192 #rocks_image7.png 0,0,192 1,0,192 0,1,192 1,1,192 0,2,192 1,2,192 #rocks_image8.png 0,0,192 1,0,192 2,0,192 3,0,192 0,1,192 1,1,192 2,1,192 3,1,192 1,2,192 2,2,192 3,2,192 This is how I implemented it (frmMain)There is 1 bug, it does not clear the old tiles if you reimport Sub ImportLVZTiles(filename As String) Dim f As Integer, i As Integer, ln As Integer Dim line As String, linenr As Integer Dim currentLVZ As Integer Dim currentImage As Integer Dim firstChar As String Dim defs() As String, parts() As String Dim hasError As Boolean Dim imgdef As LVZImageDefinition hasError = False currentLVZ = -1 currentImage = -1 linenr = 0 f = FreeFile Open filename For Input As #f Do Until EOF(f) linenr = linenr + 1 Line Input #f, line line = Trim$(line) If Len(line) = 0 Then GoTo nextDo firstChar = Left$(line, 1) If firstChar = ";" Then 'comment ElseIf firstChar = "@" Then 'lvz file i = 0 ln = lvz.getLVZCount Do While i < ln If LCase$(lvz.getLVZ(i).name) = LCase$(Mid$(line, 2)) Then 'found it currentLVZ = i Exit Do End If i = i + 1 Loop If i = ln Then If Not hasError Then MsgBox "Error in LVZ Auto Tiles definition on line " & linenr & ": LVZ File (" & Mid$(line, 2) & ") not found" hasError = True GoTo nextDo End If ElseIf firstChar = "#" Then 'image file i = 0 If currentLVZ < 0 Then If Not hasError Then MsgBox "Error in LVZ Auto Tiles definition on line " & linenr & ": Image definition before LVZ definition" hasError = True GoTo nextDo End If ln = lvz.getImageDefinitionCount(currentLVZ) Do While i < ln If LCase$(lvz.getImageDefinition(currentLVZ, i).imagename) = LCase$(Mid$(line, 2)) Then 'found it currentImage = i Exit Do End If i = i + 1 Loop If i = ln Then If Not hasError Then MsgBox "Error in LVZ Auto Tiles definition on line " & linenr & ": Image File (" & Mid$(line, 2) & ") not found" hasError = True GoTo nextDo End If Else 'tile definition If currentImage < 0 Then If Not hasError Then MsgBox "Error in LVZ Auto Tiles definition on line " & linenr & ": Tile definition before Image definition" hasError = True GoTo nextDo End If Do While InStr(line, " ") line = replace$(line, " ", " ") Loop defs = Split(line, " ") i = 0 ln = UBound(defs) + 1 imgdef = lvz.getImageDefinition(currentLVZ, currentImage) With imgdef Dim oldTilesCount As Integer oldTilesCount = .tilescount .tilescount = .tilescount + ln ReDim Preserve .tiles(.tilescount) Do While i < ln With .tiles(oldTilesCount + i) parts = Split(defs(i), ",", 3) If UBound(parts) < 2 Then If Not hasError Then MsgBox "Error in LVZ Auto Tiles definition on line " & linenr & ": wrong syntax for >" & defs(i) & "<" hasError = True .X = 0 .Y = 0 .tilenr = 0 Else .X = val(Trim$(parts(0))) .Y = val(Trim$(parts(1))) .tilenr = val(Trim$(parts(2))) If .tilenr < 0 Then .tilenr = 0 End If End With i = i + 1 Loop End With lvz.setImageDefinition currentLVZ, currentImage, imgdef End If nextDo: Loop Close #f End Sub Edited July 10, 2009 by JoWie Quote
JoWie Posted July 11, 2009 Report Posted July 11, 2009 (edited) i'm getting the following error: 11-7-2009 03:30:21 pm --- Drake Continuum Map Editor (v3.4.14) @ C:\dcmesrc\Project1.exe starting...Windows version: 51Screen resolution: 1680 x 1050args:''Untitled 1 @ NewMap, path = '' usingDefaultTileset WaarUntitled 1 @ NewMap, DefaultWalltiles = Untitled 1 @ NewMap, DefaultTileset = Untitled 1 @ InitTileset, tilesetpath= Default usingDefaultTileset Waar+++ Last update: 10-07-2009 - Update period: 211-7-2009 03:30:22 pm --- DCME readytst.lvl @ SaveMap, saving map... C:\dcmesrc\tst.lvltst.lvl @ Flags = 65535tst.lvl @ SaveMap, C:\dcmesrc\tst.lvl exists, checking for .bak filetst.lvl @ SaveMap, opening C:\dcmesrc\tst.lvl for binary as #1tst.lvl @ ImportTileset, importing: C:\dcmesrc\tempTileset15080828.bmptst.lvl @ Bitmap info header: --- Color Depth: 24 --- Size: 304x160 --- BiSizeImage: 145920 --- Compression: 0tst.lvl @ ImportTileset, bmpdata is imported from: C:\dcmesrc\tempTileset15080828.bmptst.lvl @ InitTileset, tilesetpath= C:\dcmesrc\tempTileset15080828.bmp usingDefaultTileset Onwaartst.lvl @ SaveMap, bitmap header position: 1tst.lvl @ SaveMap, bfReserved1 set to: 145976 (145976)tst.lvl @ eLVL.PutELVLData, Saving Hashcode FFFF1872D168 at 145989tst.lvl @ eLVL.PutELVLData, Saving LVZ 'game.lvz' at 146009tst.lvl @ eLVL.PutELVLData, Saving LVZ 'rocks.lvz' at 146041tst.lvl @ eLVL.PutELVLData, Saving LVZ 'newwater.lvz' at 146077*** Error 9 (Subscript out of range) in frmMain0.SaveMap C:\dcmesrc\tst.lvl 65535(0,0)--- Mbox prompt --- DCME - Error 9 (Subscript out of range) in frmMain0.SaveMap C:\dcmesrc\tst.lvl 65535(0,0)If the error persists, please post your log file (dcme.log) at http://www.ssforum.net in the DCME board.;48 if i load it up in the debugger, it goes wrong in clsMD5 in MD564Split on the line "arrSplit64(intInnerLoop) = bytBuffer(intLoop2 + intInnerLoop)". Could it be that the lvz file is getting to big for dcme? it tries to go over 65535 in bytbuffer Edited July 11, 2009 by JoWie Quote
Samapico Posted July 11, 2009 Author Report Posted July 11, 2009 Hmmmm, are these things using Integers or Longs? VB ints are only 2 bytesThat MD5 code was taken from somewhere, we didn't change anything in it though Quote
Samapico Posted August 4, 2009 Author Report Posted August 4, 2009 You can import png already for the LVZ's, I think (I may be wrong; if I am, it should be an easy fix). However, Continuum only supports black transparency... so PNG's with a defined transparency will have no effect on Continuum. Though maybe they'll appear transparent in the editor, but that's not something I really can control. Good idea about having undo/redo buttons on the switch/replace dialog... As for selecting from the map view, I thought about this, but it's not really easy to do so I never really did it. For the lvz+tile auto thing, the idea isn't bad, but DCME would need to eventually save the file as a .lvl anyway, and since the tileset itself is limited, LVZ's would be used anyway. So instead I was just planning to add another tileset tab where you can configure tile+walltile+lvz combos of various sizes, and you can use these combos to draw on the map. If you need flyover or flyunder tiles, you don't really need to do that, since you can just lay lvz objects at the correct layer. But if you need for example a solid tile that has various LVZ graphics around/on it, you could draw with it.The way I see it, these would be configured just like in a mini-map editor.If you are familiar with AutoCAD, the 'blocks' would be a good comparison. Quote
Drake7707 Posted August 4, 2009 Report Posted August 4, 2009 For the lvz+tile auto thing, the idea isn't bad, but DCME would need to eventually save the file as a .lvl anyway, and since the tileset itself is limited, LVZ's would be used anyway. So instead I was just planning to add another tileset tab where you can configure tile+walltile+lvz combos of various sizes, and you can use these combos to draw on the map. If you need flyover or flyunder tiles, you don't really need to do that, since you can just lay lvz objects at the correct layer. But if you need for example a solid tile that has various LVZ graphics around/on it, you could draw with it.The way I see it, these would be configured just like in a mini-map editor.If you are familiar with AutoCAD, the 'blocks' would be a good comparison. I think he means to store all data as a *.dcme file, and have a 'Compile to lvl file' in the menu, that way no unnecessary data is saved in the lvl file and allows easier storage of data (like dumping a struct to a file & back, with obvious version control included). As for the lvz's, if i understand what you mean, then you'd like it to be like this: you import lvz's and tileset and handle them all as tiles, like a tileset from some rpg game map editor. Then afterwards 16x16 tiles that have been used could make up for the tileset and all the rest as lvz's, so for the map maker there wouldn't be a difference between tiles & lvzs (as that is only technical when saving to lvl & lvzs). I can see the use of a custom *.dcme file for that, but to implement such a thing it would mean another big overhaul of the entire map editor and its functions. Annnnnd i've pretty much neglected DCME for over a year and a half already. Quote
Samapico Posted August 4, 2009 Author Report Posted August 4, 2009 Walltiles, yes they will be upgraded eventually to give much more possibilities. You could in theory specify any kind of corner diagonal you might want. Imagine a single tile is surrounded by 8 other tiles. The combination of the 8 surrounding tiles give this tile its pattern... i.e. if there's a tile to its left and to its right, well the tile should be a straight horizontal. Thick walls can be done the same way... if a tile has neighbors like this:[X][X][X] [X][O][X] [ ][ ][ ]Then it's the bottom part of a thick horizontal wall. Some combinations have no particular interest in most cases, but if you need a particular kind of corner/diagonal, it will be possible. For example, these 2 combinations would most likely require the same tile:[ ][X][X] [ ][O][ ] [X][ ][X] [X][X][X] [ ][O][ ] [X][ ][X]Also, an important part of what I had in mind... These combinations don't only result in 1 output tile, but in a complete block, much like the LVZ+tile combo blocks I mentioned earlier. So if you want 3-tiles-thick walls, you could actually tile with only a single width line, and each tile you specify would be replaced by a 3-tiles-thick wall.Note that all this will be storable directly in the LVL file, requiring eLVL tags only for the block definitions. This also means that unlike the current walltiles system, which are actually just normal tiles drawn automatically, these will be recognized by the editor as walltiles, and you'll be able to see them as such. So if you tile a full base with the single-line-becomes-3-tiles-thick thing, it's still easy to edit since you can simply change the single-width lines. Hmmm, for the perspective, the only way this is possible is by making bg## images to replace the planets and stuff... but you can't decide where they end up because they'll be placed randomly. Quote
Drake7707 Posted August 4, 2009 Report Posted August 4, 2009 bomb lines are already available in the test map function. Hold 'B' to see them. It would also be useful to have some sort of stamp tool, where you compile your stamp with various tiles and lvzs, then take that and use it as a brush. Those 'stamps' could be seen as 'tiles' too, allowing you to use all the tools with them (or even include them in walltiles). This also partially resolves the auto-tiling. You can do it at this point, but it's somewhat limited: make your stamp on an empty area and copy paste it as selection (cut out the tiles you don't want to if it's not rectangular). Quote
Samapico Posted August 4, 2009 Author Report Posted August 4, 2009 The idea of 'blocks' or tile-lvz combos I described above are exactly what you call 'stamps'... It's actually a better name Since maps would most likely use a lot of them... plus my walltiles idea would also use similar stamps (You could auto-tile stuff with LVZ's, woo!)... Might be a good idea to zlib them and put them in eLVL tags. I wonder how compact it could be...Actually, we could simply have a 'Save optimized LVL' button to save the map without all the stuff players don't need at the other end of the server. Even though the unoptimized LVL would still work, but maybe be a bit larger. We already have a 'Save items...' form where you choose what you save, shouldn't be too hard to make an optimized setup. Yeah. Quote
mkruer Posted August 5, 2009 Report Posted August 5, 2009 (edited) It seems that we are all on the same general page for the adding of tiles, which is good; it is just the implementation that is going to be the trick I guess. The stamps are a good first start, but at the end of the day, people would still have to go in and manually tweak the map. BTW there might be an issue with calling the option stamps. Extend Wall Tiles or Dynamic Wall Tiles might be a better term. The reason is why is because if you are extending the editing capability of the editor and including a project save state, it is only a matter of time before someone asks for the ability to save custom stamps. I make the general distinction between a stamp, brush as being a stamp is a onetime only placement where as a brush would be the ability to place and smear/spread the tiles beyond the original size. I could be wrong though, hell just pull a page out of AutoCAD and call then Templates. Anyway my stamp might a little more tricky then most because I opted to use ½ diagonals, (22.5 degrees) to give a more complete roundedness feeling to the circle. See Example Below. 1. Ideal circle stamp (grey areas are fly under tiles)2. Current implementation that I am using. (grey areas are fly under tiles)3. Rough Example of Ideal Circle* EDIT: I know its not fully correct.4. Current implementation that I am using, as it would display on screen. If I did my math right, I would need 11 solid tiles, and 12 fly under per corner. Tweaks1. Importing a PNG with a transparent layer, coverts the layer to black, the Continuum editors transparent layer. Currently it imports it as a white background. 2. Undo does not undo added LVZ additions that were just placed on the map. 3. Saving a tileset, add the .bmp extension by default, if there is an existing extension. I noticed that the exporting of tiles were picking up the .lvl after the autosave.4. Larger LVZ Library Icons. Requests1. Save a snapshot of the full map at full half or even quarter resolution? This would be for post able full map previews.2. If/When you implement the stamps I will more then likely require some massive editing of the map I have. Is it possible to add a work layer and edit the data on the work layer while preserving the original data. I guess this would be analogous to the selection option, but with the ability to keep the original data. 3. User saved a stamp, brush, templates, patterns; whatever you decide to call them. Project I was working on before it crashed. (Dont worry I only added the lvz to the map and was doing some dragging when it crashed.) Any additions would be appreciated and most helpful, worst case is i have to do it by hand (shutter) BTW I am not sure if this is a windows7 but or a 64-bit bug, but when I do some heavy editing the application seems to stall out, and then not crash per say, but anything I save becomes junk. I am adding the error log as an attachment for your review.errorlog.txt Edited August 5, 2009 by Lord Voelker Quote
mkruer Posted August 5, 2009 Report Posted August 5, 2009 (edited) Edited August 5, 2009 by Lord Voelker Quote
mkruer Posted August 6, 2009 Report Posted August 6, 2009 Sorry to keep making requests of you: Tweak:Alt + Selection Tool selects only Tiles within the selection area. (basically the same as selecting a region and then using the magic wand to remove the non tiles) Faster and one motion. Oh on the layers, if you opt to do them, it would be nice be able to select items in the background and replicated to the current working layer. Quote
Samapico Posted August 7, 2009 Author Report Posted August 7, 2009 You do know about the transparent mode, right? Quote
mkruer Posted August 7, 2009 Report Posted August 7, 2009 You do know about the transparent mode, right?Sorry missed that one, but I found it now. Back to the topic of Autotiles with LVZ. DBS is interested in the map I am working on, so I am going to proceed on finishing. However because it will eventual require extensive tiled backgrounds. I just want to know if you will be able to treat them like the extended tile set as mentioned in previous posts? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.