Polywell: a text editor component

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Polywell: a text editor component

Post 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!
WetDesertRock
Citizen
Posts: 67
Joined: Fri Mar 07, 2014 8:16 pm

Re: Polywell: a text editor component

Post 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.
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Re: Polywell: a text editor component

Post 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.
User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Re: Polywell: a text editor component

Post 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. :)
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Re: Polywell: a text editor component

Post 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:

Image

Image

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.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Polywell: a text editor component

Post 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?
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Re: Polywell: a text editor component

Post 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.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Polywell: a text editor component

Post 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!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Re: Polywell: a text editor component

Post 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!

Image

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.
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Re: Polywell: a text editor component

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest