-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nice in-game support for scenario creation/editing #558
Comments
Selecting a cell with right click and then drawing by holding left mouse button would be pretty sweet. 🎨 |
For inspiration, asciiflow has a simple editor with some line drawing logic that could be useful for mazes. |
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:
|
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. |
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. 😄 ) |
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. |
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 |
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. |
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 |
Towards #558 I was motivated to build this after finding that editing scenario maps directly in the YAML file is rather constraining. ## What I've implemented so far * A small, collapsible panel to the left of the REPL containing World Editing status/operations. Enter world-editing mode with CTRL+e to show the panel. * This works only in `--cheat` mode * Terrain selection * A "picker"/"eye dropper" middle-click mechanism to select a terrain style to draw. * A pop-up selector to choose between the 5 different types of terrain. * Drawing terrain with the left mouse button * Saving a rectangular section of the world map (terrain only) to a file with CTRL+s * Code organization * The complete state of the World Editor, including "painted overlays" of terrain, is contained within the `uiWorldEditor` field of `UIState` record. * The bulk of the World Editor functionality shall be in new modules * Some refactoring of `Controller.hs` and `View.hs` to extract functions utilized by the World Editor (towards #707) ## Vision * The audience for this tooling is strictly envisioned to be Scenario authors. * Though, if we eventually allow swarm-lang to program the UI, there may be some common code to extract. * The World Editor is intended to be compatible with a workflow of editing maps in text form within YAML scenario files. # Demos ## Round-trip with random world stack run -- --scenario creative --seed 0 --cheat Then Ctrl+e, tab down to the Save button, hit Enter to save the map In another tab run: stack run -- --scenario mymap.yaml Toggle between tabs to compare, observe the derived map is an identical 41x21 subset.
Note, we do now have a prototype in-game editor, though it's still somewhat limited. |
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!
The text was updated successfully, but these errors were encountered: