Improving the leveleditor

Improving the leveleditor

Postby Edward_Lii » 05 Nov 2011, 10:07

Hello all,

I think the leveleditor needs some improving.

The workflow
The workflow should exist of about three steps.
Placing the initial blocks -> configuring blocks (moving, teleport, notification) -> testing/saving.

To do this there will be two modes, one for editing and one for testing/playing.
I though of a toolbar at the bottom of the screen, which will only be visible when editing.
There will be a few tools in the toolbar: Select, Add block, Erase, Configure block, play/test.


Select:
When this tool is selected you can click on blocks and they will be selected.
You can drag them around and they'll be snapped to the grid, unless you hold shift.
When a block is selected you can delete it by pressing Delete.

It will also be possible to select, move and delete pathpoints using the select tool.


Add block:
In this mode you'll see the current selected type of block half transparent under your cursor.
As you move it will be snapped to the grid, unless you hold shift.
To change the block you'll have to hold Ctrl + scroll, or you press shortcuts (m=moving block, b=normal block)? (<-- not sure about that)

When clicking on a block while using the add block mode you'll select that block.
Just like the select tool the block can be deleted using the Delete key.


Erase:
This tool is just click=delete, no selecting just deletion.


Configure block:
This tool should be able to configure special blocks like moving blocks, notification blocks, teleports, etc...

When clicking on a moving block a dotted line will go from the block to your cursor.
Under your cursor there should be a circle or something reassembling a pathpoint.
By default it will be snapped to grid, unless you hold shift.

The time it takes to reach the pathpoint is determined by a default speed/time per block distance.
It can be changed by using the configure block tool on the pathpoint.


Play/test:
This button will let the player play/test his level.
I'm not sure but I think the pathpoints should be hidden when playing.
And perhaps there can be a few debug options like immortality, invoke swap and save/load state?
To stop playing/testing the Escape key can be used.

Feedback is welcome! ;)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby acme_pjz » 05 Nov 2011, 11:59

Hi,

This is great :) Unfortunately, this will need significant coding and probably break some features by mistake :|
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: Improving the leveleditor

Postby Edward_Lii » 05 Nov 2011, 12:10

Hello acme_pjz,

acme_pjz {l Wrote}:This is great :) Unfortunately, this will need significant coding and probably break some features by mistake :|

I know, but I think it will be worth the effort.
It will make level making much easier and faster.

I'll try to work on it very soon. ;)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby Edward_Lii » 28 Nov 2011, 19:15

Hello all,

I've finally found some time to work on the leveleditor. :)
There's still a lot to do, but the basics are implemented.

There's a toolbar, which contains five tools: Select, Add, Delete, Configure and Play.
You can select them by either clicking in the toolbar or using a shortcut (Configure is the 'w' key).
toolbar.png


With the selection tool you can select a block by clicking on it.
To select more hold shift, dragging can be done by clicking on an already selected block moving the mouse while holding the left mouse button.
No matter what tool the delete key will delete the currently selected blocks.

The camera can be controlled using the arrow keys, and the level dimensions will be shown.
Here's an example:
snapshot1.png

The level width or height will increase when placing or dragging a block outside the level dimensions.
Note that this only works when placing the block on the right or bottom edge, otherwise all the blocks should be relocated.

The add tool works almost the same as in the old editor.
At first I though holding the Ctrl key and then scrolling to change the current type was better, but it turned out to be inconvenient.
When using the add tool you can also select and move objects the same way as the select tool.

The delete tool is easy to use, clicking on blocks will delete them.
You can also delete blocks by moving your mouse over them while holding left mouse button.

Finally the configure tool, it still requires some work, currently it has only effect on notification blocks.
Saving can be done using Ctrl+s or the save button, loading using Ctrl+o or the open button.
Also hovering over blocks and pressing Enter still works, at least for notification blocks. ;)


TODO List:
    [] Implement copy and paste. (Done)
    [~] Support moving blocks (Almost Done).
      [] Show movingMark when placing positions. (r132)
      [X] Possibility to remove/change certain positions, instead of remaking the whole path.
    [] Support teleport/switches/buttons. (Done)
      [] Add a way to delete links. (Done)
      [] Make it possible to configure the behaviour of buttons,switches and portals (Done).
    [] Levelpack editor. (r132)
    [] Someway to configure the name/theme of the level. (Do we actually need level themes?) (r141)
    [X] Placement SDL_Surface doesn't render half transparency, looks pink.
    [] Create drawRectangle(SDL_Rect) method in Functions.cpp. (Done)
    [] Fix bug when moving player/shadow starts. (r135)
    [] Don't allow multiple starts. (r135)
    [X] Bugfixing. :p
    [X] And probably some more...

Feedback is welcome! ;)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby Edward_Lii » 03 Dec 2011, 10:51

Hello all,

Another update, I've added copy/cut/paste support.
You can copy the current selection with Ctrl+c and cut with Ctrl+x.
Pasting is done using Ctrl+v, the clipboard will be pasted on the current mouse location.
The newly pasted blocks will form a new selection and any previous selection will be gone.

Now both shadow conveyor belts and conveyor belts can be configured using the configure tool.

Bug fixes:
    * Moving blocks didn't move, I accidentally changed something but now it's back to normal.
    * Moving spikes didn't reset properly, which could cause instant death on a level restart.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby Edward_Lii » 05 Dec 2011, 17:36

Hello all,

Another update, not that much done. :(
There's now a void drawRect(int x,int y,int w,int h); method in Functions.cpp.

Also added support for moving the camera with the mouse.

Bug fixes:
    * Buttons/switches and teleporters activated even when no id set. (Not really a bug)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby Edward_Lii » 09 Dec 2011, 19:15

Hello all,

I've implemented linking support. :)
It still far from finished but the basics are in.
You can link buttons or switches to all sorts of blocks like conveyor belts, moving blocks or moving spikes.
There's no way to delete links yet, still not sure how to make it easy and convenient. :think:

The way portals work is slightly different now, they have a destination property.
The advantage is that you can have a portal link to a portal that, instead of pointing to the first portal, can point to any other portal.
The downside is that you'll have to link portal A->B and A<-B in order to let them behave as before. (And it isn't visible that there are two lines).
snapshot2.png

I've also made a void drawLine(int x1,int y1,int x2,int y2,SDL_Surface* dest,Uint32 color=0) function.
and extended the drawRect method to also use a destination surface and color.

Bug fixes:
    * Changed the property behavior to behaviour for both the button and the switch.
    * The swap sound when using portals is played even if sound is disabled.
    * Blocks will now only apply certain editor data if a key for that data is in the given editor data.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby Edward_Lii » 17 Dec 2011, 13:41

Hello all,

The configure tool has changed a little.
There are now two ways to configure a block, right clicking and pressing enter while above the block.
The right mouse button is used to link portals,buttons or switches and will be used to configure moving blocks.
Enter will cause a popup screen where some things can be configured like behaviour, enabled/disabled, (conveyor belt) speed, etc...
Now you can also select, drag and delete blocks using the left mouse button with the configure tool.

When in configure mode lines are drawn between trigger and target.
The path of moving blocks is also visualized by lines, every position is marked by a selectionMark.

There's also an "Are you sure?" question when exiting the editor.

Bug fixes:
    * Moving blocks can now be moved.
    * Pasted objects are saved at the correct location.
    * Fixed crash when pixels of a line came beyond the screen dimensions.
    * Fixed camera position when leaving playMode.
    * Fixed that target caused a segfault when deleted.
    * Fixed that moving blocks caused a segfault when deleted.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Improving the leveleditor

Postby Edward_Lii » 24 Dec 2011, 09:04

Hello all,

Another update, moving blocks can now be configured.
Paths can be made, extended and cleared.
Changing existing paths isn't possible yet but I'll try working on that.

Here's a screenshot showing movingblocks and their paths.
snapshot3.png


Bug fixes:
    * Conveyor belts can now be set disabled using the configure tool.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Who is online

Users browsing this forum: No registered users and 1 guest