A tiling editor that I've been struggling with

So, I’ve been trying to build a tile editor for a while, a good long time. Specifically, this is to expand on Jens and Jadga’s raycaster that they both made years ago, and then once the thing is built, I’ve got an expansion idea in the wings as well.

The reason, is because as cool as that was, the engine they were imitating wasn’t actually famous for its raymarching more what it DID with that raymarch, and blew everyone’s mind that you got “3D” graphics on a machine designed specifically for spreadsheets and only had enough graphics hardware in place for bar charts and precious little else, then this kid from Kansas turns up figures out how to translate the bar chart system into 3D surfaces (Textures) convincingly… well, for the time anyway. Most people hadn’t even tried!

The first three images are what I’m trying to do, well, specifically, get the snap editor to build a matrix with tile id’s, which is the first part, and then aside the second image as tile properties.

The third image is the stage, wherein if I where to mouse over each square it’d say the TID and the Property.

And the final image, shows about 10% of the rays I’d be firing off at the bottom of the screen, and only along one wall in engine, and that’s scaled for 320x200 like the original, the wider the res, the more rays. (I did that all manually! In MSPaint! Ooooof)


SymbolsVisual
SampleMap

My problem, is I can get snap to draw a grid easy, but I can’t quite figure out how or what I’d need to generate a tile ID and map it to the stage, or then map those properties along side it.

I’d also want the levels to be stored as text strings (and if I could get further, maybe figure out how they stored those strings in wolf3d(but that’s optional, for now)). Now, all my examples are 8x8 in size, though technically the final picture is 8x12, because I drew it first and then figured out what it would like like in the first three images manually and decided on 8x8 for brevity, and the first two parts are text files, but in order for me to upload them to these forums I had to screenshot them and save them in paint, but the level I have in mind is 64x64. Much like the original.

Now. While I have the original game and tile editor’s source, they are both written in C89 and specifically queries things long since forgotten. That and I can’t read text code… or, more accurately, I want to put them in snap to see what they’re doing with snap’s incredible feature set, and the smallest example I have is 27000 lines of code (That’d be wolf3d (without the editor))

Which is, and I know this because I’ve tried this… multiple times… tedious to transpose to snap. I usually give up after the first H file (and usually well before)

Wolf3D is also the hardest to implement, because it’s the only one that uses a tile editor, DooM uses a homebrew simplified version of vector graphics that is far easier to implement in snap, but the tile editor can be also converted to a graphics editor, instead of storing a single character, each tile could just store colour data, and that’s also trivial in snap.

The later projects are harder, because they need that z co-ordinate that snap does not have. (it could probably do it, Quake was software rendered after all but let’s clear this obstacle first shall we)

TL;DR == Have assets, can’t for the life of me figure out how to implement them.
(Does this make ANY sense???)

TILES?!?! I NEED HELP WITH THAT PLEASE HE-

For context I’m trying to make a mnesweeper game (I removed “i” cuz of school policy) andI’m struggling. Could you perhaps help me with tile generation?

No I’m struggling with that too lol. If you figure it out let me know lol.

The best I’ve got is I can draw a grid, and I’m doing that with a Square block and then repeating that along the x and y axis in relation to stage size. That’ll DRAW the tiles… it won’t do much else though, and I still have to take that image from the pen trails.

So, not all that useful. At least I doubt it. Unless you haven’t got that far. This


generates this (and only if I click pen trails and drag it to costumes)

What I want is to make each of those squares have a clickable and changeable set of properties, which is what you want too.

yep.

hmmmmmmmmm

You COULD make different sprites for that, but that’ll probably overload the sprites area.

Yeah confusing topic

I dont even know what im talking about.

I have actually. I have all the assets already. I just need the tile editor, (and then I have to rewrite the ray caster as well, but I’m fairly certain I know how to do that… maybe)

Wait, what have you done already?

Cloning sprites was NOT what I was talking about.

Typical "rendering’ project in Snap do not use tiles. Just dense plot of bars of uniform color projected from a floor plan. It’s efectivelly expressed in term of polar coordinates. X is a direction, and height of the bar and Y maps to distance. It’s mostly done NOT by pure 3D math but rather a manipulation of small sprite and collision detection.
I’ve made once a very rough floor texture rendering. The texture is “sampled”, means stamped on small sprite then restamped on the Stage at different size & position to create illusion of 3D prespective.

(arrow for camera).

As for your grid it must be backed by a data, say list of textures. If you click on the grid the mouse coordinates may be mapped to list entry for update.
Because of antialiasing you cant color code information directly at image pixels. After save/load cycle exact values may be corrupted.

Neither was I? For MY tile editor, all the tiles need are colour coded markers, I have eight, and for the raycaster I need the ray to hit a tile and ask “what is this tile wearing and how do I draw it” and I’ve got eight textures for that, and I have more markers and textures in mind, but I’m not going to make those until I can use them with the raycaster.

All you need is a way to click a tile and ask “am I clear” or “am I a mine” and also a way to set those positions and the consequences of said action.

Also. Dardoro, that’s not what I’m after. Cool tho.

Oh wow, That’s an AMAZING demo, @dardoro !

I don’t know if this will help, but a while back I started working on recreating the tile-based game “Lode Runner: The Mad Monk’s Revenge”. After a while I moved on, because I discovered this recreation of the game and decided to spend my time on other things. However, what I did complete can be found here:

Press space to reset to the default level, enter to randomize the level, and click on any given tile to rotate through the options for what that tile can be (level editor functionality had yet to be separated from gameplay).

Not bad, especially given he whipped that up in about ten minutes too.

Unfortunately, and entirely by accident on dardoro’s behalf, He’s skipped ahead a couple steps that I have in mind. I do have a floor renderer in mind but I have plans for a working tile editor and I have a point in mind with the way the wall renderer and the raycaster work and where to go from there.

Also, @mark4sisb Yeah, I 've had a quick glance at that, and I think that’s given me a couple of ways to think about it, so that’s awesome. Also I remember playing the gameboy version of that quite a lot growing up lol, back well before First Person games overtook my imagination!

To answer this question, code along the lines of


will give you the tile row and column the mouse is hovering over. You can use a list to store those tiles and what they should do when clicked/hovered.

(note that you’ll have to account for camera zoom and position, as well as other things)

I like that a lot. It’s not quite what I’m after though. When I click a tile, it needs to say out one of four properties. A for Air, W for Wall, D For Door and S for Secret, and for the three properties that need a texture, W/D/S which texture I’ve assigned, if I have. Just the link pink square if I haven’t.

Currently, there’s a map loaded, but it’s a costume. So it’s a 512x512 texture, each tile is 8x8 pixels. What I did a while back is this image, splitting the costume into groups of 8, to mark out a tile. Kinda, but then I’ve got to map this over the image or divide the larger costume by this.

The actual properties are currently kludgyaf, ie; they’re a text file that I have to split into a 64/64 list. Each of those 8x8 squares is one tile and it maps to the image perfectly, because I drew the map first, and then manually typed out all 4096 property letters… sigh

and what I would like, is if I change the map, I can report that as a new costume and create a different map. I’ve currently only got one map, two if I count the blank. I can probably make new maps, but as I said earlier, while I’ve got plenty of ideas for markers and textures, I’ll leave it at the eight of both I already have until I get this thing working, and then I can go ham with decorations. I know what the map is and what it looks like in engine.

I just don’t… have the actual engine yet lol.

Off-topic

Secret? Like from Pizza Tower???

I’ve seen people mark stuff as off topic in other threads, how do you do that? Figured it out. YAY.

Off Topic

Now, as I’ve never played Pizza Tower, I don’t know how Pizza Tower handles secrets, the original engine I’m using slid the tile back about two squares and revealed a previously unreachable area. Usually with useful goodies to help the player.

Off-topic

In Pizza Tower, Secrets are (most of the time) hidden underneath a breakable block layer, and entering one will put you in a section with points that you can collect. They are also required for P Ranks in levels.

Off Topic

Aha, gotya. Same general thing then. Nifty.

Separate the tile data from the costume. There should be a separate list for what each tile is.

They’re already separate. The costume is an example. I’m trying, using the level data, to create that costume programmatically.

Huh. In that case, I’m not sure what the issue is. My solution should cover what you’re looking for.

Also, you should really make a basic map creator. It doesn’t have to be too complicated, just code it so when you press a key, a prompt appears asking you to input the tile you want to draw, and clicking places tiles.