Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Repurposed Sprite Editor
#1
Marcus,

Back in December of 2024, I mention that I was having difficulty(s), with my Sprite Editor. The fix you provided worked like a charm... The project has been "gathering dust" since then because of lack of planning on my part. Creating an editor without considering, "Do I have the skill set to complete it?" The answer was a resounding "NO."...

Then I got to thinking (Ok, you can stop laughing now... very funny...) that the Sprite Editor is very similar to a Tile Map Editor.  Mind you, a bare-bones, editor... lol  Functions like, New, Load, Save, Quit, Draw and Erase tile... Seeing that Wolf3D does not seem to have a Editor per se, maybe the Sprite Editor, could be repurposed?

Here is my idea: Wolf3D uses a standard 64x64 tiled "map". Single level (ie: no layers). The Sprite Editor is already configured for a 64x64 "pixel" display. Give the different walls etc a specific colour. "Draw" the wall "pixel" etc to create the "map". Scan the main grid to convert it to a 64x64 character text grid then convert that grid to the standard Wolf3D "map = [[ ]]" layout.

No prizes for guessing that I have already started... kind of... The four main function are working (sort of) and the selection of the "tiles" can be drawn and erased. Saving and loading are my biggest issues at the moment... After all - it's only been 1 day... lol

I realize that EngineA already has a Tile Based editor and was wondering if your intentions are focused more toward that type of game creation than the Wolf3D game style? Reason: If the focus is on EngineA then it would be illogical to continue with the W3D editor... What do you think? Is a W3D editor a kind of "re-inventing the wheel" type of deal?
Logic is the beginning of wisdom.
Reply
#2
(01-23-2025, 07:57 PM)johnno56 Wrote: Marcus,

Back in December of 2024, I mention that I was having difficulty(s), with my Sprite Editor. The fix you provided worked like a charm... The project has been "gathering dust" since then because of lack of planning on my part. Creating an editor without considering, "Do I have the skill set to complete it?" The answer was a resounding "NO."...

Then I got to thinking (Ok, you can stop laughing now... very funny...) that the Sprite Editor is very similar to a Tile Map Editor.  Mind you, a bare-bones, editor... lol  Functions like, New, Load, Save, Quit, Draw and Erase tile... Seeing that Wolf3D does not seem to have a Editor per se, maybe the Sprite Editor, could be repurposed?

Here is my idea: Wolf3D uses a standard 64x64 tiled "map". Single level (ie: no layers). The Sprite Editor is already configured for a 64x64 "pixel" display. Give the different walls etc a specific colour. "Draw" the wall "pixel" etc to create the "map". Scan the main grid to convert it to a 64x64 character text grid then convert that grid to the standard Wolf3D "map = [[ ]]" layout.

No prizes for guessing that I have already started... kind of... The four main function are working (sort of) and the selection of the "tiles" can be drawn and erased. Saving and loading are my biggest issues at the moment... After all - it's only been 1 day... lol

I realize that EngineA already has a Tile Based editor and was wondering if your intentions are focused more toward that type of game creation than the Wolf3D game style? Reason: If the focus is on EngineA then it would be illogical to continue with the W3D editor... What do you think? Is a W3D editor a kind of "re-inventing the wheel" type of deal?

That sounds interesting!

EngineA and its editor are hard to use, so there's certainly room for a wolf3d editor.

The original raycaster editor for n5/n6 had five layers of data for: wall, floor, ceiling, game flag and loader flag. But with fixed floor and ceiling images, I definitely think you can get away with a single layer!

I can help you out with the loading and saving, using the json library. Just point out what data you need to save/load and I'm on it Smile
Reply
#3
I had almost finished responding to your message, opened another browser panel to look up laptop screen res stats, then closed the browser instead of the opened panel... Doh!

I will try again...

The way the EngineA editor, looks and feels, reminds me of the old Doom map editors... I don't edit/create those maps anymore but I still play Doom regularly... lol Sorry... I digress...

Many moons ago, I created a very simple 2D map editor, for single screen platform levels (usually 20x15 tiles) and figured I could do something similar to N7's W3D... The primary difficulty was, W3D maps are usually 64x64 tiles, with no knowledge of GUI environments, a scrolling editor was off the drawing board.

This was where I needed to check the dimensions of laptop screens... lol

I figured that if I aim at say, an older style laptop, 1366x768, that will at least give me a drawing grid of 768x768 using 12x12 pixels per cell... hence using colours to represent actual tiles... but 12x12 pixel cells are a little small for drawing. I can click on a tile and the corresponding colour can be drawn on the grid and also removed from the grid. Moving to a 1920x1080 will give me 16x16 cells but will not be practical for older machines. As stated earlier, this is an "old school" editor and as such I do not know how to scroll the main grid without a GUI. So I am limited to 12x12 or 16x16 cells.

I have no knowledge of json files whatsoever, which is why I use a simple "text based grid" file and convert each character to its corresponding tile... lol So, in regards to your offer for saving and loading, I will probably take you up on that.... I need to remove a few stray "random features" first... lol

My editor is a severely cut down version of my old "Naalaa Draw"... After all, I do not need all those functions, just to select a tile/colour, draw or remove, save, load and quit are all that is basically needed, right? Bare bones is probably the closest description of the editor - at the moment... oh... and ugly. Must not forget ugly... Cosmetic are not my forte... lol

My brain cell is running on fumes... difficult to think clearly... maybe coffee will help? What am I saying? Of course coffee will help!! See. Thinking impaired... It just gone 8pm here in Melbourne... as soon as the coffee "kick in" I will attempt to send you a copy of what I have at the moment... be warned... "ugly" applies to the code as well as the cosmetics... lol

Now, where did I put my cup?
Logic is the beginning of wisdom.
Reply
#4
Marcus,

Here is what I have at the moment....

All functions, except for 'SAVE' seem to be working.

All available "tiles" can be selected - the corresponding colour is then displayed - normal LMB to draw and RMB to erase to and from the main grid.
'NEW' - at the moment clears the main grid. - TODO: Add 'Are you sure?'
'LOAD' - Scans the hard coded 'testing' file and translates each character to its corresponding colour and transfers to the main grid.
'QUIT' - Goes without saying... But an 'Are you sure?' may need to be added if the main grid is 'occupied'.
'SAVE' - Disabled at the the moment. Still a work in progress.

The attached image - I said it was bare bones - show the first actual W3D map loaded with an inset of  the level 1 map from W3D for comparison.

   


.zip   wolfEd.zip (Size: 82.88 KB / Downloads: 4)

NB: The entire 'testing' file was produced 'by hand' - I sure hope that the 'save' function can work properly... W3D has six episodes, each containing 10 maps... Yikes! Oh... 'Read' a scanned level. Convert and load... Distant project... lol
Logic is the beginning of wisdom.
Reply
#5
Thanks for uploading this Johnno, it looks like a very interesting project. I'm working on something a little similar, to design and produce tilesets to use with the Tilemap Editor, so I will definately be keeping an eye on this to see what ideas I can "borrow" Smile
All the best - Kevin.
Reply
#6
If you're having problems implementing the save thing, I tried writing such a function for you:

Code:
function storefile()
    fn = savefiledialog("txt")
    if not typeof(fn)  return
    f = createfile(fn)
    for chary = 0 to gridsize - 1
        for charx = 0 to gridsize - 1
            select pixeli(charx * gsize + 1, chary*gsize + 1)
                case blacki  write file f, "0"
                case orangei  write file f, "1"
                case yellowi  write file f, "2"
                case bluei  write file f, "6"
                case greeni  write file f, "7"
                case whitei  write file f, "8"
                case cyani  write file f, "9"
                default
                    assert false, "Bad colour"
            endsel
        next
        wln file f
    next
    free file f
endfunc

It assumes you have also defined single number versions of the colors:

Code:
visible gridcolouri = toRGB(64, 64, 64)
visible bgridcolouri = toRGB(96, 96, 96)
visible redi = toRGB(255, 0, 0)
visible darkredi = toRGB(160, 0, 0)
visible dgreeni = toRGB(0, 128, 0)
visible bluei = toRGB(0, 0, 255)
visible greeni = toRGB(0, 255, 0)
visible yellowi = toRGB(255, 255, 0)
visible blacki = toRGB(0, 0, 0)
visible whitei = toRGB(255, 255, 255)
visible orangei = toRGB(255, 128, 0)
visible cyani = toRGB(0, 255, 255)

The toRGB function looks like this:

Code:
function toRGB(r, g, b)
    return 255*16777216 + r*65536 + g*256 + b
endfunc

Do you really need the array versions of the colors? If you use the single number versions of the colors you can use 'set colori' instead of 'set color'. When you use single numbers it's much easier to compare colors (if pixeli(x, y) = blacki ...).

The program looks great, simple to use!

I've attached the modified source code, changes are marked with Marcus.


Edit The window size was too large for my computer (mini laptop, 1366x768 pixels), but I changed to fullscreen mode, which actually downscales in this case Smile I forgot to change it back, I think ...


Attached Files
.n7   wolfEd.n7 (Size: 16.14 KB / Downloads: 4)
Reply
#7
Full screen, eh? Did not think of that one!

Tested Load and Save... Ran like clockwork!

Arrays and set colori... I will start work on that one... By the way, 'single number' implies 0 to 9... Can I assume that 'single letters' can be used? Using digits, lowercase and uppercase letters, I can then increase the tile selection to 62... Moo Ha Ha Ha....

Now that you have fixed the loading and saving of files, my next step, is to convert the saved text file into the "map = [[]]" format that the Wolf3D example program uses... As long as the example program has the same "tile set" as the editor, relatively simple text manipulation, will create the "map"... I will tackle that one after I take care of the 'set colori' mod.

Many, many thanks for the fixes / suggestions. Much appreciated....

As it is now Saturday, here in Oz, I am sure that either the house or the yard or car or some other issue, will heavily influence the amount of "free time" to dedicate to coding... lol One step at a time...

(01-24-2025, 03:49 PM)kevin Wrote: Thanks for uploading this Johnno, it looks like a very interesting project. I'm working on something a little similar, to design and produce tilesets to use with the Tilemap Editor, so I will definately be keeping an eye on this to see what ideas I can "borrow" Smile
All the best - Kevin.


The original program was being designed to do that very thing... Create tiles... But, I had no idea as to how to include "layers"... So it ended up being a simple (well, maybe not so simple... lol) drawing program....

There are no "trade secrets" or "proprietary applications" within the editor... If, and I use that word very loosely, if you do find anything worth using, be my guest.... No need to "borrow"... You can actually "take"... lol

Regards

J
Logic is the beginning of wisdom.
Reply
#8
Marcus,

I have swapped out the colour arrays and have finally figured out how to convert the "text map" to the "map = [[]]" format. Although the file "looks" the same, I still need to test it on the Wolf3D example file....

Oh... Here is an interesting "bug"... As I was testing the creation of the "map[[]]" file, using 'save', as I was about to enter a filename, I recalled that I made a mistake during the coding and "cancelled" without entering a filename... Got an error...
(renv) wolfEd.n7:367,161: runtime error: File 0 doesn't exist (SYS_FILE_WRITE)

Other than that, the program seems to do as it is told... I know! It surprised even me as well... lol

At the moment, adding the map[[]] file, is done by cut and paste... I suppose the file could be 'external' then 'included'. Once the file integration is sorted out, I suppose the next step would be - apart from adding more "tiles" - cosmetics... ugh...  I myself prefer the 'spartan' look and feel, but as usual, always open to suggestions...

I will post another version when (and if) as soon as I can... lol

J
Logic is the beginning of wisdom.
Reply
#9
Update:

The 'include', of the map.txt file, did not work... (probably because it wasn't an n7 file?)

But... Cutting and pasting the "map" into the wolf3d example6 file... tweaking a table size and extending "fog" range... the test ran like a charm. 64x64 tiles. No speed differences, as compared with the original 10x10 map, were detected...

The concept of creating the map seems to work but integrating the map file into the wolf3d program needs more work. One step at a time...

I will include the wolf3d example file


.n7   example_6.n7 (Size: 25.39 KB / Downloads: 2)

ps: My next test will (hopefully) include some of the original W3D tiles... (fingers crossed)
Logic is the beginning of wisdom.
Reply
#10
Johnno, I’m eager, can’t you see,
To check the game with your creativity.
And how Wolfenstein will play, oh do tell,
For Naalaa’s crowd, I’m sure it’ll be swell
Reply


Forum Jump:


Users browsing this thread: 13 Guest(s)