Nifflas' Support Forum

Level Editing Support => Knytt Stories Level Editing Support => Topic started by: xoft on March 04, 2009, 16:20:05

Title: KS Level Composer
Post by: xoft on March 04, 2009, 16:20:05
  The KS Level Composer program is being developed to help level authors track down those nasty wallswims and to ease level designing.

  -- Placing the updates here below ---

  Current version: 0.3.16 (2009_10_01)

  Current version can:
    + check for wallswims (naive check used, possible false-positives)
    + edit level using almost the same logic as Nifflas' original editor (still in development, but the basics are there)
    + select multiple tiles in tileset and paste them all at once
    + duplicate several rooms all together with their object metadata, with or without adjusting shifts / warps
    + list powerups and keys
    + follow shifts and warps directly in editor


  The releases are stored at http://xoft.cz/games/kslc.html (http://xoft.cz/games/kslc.html) not to clutter this thread.

  The program doesn't need any installation, just download and unpack (possibly the zlib1.dll as well, if you dont have one already) and run.

  At the first run it should ask you for the KS executable (so that it knows the path to all KS data folders). If it doesn't (strange) or you set the wrong path, you can change it later in Settings (menu View -> Settings...)

  If it still gives you trouble, please write the contents of the Log tab.
Title: Re: KS Level Composer
Post by: 4a on March 05, 2009, 20:49:17
...this isn't a newer version than what was already on the old forum, is it? If it is, then does it not do that glitchy thing where copying multiple screens jacks up the shifts and stuff?
Title: Re: KS Level Composer
Post by: xoft on March 05, 2009, 22:37:47
I'm not sure, I think I've already fixed that bug but I think I haven't released that version yet. Thanks for reminding me, I'll try to improve on that soon(ish).

Oh, I remember now, I fixed the problem with copying totally unrelated data, but wanted to add an option whether to adjust or not shifts / warps in the copied section. I'll try looking the info up on the old forum.
Title: Re: KS Level Composer
Post by: 4a on March 06, 2009, 16:32:10
If that does get fixed, it will be super-useful, yep.
Title: Re: KS Level Composer
Post by: JC Grim the 'crete reaper on May 02, 2009, 04:59:56
I'm not sure, I think I've already fixed that bug but I think I haven't released that version yet. Thanks for reminding me, I'll try to improve on that soon(ish).

Oh, I remember now, I fixed the problem with copying totally unrelated data, but wanted to add an option whether to adjust or not shifts / warps in the copied section. I'll try looking the info up on the old forum.

Yes, I asked you about shift adjustments, and you said you'd explain on the forum, then it crashed. XD
Title: Re: KS Level Composer
Post by: victor12 on May 09, 2009, 14:40:58
 :moody: don't works in KSA
Title: Re: KS Level Composer
Post by: AClockworkLemon on May 12, 2009, 09:06:44
It probably will if you re-name your KSA to "Knytt Stories.exe"
Title: Re: KS Level Composer
Post by: victor12 on May 12, 2009, 16:44:11
It probably will if you re-name your KSA to "Knytt Stories.exe"
i already re-named it :/
Title: Re: KS Level Composer
Post by: xoft on May 12, 2009, 19:58:03
Pardon me for my ignorance, but what is KSA?
Title: Re: KS Level Composer
Post by: BloxMaster on May 12, 2009, 20:13:50
@xoft: KSA is my KS mod.

@victor: If you had put KSA in your KS folder like I expected everyone to, there probably wouldn't be a problem with this. Renaming KSAdvanced.exe to Knytt Stories.exe should make this work. If it doesn't, then edit KSLC's .ini. On the second line of the ini, type in the path to KSA (Example: C:\Users\BloxMaster\Downloads\Games\KSA\) It'll work.
Also, you should keep in mind that it isn't xoft's job to keep up with KS mods (unless he really wants to).
Title: Re: KS Level Composer
Post by: xoft on May 12, 2009, 20:24:10
... edit KSLC's .ini

No need for this, You could actually use the menu from inside KSLC, it is in the Settings.

Thanks for the clarification, BloxMaster.

KSLC should work with any KS mod, provided that it uses the same level file format and same directory structure as KS (but then I can't imagine what the "mod" would actually be ;)


On a different note, I'm working on the shifts / warps duplication and it's proving to be quite a lot of work on the coding side. An update is likely to be quite far away in the future, unfortunately.
Title: Re: KS Level Composer
Post by: Bored2death on June 09, 2009, 21:56:52
Doesn't even seem to copy the rooms in the first place for me :sigh:
Title: Re: KS Level Composer
Post by: JerkDouglas on September 17, 2009, 22:53:55
 This is really sharp, especially the passability mask and the one panel peek into adjacent screens.

 However it is literally impossible to use at the moment.

 1) I have no idea how to start to work on a new screen past the first. All that clicking on the minimap seems to do, is create a selection of the screens you click on.

 I designated some new screens in the original level editor, saved it, and then I could get to those okay in KSLC. But that's only if they already exist. But I can't make any new screens in KSLC. Is there a hotkey I need to hold down while I click? Or a hotkey in general?

 2) Once any selection larger than one screen has been made, the program crashes shortly thereafter. I don't really need that function so it doesn't affect me very much, but I'm sure someone might need it.

 3) Whenever I save in KSLC, it chews up the custom object parameters I've set in my world.ini file... The initial line of bracketed code that designates the ID of the objects is completely removed every time. The rest of the data is unaffected.
Title: Re: KS Level Composer
Post by: Purple Pineapple on September 18, 2009, 01:17:23
Where can I find zlib1.dll?
Title: Re: KS Level Composer
Post by: xoft on September 18, 2009, 08:00:43
At the same page where you can find KSLC - http://xoft.cz/games/kslc.html - Downloads section, support DLLs
Title: Re: KS Level Composer
Post by: AClockworkLemon on September 23, 2009, 08:52:54
need a bit of clarification, If I make a screen then put in some shift settings in the world.ini file, If I copy and paste the screen, It will also copy the shift settings, and alter the x,y values?
Title: Re: KS Level Composer
Post by: xoft on September 23, 2009, 09:15:09
Right now it should take all screen's parameters in World.ini and copy them to the new room exactly the same as they were.
Title: Re: KS Level Composer
Post by: xoft on September 23, 2009, 09:23:45
[...]
 1) I have no idea how to start to work on a new screen past the first. All that clicking on the minimap seems to do, is create a selection of the screens you click on.
[...]
 2) Once any selection larger than one screen has been made, the program crashes shortly thereafter.
[...]
 3) Whenever I save in KSLC, it chews up the custom object parameters I've set in my world.ini file...
[...]

Sorry to get back to you so late.

Thanks for the praise, as a programmer I really rarely see such, I really appreciate it :)

1. KSLC was meant only as a checker, editting features are there only for the "quick-fix" type of editting rather than creating new levels from scratch. A full-fledged editor would be much more difficult to make. Though I can see KSLC is becoming an editor more and more.
If you have a clear use-case on how to implement new room creation, I'd appreciate if you shared your thoughts. For me, this kind of work is the most difficult (beside getting the free time, obviously ;) , deciding on how the stuff should interact together; if a mouse-click should start selection or create a new room or ...

2. This is a known issue, I believe I've already solved it, but since in between I've messed up other things, the new version is not yet ready for release.

3. KSLC was built when custom objects didn't exist, so it doesn't account for them. I really need to catch up on this issue. Thanks for the report, I'll add it to the ToDo list.
Title: Re: KS Level Composer
Post by: JerkDouglas on September 24, 2009, 00:45:24
 Haha! I got ahead of myself, I saw all the advanced editing tools and couldn't go back to the original KS level builder, and figured it was solely designed as a level editor replacement because the tools rocked so much.

 Durr, if I use it for the intended reasons it makes a bit more sense! XD

 And that Looki guy has an editor that doesn't do all the magical kickass error checking stuff, but it's super solid for just building levels, so I can just use that for the editing.

 So if I use this as a checker, (which I am now) about the only thing you should concern yourself with is keeping the thing from killing the custom objects in the world.ini file.

 Yeah, don't bother adding anything other than what you intended. If you get around to all the checking functionality pointed at in the program menus you'll really come out on top.

 Aaaand if you have time to add more, then I ain't stopping you.  8)
Title: Re: KS Level Composer
Post by: xoft on September 28, 2009, 16:04:49
Good news, everyone :)

KSLC has reached the age of two years today. On 28th September 2007, the first line of its code was written and the first log entry reads "Development started. ZLib for Delphi found"

To commemorate, I've dusted off the decaying sources and made some changes, yay. New version 0.3.15 is out there, grab it while it's still warm :)
In this new version:
Fixed: Crashes after selecting rooms in the map view
Fixed: Selection-only room duplication copied wrong parameters from World.ini
Fixed: Exception occured when entering negative / invalid numbers in Duplication dialog
Fixed: Custom objects should stay untouched
Added: Option whether to modify shifts / warps or not while duplicating rooms

I think many people have been waiting for these features, at least it seems so from the posts here. Hopefully I didn't mess anything up, so give it a try. But remember, always make a backup before trying KSLC, just in case.
Title: Re: KS Level Composer
Post by: Bored2death on September 29, 2009, 04:04:54
So, does this new version fix the whole not detecting shifts/warps for wallswims?
Title: Re: KS Level Composer
Post by: xoft on September 29, 2009, 07:54:28
Shifts no, that didn't occur to me, there's not much of a chance that a shift destination inside a wall would go unnoticed :)
Warps have been checked since forever, though there may be some issues when using flags.
Title: Re: KS Level Composer
Post by: TechnoGeek on September 30, 2009, 02:08:31
Shifts no, that didn't occur to me, there's not much of a chance that a shift destination inside a wall would go unnoticed :)
Warps have been checked since forever, though there may be some issues when using flags.
Definitely with flags, possibly even with normal warps.
Title: Re: KS Level Composer
Post by: xoft on September 30, 2009, 07:24:16
Definitely with flags, possibly even with normal warps.

If you know something I don't, please share. I was under the impression that normal warps were working ok. And noone else has ever complained.
Title: Re: KS Level Composer
Post by: Bored2death on October 01, 2009, 02:34:55
I've noticed that warps give you false positives when tested, and flag warps definitely aren't detected once activated.
Title: Re: KS Level Composer
Post by: JerkDouglas on October 01, 2009, 03:44:23
 Everything I've checked out works great.

...except my custom object listings in the world.ini are still being eaten.

 My OS is Windows XP SP2 if that information has any bearing on the problem.
Title: Re: KS Level Composer
Post by: xoft on October 01, 2009, 09:23:33
Bored2death, can you please provide a sample level when this happens? A short one with as little rooms as needed to reproduce is okay, as long as the effect is observable; a description of which of the detected wallswims is the false positive would be nice too.

JerkDouglas, I don't think it has anything to do with the OS, rather there's still some error in parsing the world.ini file. I could not test COs since I don't have a single level using them. I'll try to find one and see what the problem is. Thanks for the report.
Title: Re: KS Level Composer
Post by: AA on October 01, 2009, 10:57:51
JerkDouglas, I don't think it has anything to do with the OS, rather there's still some error in parsing the world.ini file. I could not test COs since I don't have a single level using them. I'll try to find one and see what the problem is. Thanks for the report.

Maybe I'm missing something, but by looking at the source code it doesn't seem that the procedure that saves the World.ini file accounts for Custom Objects anywhere.

uKSRepresentations.pas file
Code: [Select]
procedure TKSLevel.SaveEventParams();
var
ep, sl: TStringList;
i: integer;
begin
ep := TStringList.Create();
ep.Add('[World]');
ep.AddStrings(WorldParams);
ep.Add('');
ep.Add('[Cutscene Music]');
ep.AddStrings(CutsceneMusicParams);
ep.Add('');
for i := 0 to NumRooms - 1 do
begin
sl := Room[i].GetEventParams();
if Assigned(sl) then
begin
if (sl.Count > 0) then
begin
ep.Add('[x' + IntToStr(Room[i].XPos) + 'y' + IntToStr(Room[i].YPos) + ']');
ep.AddStrings(sl);
ep.Add('');
end;
sl.Free();
end;
end; // for i

// save to INI:
try
ep.SaveToFile(LevelDir + 'World.ini');
except
on e: Exception do
begin
if Assigned(Log) then Log.Log(LOG_ERROR, '!!! Exception received: "' + e.Message + '" !!!');
raise;
end;
end;
end;

Or is there a different procedure being used for that? If there is, I'm sorry.
Title: Re: KS Level Composer
Post by: xoft on October 01, 2009, 11:05:37
[...]
Maybe I'm missing something, but by looking at the source code it doesn't seem that the procedure that saves the World.ini file accounts for Custom Objects anywhere.
[...]

Oy, of course, you're right! I've parsed the params in, but never included them when saving back! Stupid me. Fixing now.

EDIT: Plus, there is an object leak in the code, ep never gets destroyed. Must've been sleeping already when writing that code :P
Title: Re: KS Level Composer
Post by: xoft on October 01, 2009, 12:23:43
New version: 0.3.16

Contains a single fix, thanks to AA, the custom objects shouldnt get chewed up anymore.
Title: Re: KS Level Composer
Post by: JC Grim the 'crete reaper on October 01, 2009, 19:09:52
So wait... if I read this correctly... are you saying that you have now added the feature I asked you about previously; altering shifts to meet the matching locations when duplicating rooms?
Title: Re: KS Level Composer
Post by: xoft on October 01, 2009, 20:43:17
Yes, that's exactly the feature. The room duplication dialog now looks like this:
(http://xoft.cz/games/kslc/duplication.png)
And all the choices should be working correctly.
The controls are set so that by default, the contained shifts / warps work within the new rooms and outgoing shifts / warps go to same locations as the old rooms. So effectively it creates an alternate path.
Title: Re: KS Level Composer
Post by: JerkDouglas on October 02, 2009, 15:25:52
 Yess! My custom objects aren't being eaten anymore!

 However, they are losing all of their spacing from each other in the ini file.

 It's not impossible to work with this, of course... But it would be nice if they would maintain their spacing. Just one carriage return between each CO would make it super easy to decipher. (I have like fifty of them so far, and I'm constantly noodling with them to get their placements just right.

 If you're kind enough to fix this I will be eternally grateful. But thanks for all the hard work on this. It's shaping up really really well!
Title: Re: KS Level Composer
Post by: JC Grim the 'crete reaper on October 03, 2009, 02:15:12
Hmm... I seem to be having problems...
 
It tells me that my KS Folder cannot be found... fair enough.
Then it opens a window asking for a Knytt Stories Level File. This would normally have me find the Game executable.
Anything I choose causes KSLC to crash.

Whats the deal?
Title: Re: KS Level Composer
Post by: xoft on October 03, 2009, 08:15:50
I found the same problem yesterday, I'm investigating it now.

In the mean time, I think the easiest solution is to delete the settings file, KSLC.ini. That should take care of it.
Title: Re: KS Level Composer
Post by: JC Grim the 'crete reaper on October 05, 2009, 07:27:12
Ahhh, we have liftoff. :) Thanks so much Xoft. This feature is going to make BSoaKFF so much better.
Title: Re: KS Level Composer
Post by: MidnightDaystar on January 22, 2010, 23:46:59
Is there any way to copy multiple tiles from one map to another? I am working on a large map with 5 other people and the transferring of tiles is going to take forever if there is no way to. I would appreciate any information on this as soon as possible. midnightdaystar (at) gmail (dot) com

Thank you.
Title: Re: KS Level Composer
Post by: Pumpkinbot on January 23, 2010, 03:53:43
Is there any way to copy multiple tiles from one map to another? I am working on a large map with 5 other people and the transferring of tiles is going to take forever if there is no way to. I would appreciate any information on this as soon as possible. midnightdaystar (at) gmail (dot) com

Thank you.
Or, you could be PM'd. *points to the top of the page* See where it says, "Hey, MidnightDaystar, you have 0 messages"? ;)
Title: Re: KS Level Composer
Post by: Purple Pineapple on January 23, 2010, 08:33:18
Unless you're using the WaDF theme, in which case it would say "My Messages
Title: Re: KS Level Composer
Post by: xoft on January 24, 2010, 22:29:57
MidnightDaystar, what exactly do you mean by "copy multiple tiles"?

You can select several tiles in the tileset and insert them into the room by a single click in the current KSLC version.

However, what I suppose you meant was to copy several rooms from one level to another, right? That is unfortunately not possible at the moment, and generally such a feature is very difficult to design, so I don't think it'll be available within any foreseeable future.

Note, it's difficult to design, not implement. There's just too many things to decide what to do about when copying rooms; the actual implementation then is rather trivial.

A simpler approach that might be implemented quite soon is importing a (complete) level into another level. This is way easier, because most of the world.ini settings stay intact. Still there are issues, such as tileset collisions, custom objects etc. that need to be solved.

Anyway, nothing's gonna happen in the nearest future (month or so), since i'm working on different projects now and simply don't have the time needed for KSLC.

Still, any programmers who'd want to join are welcome, KSLC is, after all, open source.
Title: Re: KS Level Composer
Post by: Purple Pineapple on January 24, 2010, 22:37:20
You can, however, copy rooms from one level to another with Ctrl+C, Ctrl+V.
Title: Re: KS Level Composer
Post by: JC Grim the 'crete reaper on January 26, 2010, 10:15:40
I always assumed that's how they copied over islands made for Gaia...
Title: Re: KS Level Composer
Post by: Headgrinder on February 12, 2017, 16:55:24
How do you install this?  In the KS folder?  I can't get it to work.  Just crashes.  I have the DLL too.
Title: Re: KS Level Composer
Post by: Vegetal Gibber on February 12, 2017, 17:34:43
Now that you mention it, I recall having trouble running this tool at first, and it was related to the version of the Zlib.dll that I was trying to use. It has to be the same exact version the program expects, otherwise the program will refuse to run. The DLL I'm using is v1.2.1.1429 (according to Windows explorer).

I can save you some trouble with the link below. Placing the DLL file in the same folder as the KSLC executable should do the trick:

[ Zlib1.dll (Win32) (https://dl.dropboxusercontent.com/u/47886996/knytt/other/zlib1.dll) ]

DISCLAIMER: Use this file at your own risk! It's the same one I'm using and should be free of viruses, but I cannot offer any guarantees.

As for the installation, I think any folder will work (unless they require admin access). The first time you run the program, it will ask you the location of your main "Knytt Stories" folder and save it to an .INI file. Personally, I prefer to keep the KSLC files on that folder, with the other KS executables.
Title: Re: KS Level Composer
Post by: Headgrinder on February 13, 2017, 11:45:12
I sent an e-mail to the programs maker and got it running.  Either I shouldn't have put it in the actual KS directory, or I shouldn't have put it there with all those other files for it he had on his web site.  Shrug.  

Thanks though!
Title: Re: KS Level Composer
Post by: Headgrinder on February 22, 2017, 00:31:34
So I was under the impression that this editor could be used to copy the content of one level and paste it to another.  However, I can't seem to do that, only duplicate the content within a single level.  Did I just have a misunderstanding or do I not know how to use this editor?
Title: Re: KS Level Composer
Post by: Vegetal Gibber on February 23, 2017, 17:56:49
I'm probably not the best person to try to explain this, since I have never tried to use KSLC for this purpose, but I believe the trick is using the "duplicate screens" feature to move the source screens to their intended position in the target level, so all the metadata (shift, warps, etcetera) in the World.ini file is automatically adjusted and you can import it easily into the new file. However, if you're not using any shifts/warps in the original level (or if you just don't need them in your new level), you could just open two different instances of the KS+ Level Editor and start copy/pasting screens from one editor window to the other. You may also need to adjust the numeric indexes (tileset A/B, background...) afterwards, if you're using custom assets.
Title: Re: KS Level Composer
Post by: GrayFace on May 22, 2022, 11:42:00
I've fixed a bug in KSLC's level select screen. If scaling is set up, listbox was getting "cut off" by program edges and the end of levels list wasn'
t visible. I didn't recompile, just edited it in resources.
https://www.dropbox.com/s/a65ozwmg46qxf1m/KSLC%20fix.rar?dl=1