swarm-game / swarm

Resource gathering + programming game
Other
837 stars 52 forks source link

Nice in-game support for scenario creation/editing #558

Open byorgey opened 2 years ago

byorgey commented 2 years ago

It would be super cool to have an in-game graphical scenario editor, where you could move a cursor around, draw terrain and entities, place robots, create custom entities and code, etc...

Of course the scenarios would still be stored in .yaml files, so creating them by hand will always be an option.

This would obviously be a massive undertaking, and I don't think it needs to happen any time soon, but I just thought of it today so writing it down!

xsebek commented 2 years ago

Selecting a cell with right click and then drawing by holding left mouse button would be pretty sweet. 🎨

xsebek commented 2 years ago

For inspiration, asciiflow has a simple editor with some line drawing logic that could be useful for mazes.

byorgey commented 2 years ago

Wait, I just had an epiphany --- we don't need to make a scenario editor, because you should be able to just program your own! A few ingredients would go into this:

byorgey commented 2 years ago

Well, OK, being able to draw stuff with the mouse would still be pretty cool, too. But maybe we can think of an in-game way to do that---like some device that lets you receive mouse events and respond to them somehow, similar to #102 . If we also had the ability to teleport entities in creative mode, you could then write a little program that responds to mouse events by teleporting certain entities to the proper coordinates.

byorgey commented 2 years ago

The overarching principle here is that this is a programming game --- instead of building in more and more cool features into the game itself, we should just build in programming language features that let players build the cool game features they want. (It even already says this in DESIGN.md, believe it or not. :smile: )

xsebek commented 2 years ago

That is quite mind blowing and I love it! 🤯 Making mouse events an upgrade sounds good to me, I guess you just get coordinates and a boolean. 🤔

Making saves compatible with scenarios would be great and this interactive workflow could really save time.

byorgey commented 2 years ago

Making mouse events an upgrade sounds good to me, I guess you just get coordinates and a boolean.

I guess it depends how sophisticated you want to be. Many real GUI frameworks differentiate between more than two kinds of mouse events, e.g. mouse down, mouse up, mouse move, etc. I mean, I guess we should just see what mouse events are provided by brick and just pass those along.

xsebek commented 2 years ago

We still might need a form to set some parts of the game like the world function. After you are done with the scenario you would probably want to e.g. reset time, add win conditions and description.

byorgey commented 2 years ago

Yes, that's very true. And maybe it's worth building some of that into the app so that you can create a scenario without directly editing a .yaml file. But at least we don't need to build an actual graphical world editor.

byorgey commented 4 months ago

Note, we do now have a prototype in-game editor, though it's still somewhat limited.