Editor improvements

Request help for teeworlds-related subjects (mapping, servers, ..).
For client issues, see our repositories (https://github.com/ddnet/ddnet/issues).
Xandaros
Posts: 10
Joined: Thu Sep 08, 2016 5:03 pm
Player profile: https://ddnet.tw/players/Xandaros/
Clan: Motherland

Editor improvements

Post by Xandaros »

Hello,

I recently started mapping and noticed that the editor is pretty terrible.
I have a few suggested improvements. I would try to implement these myself, but I thought I'd get everyone's input on it, first.
  • I found some mention of an undo function, but I couldn't find it. If it is a thing: How do I use it? If not: Here's how I imagine it to work:
    You have keyboard shortcuts Ctrl-Z and Ctrl-Y. Ctrl-Z will undo the last thing you did, while Ctrl-Y will undo an undo.
    When modifying tile layers, one "edit" is from when you start holding your mouse button to when you release it.
    The actual undo data would be stored in a ringbuffer. I'm not sure about the size, but I'm thinking rather larger. Maybe have a setting for it?
  • When you map and realise you need more space, you have to change the size of each layer individually. I propose being able to edit the properties of multiple layers at once and only show settings that all layers share. Maybe highlight if the values of these properties differ between layers.
  • Often when editing, I find myself wanting to copy something from multiple layers at once. I propose being able to select multiple tile layers and editing them at the same time.
  • Sometimes the spot I chose for something in the map is not ideal and I'd like to move it somewhere else. Currently, I copy it to the desired destination and then clean up the remains. This is really messy when the source and target destination overlap, however. I propose a key bind which would allow you to delete whatever is currently under your brush, like an eraser. This would affect all selected layers, if multi-layer editing ends up becoming a thing.
Well, tell me what you think.

Edit: The undo feature can be enabled by setting cl_editorundo to 1. Doesn't appear to actually do anything, though.
Last edited by Xandaros on Thu Sep 08, 2016 9:05 pm, edited 2 times in total.
User avatar
BannZay
Posts: 837
Joined: Mon May 04, 2015 12:26 am
Location: Ukraine
Player profile: http://ddnet.tw/players/BannZay
Mapper profile: http://ddnet.tw/mappers/BannZay/

Re: Editor improvements

Post by BannZay »

Everything sounds good.
Check this issue before implementing multilayers grabbing. Probably you will have time to fix it. There is discussion about implementing this feature
Xandaros
Posts: 10
Joined: Thu Sep 08, 2016 5:03 pm
Player profile: https://ddnet.tw/players/Xandaros/
Clan: Motherland

Re: Editor improvements

Post by Xandaros »

It would actually solve that issue, since you'd always be painting in the layer you selected it from.
I don't think grabbing something from one layer, then placing it on another is ever a good idea, but feel free to prove me wrong :D

Also - I'm no longer sure I'm actually going to implement this. It's been a while since I've last used C/C++ and I now realise why I have stayed away for so long...
User avatar
BannZay
Posts: 837
Joined: Mon May 04, 2015 12:26 am
Location: Ukraine
Player profile: http://ddnet.tw/players/BannZay
Mapper profile: http://ddnet.tw/mappers/BannZay/

Re: Editor improvements

Post by BannZay »

Xandaros wrote: Also - I'm no longer sure I'm actually going to implement this. It's been a while since I've last used C/C++ and I now realise why I have stayed away for so long...
I`m not profi of C++, also I know only litle part of ddnet src, but you can always request my help with this shit =)
HMH
Posts: 145
Joined: Mon May 05, 2014 8:41 pm
Player profile: http://ddnet.tw/players/HMH/

Re: Editor improvements

Post by HMH »

Xandaros wrote:Also - I'm no longer sure I'm actually going to implement this. It's been a while since I've last used C/C++ and I now realise why I have stayed away for so long...
I think that is not really a problem about C++ but rather the messy code of the editor, I mean there is a file basically containing the whole editor with over 5000 LOC, not very well structured. (I have to admit that I am a little spoiled by the greatness of Qt :P)

Ohh, and yes there is undo but it is kinda buggy and thus disabled by default, to enabled it use: cl_editorundo 1
Xandaros
Posts: 10
Joined: Thu Sep 08, 2016 5:03 pm
Player profile: https://ddnet.tw/players/Xandaros/
Clan: Motherland

Re: Editor improvements

Post by Xandaros »

Yeah, I saw that. When I saw the length of that file, I was rather startled.
Could probably use some splitting.

And no, I don't think it's just the messiness of the code, though that certainly adds to the problem; I think there are a number of things making me uncomfortable working on this code.
C++ is a very unfamiliar language to me, my go-to language is Haskell. I also did some stuff in Java and I use python at work. These are all rather different. (The closest might actually be Java...)
Because I rarely use C++, I don't really have the tools set up. My editor (vim) currently knows nothing about C++ - I should probably install some plugins.
I'm also unfamiliar with the standard library - I have to look up even the simplest things. (I've started work on the multi-layer thing. I had to look up how std::set works...)

Btw, which C++ standard does ddnet use? Can I use C++14?
HMH
Posts: 145
Joined: Mon May 05, 2014 8:41 pm
Player profile: http://ddnet.tw/players/HMH/

Re: Editor improvements

Post by HMH »

C++14 ? Well, unfortunately we do not even have C++11 yet (as some of our servers still run on debian wheezy with a quite old version of gcc). Actually I tried to get C++11 in myself just to notice exactly this. Additionally teeworlds does not really make use of the C++ stl but rather feels like C with classes (which does not mean using it is forbidden). It even defines things like an array-template itself: https://github.com/ddnet/ddnet/tree/master/src/base/tl

Some guide for codingstyle can be found here: https://www.teeworlds.com/?page=docs&wiki=nomenclature

For vim I can recommend installing https://github.com/Valloric/YouCompleteMe with clang-completer enabled.

However, it is nice that you are trying to improve the editor :)

Edit:

This topic might also be useful to you as it contains some toughts on a better implementation of undo: viewtopic.php?f=48&t=2173
Index
Posts: 1133
Joined: Mon May 05, 2014 7:30 pm
Clan: Eagle

Re: Editor improvements

Post by Index »

It's always nice to see new players exploring the editors. Hope you're still able to map although the editor really is not that intuitive at first.
I totally agree, that there are plenty of features that would make it easier and better. But well, you get used to it and after all it's not that bad! :D

Back to your question:
1) About the editor undo, see this thread: viewtopic.php?f=40&t=3633
It's possible but buggy and not recommended (see the post by deen in the linked thread)
2) Resizing all layers at once was suggested like 5236236 times, but it seems to be hard to implement and therefore we still don't have this feature.
I might be wrong though, just take a look at the ddnet github page, there should be more about that.
3) Well, see all the posts here xdd
4) That's already possible, if I get what you mean. Right-click a layer, change the number of 'Shift by X' and click on the XY+/- next to shift. It will move the whole layer content X tiles along the respective axes.
Xandaros
Posts: 10
Joined: Thu Sep 08, 2016 5:03 pm
Player profile: https://ddnet.tw/players/Xandaros/
Clan: Motherland

Re: Editor improvements

Post by Xandaros »

@HNH:
Not even C++11? Err... maybe not, then.
The biggest problem really seems to be the editor codebase. I feel like editor.cpp really should be ~50 files instead of 1...

@Index:
Yes, you do get used to it, but it's still annoying to have to do the same thing over and over again.

I'll just respond to each response individually:
1. Yeah, I figured. I can live without undo, though, it's not as bad as one might think. I'll keep it enabled just in case, however.
2. Did you count? :P I wouldn't be surprised.
I can't imagine it to be too difficult to implement - the biggest problem I see is finding a decent UI for it.
4. That's not what I meant. This would move the whole layer, I only want to move parts, though. Currently, you select an area on the layer and copy it somewhere else. Basically the same, but it would delete your selection on the layer.
User avatar
deen
TECHNICAL Team
Posts: 3575
Joined: Mon May 05, 2014 2:30 pm
Player profile: https://ddnet.org/players/deen/
Discord: deen#5910

Re: Editor improvements

Post by deen »

Xandaros wrote:C++ is a very unfamiliar language to me, my go-to language is Haskell.
Wrong language, DDNet is C with classes, not C++.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests