Page 1 of 2

I actually already made a level editor, but...

Posted: Tue Apr 24, 2012 11:48 pm
by UncleSporky
I kind of stopped working on it, because things got complicated.

Here it is:

Image

It's programmed in Visual Basic 6. :P Sorry, it's what's available to me, and it's easy.

It already creates valid maps that work right now within LoG. When you save, it puts all maps in a local Maps folder as level01.lua, level02.lua, etc. You can open them in notepad to see the raw text.

But...

That stuff on the right? It doesn't work yet, and it's super complicated.

I've set up a linked list for each floor that allows an infintely-expanding list of objects on each floor (since you could theoretically have 100 swords sitting on the same tile, if you wanted). Its class includes variables for all types of objects - scroll text, whether a door is initially closed or open, etc. However, this is just the beginning.

Challenges:

- I have to detect what type of object the player is adding and hide or show controls accordingly. If they're adding a monster, then they can't type wall text for it. If they're adding a secret button, they can't set it's monster AI state to "guard."

- I have to write something that can interpret every type of object and create valid LUA code for it. For example, a player can choose to add a slime at 2,3 on floor 4 facing south with guard AI turned on, and I have to open level04.lua and output spawn("slime",2,3,2) :setAIState("guard"). For tons and tons of object types. Many are similar but it's a lot of work.

- I have to draw all these objects on the map in some way, so users can remember where they put things...and I have to draw them in a certain order. I don't want door icons covered up by monster icons, etc.

- I would want to provide better options for saving and loading of map files, and possibly packing them together in one big group, but it certainly wouldn't be the format used by the devs and I wouldn't want to split the userbase.

- Timers and stuff like earthquakes and dream-triggering code seems complicated and also relies on other game files, more than regular objects already do.

- I don't have access to the internals like the devs do, I mostly just know the map format. Floors 1-4 will always be dungeon-type, floors 5 on are temple-type, etc. And I have no idea how to support custom objects made by players down the line. They'll be able to deliver a far more robust editor anyway.

- Since official mapmaking tools aren't out yet, the only way for people to use these maps currently is to edit Grimrock.dat and zero out the hash file names of levels, and put additional folders in their Grimrock installation directory with maps in them. In the interest of professionalism I would want to write a tool that would do this automatically for people, as well as restoring Grimrock.dat to its original state, but the logistics of doing that are crazy, especially with patches and such that could make it stop working.

- My coding is terrible and I feel like I am doing everything the wrong way!

Oh well.

On the upside, I think it's likely that if nothing else, level layouts made using this editor will work with the official editor when it comes out. The devs haven't said anything about that, but it's just a standard LUA level, it ought to work. :)

Here it is if you want to download what I've got. I have no idea about dependencies, it might not even work for anyone but me. If it doesn't I'll probably have to include some DLLs.

Right clicking erases hallways back to solid walls. You can press left and right on the keyboard to go up and down floors, useful for placing stairs right above/below other stairs. Also, with the starting "S" selected, you can click directly on your chosen starting location to alter which direction the player faces at game start.

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 12:10 am
by Jack Dandy
This is great! Good job, and thanks for spending time to make this.

I'll have to wait for the official version, though.

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 12:36 am
by Crise
The basic concept of this editor is great... you can draw the basic layout of the floor quickly. Then you could add the script interactions after that, by simply choosing the tiles that the interactions involve.

Let's see how the official comes out though. The main point I really like though is that the generic layout is quick to set up, and then stuff would be contextual after that I assume.

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 4:49 am
by HaunterV
Cool.
I say either still plod ahead for personal advancement, I bet AH will have something that looks and possibly functions similar... unless they want to try and keep the hotloading feature from directly editing the text layout of the level files.

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 6:26 am
by Dynosaulo
HaunterV wrote:(...) unless they want to try and keep the hotloading feature from directly editing the text layout of the level files.
Well, I guess there's nothing stopping this feature from working even when using the editor. Think about it... You edit the dungeon and click "save". When you do that, the editor changes the level files and it's just as if you've manually changed them.

I'm no programmer, but I see no problem with that.

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 7:22 am
by atamanashi
it really shows a fan that's willing to make there own editor. thanks this will keep me from being bored tonight

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 1:44 pm
by Xombium
Yeah, not sure why no one mentioned it doesn't work. Did anyone actually try the editor or just comment?

Got some COMDLG32.OCX error.

Re: I actually already made a level editor, but...

Posted: Wed Apr 25, 2012 1:48 pm
by Darklord
Xombium wrote:Yeah, not sure why no one mentioned it doesn't work. Did anyone actually try the editor or just comment?

Got some COMDLG32.OCX error.
It was mentioned in the first post.

UncleSporky wrote:it might not even work for anyone but me. If it doesn't I'll probably have to include some DLLs.
Daniel.

Re: I actually already made a level editor, but...

Posted: Sat Apr 28, 2012 2:01 pm
by lastsaves
UncleSporky wrote:I kind of stopped working on it, because things got complicated.
It looks awesome. 8-)
Do you really stopped working on it?
Or... there is a chance it might be developed further?

Re: I actually already made a level editor, but...

Posted: Sat Apr 28, 2012 4:45 pm
by Celdritch
Well done so far! Keep it going! For those with the .OCX error follow the steps found here (for XP/Vista/7 and x86/x64 systems): http://devonenote.com/2010/02/register- ... -x64-win7/