Page 1 of 5
Polywell: a text editor component
Posted: Wed Aug 10, 2016 1:35 am
by technomancy
Hi folks.
I just published the initial cut of Polywell, which is a massively-reprogrammable text editor component for LÖVE which I extracted from my programming game Bussard.
https://gitlab.com/technomancy/polywell
Features:
* Undo
* Lua syntax highlighting
* Multiple buffers
* Rebindable key commands
* Configurable by writing Lua code
* Live completion when opening files or changing buffers
* User-definable modes which can inherit
* Can work with an in-game "virtual filesystem" table or real filesystem
* Comes with a console for running Lua code
* Easy to sandbox
* Rudimentary screen split support
* Emacs key bindings (optional)
Polywell is designed to worked in a sandboxed environment, so you can use it to allow players to code against a limited in-game API or use it to hack on your own game from the inside.
All the setup happens by loading Lua code; in fact the editor does nothing until you configure it to bind commands to certain keystrokes. Here's a sample of what a default configuration could look like:
https://gitlab.com/technomancy/polywell ... g/init.lua
And here's a sample of how you can integrate it into your own games:
https://gitlab.com/technomancy/polywell ... r/main.lua
Feedback welcome!
Re: Polywell: a text editor component
Posted: Wed Aug 10, 2016 6:35 pm
by WetDesertRock
Looking at it, is it just a console, or is it an editor? I launched the main demo but it is only a console. Maybe I'm missing something.
Re: Polywell: a text editor component
Posted: Thu Aug 11, 2016 1:20 am
by technomancy
Oops; haha. I realized it's not very clear from looking at it; I pushed a fix that clarifies a bit.
So it's an editor, but the sample code just happens to boot to a console buffer by default. From the perspective of Polywell, the console is just another buffer that just happens to not be saved to a file; you can edit it (except for the prompt). The only difference is that the console is configured so that when you press enter it grabs the input on the last line, evaluates it, and prints the return value.
When you're in the editor, you can press ctrl-o to open another file or create a new one. In the sample code, this uses a "virtual filesystem", which is a fancy way of saying all the files are stored in a table in-memory and not persisted to disk, but it's easy to use it in a way that writes to the real filesystem. I should probably include an example of that though.
Edit: In case it wasn't clear from the readme, my hope is that people will use this to add hackability to their games; both for during the development cycle (to improve the feedback loop of making changes) and afterwards. I personally can get a lot more out of a game if I can poke under the hood, write commands, rebind keys, etc. IMO the ability to construct sandboxes is the #1 feature that distinguishes Lua from other languages, and it's a shame not to take advantage of it to empower users.
Re: Polywell: a text editor component
Posted: Thu Aug 11, 2016 2:25 am
by Kingdaro
I'd add some screenshots if I were you. Sounds neat, but we'd be able to get a better idea of what it actually
is if we could see what it looked like. An animated gif would be pretty nice.
Re: Polywell: a text editor component
Posted: Thu Aug 11, 2016 2:49 am
by technomancy
Kingdaro wrote:I'd add some screenshots if I were you.
Good idea, but for now it looks the same as Bussard, the game from which it was taken, so here are some shots of that:
Just pretend the background is black instead of transparent, and that's what Polywell looks like. Of course it's easy to change the font and color theme in-game or out of it.
Edit: I added a screenshot to the readme along with a more detailed explanation of the philosophy, why you would want to use this in your project, etc.
Re: Polywell: a text editor component
Posted: Wed Aug 17, 2016 5:41 pm
by Positive07
I'm glad I'm not the only one doing this kind of stuff haha.
Many years ago I did Challenger, but I dropped it (I think I deleted this repository, it was kinda old and had nothing big nor important), now I have something mostly working, still missing many features
So it's really nice seeing this kind of project here!
EDIT: I don't see so much HYPE around this, but I completely value what you got here since is something really great, text editting is really not nice in LÖVE. I wanted to ask you:
How are you gonna keep this project up?
What are your plans for the future?
Any intentions on implementing mouse support?
What about pretty printing? Currently you can only change color right? What about rendering with multiple fonts and that kind of stuff?
Re: Polywell: a text editor component
Posted: Sun Aug 28, 2016 12:50 pm
by technomancy
Positive07 wrote:
So it's really nice seeing this kind of project here!
Thanks! I know not everyone is going to get the idea behind this, but to me there's nothing in coding that's more important than internal reprogrammability; it changes everything, and once you get used to it there is no going back.
Positive07 wrote:
EDIT: I don't see so much HYPE around this, but I completely value what you got here since is something really great, text editting is really not nice in LÖVE. I wanted to ask you:
How are you gonna keep this project up?
What are your plans for the future?
Any intentions on implementing mouse support?
What about pretty printing? Currently you can only change color right? What about rendering with multiple fonts and that kind of stuff?
I plan on continuing to hack on the code in order to improve Bussard. I don't have that many plans for future features though as it is pretty close to being finished. The main things still missing are:
* UI to control screen splits (the underlying functionality is already there and works great)
* Auto-completion for Lua code (this is really easy; I've implemented it in Emacs already)
* Smarter indentation (might be a bit tricky)
* Emacs-style prefix keymaps (so you can do stuff like ctrl-x ctrl-s being bound to a single command)
I'm probably missing a few, but those are the biggest ones. I've added all these to the issue tracker:
https://gitlab.com/technomancy/polywell/issues
I have no plans to add mouse support. I would accept patches for it though.
Rendering something in multiple fonts is probably not going to happen unless love.graphics.print also adds the same functionality.
Re: Polywell: a text editor component
Posted: Sun Aug 28, 2016 8:07 pm
by Positive07
I see, that is really nice, I hope for a colaboration between our projects when I get something decent working.
It would be great if we could help eachother with our editors! Glad to see your projects, cheers and good luck!
Re: Polywell: a text editor component
Posted: Thu Sep 01, 2016 2:45 pm
by technomancy
I was curious how feasible it would be to develop a game entirely from inside Polywell. There are a few bits that are rough around the edges when you introduce bugs, but overall it's pretty nice!
I put this together in a couple days; you can find the love file here:
https://p.hagelb.org/liquid-runner.love
This is a bit different from Bussard since there is no sandboxing; the only in-game coding is for hacking on the game itself. But reloading from inside the game works fine.
Re: Polywell: a text editor component
Posted: Wed Sep 07, 2016 6:43 am
by technomancy
I had another crazy idea. I have heard a lot of buzz around Pico-8 which allows you to construct simple lo-fi games all from within one program that serves as text editor, graphics editor, and chiptune composition environment. I think you could build something similar in Love, but maybe without the lo-fi feel or the extreme limits on file size and memory use.
Polywell already lets you do in-game code editing, and I think if you added in a pixel art editor and a music tracker, you could have a nice convenient framework that lets you build everything from the inside out.
Personally I really feel like the "coding from inside the game" aspect helps flow during programming a lot. I feel like graphics could probably benefit from the same style of development as well, and maybe music, but I'm not sure.
Thoughts?