Skip to content
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

Design and implement more capabilities and devices #26

Closed
21 tasks done
byorgey opened this issue Sep 21, 2021 · 23 comments
Closed
21 tasks done

Design and implement more capabilities and devices #26

byorgey opened this issue Sep 21, 2021 · 23 comments
Labels
C-Project A larger project, more suitable for experienced contributors. G-Design An issue having to do with game design. G-Entities An issue having to do with game entities. L-Capability checking Capability checking determines which capabilities are required by a given piece of code. S-Critical This is an issue that seriously affects playability or user experience. Z-Feature A new feature to be added to the game.

Comments

@byorgey
Copy link
Member

byorgey commented Sep 21, 2021

There are quite a few capabilities that are missing; see the comments in Swarm.Language.Capability. This will require some creative thinking and careful planning and testing.


Here is a list of commands and related issues (TODO):

Here is the list of capabilities that are missing devices:

Here is a list of devices that provide a capability but are missing a recipe (see also #361):

In addition, the following commands require god capability and are currently only intended for scenario development and not available to players (except for creative mode):

  • RobotNamed, RobotNumbered
  • As
  • Create

Since #373 the exception users will see if there are no devices to provide required capability looks like this:

Missing the random capability for:
  'random'
 but no device yet provides it. See
 https://github.com/swarm-game/swarm/issues/26

Restricted commands give different message:

Thee shalt not utter such blasphemy:
  'as'
  If't be true thee wanteth to playeth god, then tryeth Creative game.
@byorgey byorgey added Z-Feature A new feature to be added to the game. C-Project A larger project, more suitable for experienced contributors. G-Design An issue having to do with game design. G-Entities An issue having to do with game entities. L-Capability checking Capability checking determines which capabilities are required by a given piece of code. S-Critical This is an issue that seriously affects playability or user experience. labels Sep 21, 2021
@xsebek
Copy link
Member

xsebek commented Oct 5, 2021

I would really like to link the “counter” to a small solar panel and have a pocket calculator with arithmetic capability. 🧮

@byorgey
Copy link
Member Author

byorgey commented Oct 6, 2021

I like that idea! =) I had some vague thoughts about making an "ALU" but I like this better. What should be the recipe for a solar panel?

@xsebek xsebek mentioned this issue Oct 13, 2021
@xsebek
Copy link
Member

xsebek commented Oct 13, 2021

Sorry for the late reply @byorgey. I think solar panel mainly needs glass and some copper wires. It would be really nice to only add sand on water beaches, but I am not sure if the noise function in water terrain generation would work for that. Assuming we had sand, I imagine the recipes would be:

     furnace
sand ───┴─── glass

     3D printer
glass ──┬┴─── solar 
copper ─┘     panel
wires

     3D printer
counter ──┬┴─── calculator
solar ────┘
panel

I only used 3D-printer to look fancy and avoid making recipe for cadmium telluride or something like that. 😏

@byorgey
Copy link
Member Author

byorgey commented Oct 14, 2021

Yes, adding sand would be nice. I think we could probably find a way to put sand around the edges of water. We would have to play with it. (Filed as #336.)

A 3D printer does make it look fancy, but that means that only the base will be able to carry out those recipes at first --- for automation's sake I think we should make it possible for other robots to make these recipes.

@byorgey
Copy link
Member Author

byorgey commented Mar 23, 2022

-- Some additional straightforward ones, which however currently
-- cannot be used in classic mode since there is no craftable item
-- which conveys their capability.
Appear -> [CAppear] -- paint?
Whereami -> [CSenseloc] -- GPS?
Random -> [CRandom] -- randomness device (with bitcoins)?
Neg -> [CArith] -- ALU? pocket calculator?
Whoami -> [CWhoami] -- mirror, needs a recipe
-- comparator?
Eq -> [CCompare]
Neq -> [CCompare]
Lt -> [CCompare]
Gt -> [CCompare]
Leq -> [CCompare]
Geq -> [CCompare]
And -> []
Or -> []
Add -> [CArith]
Sub -> [CArith]
Mul -> [CArith]
Div -> [CArith]
Exp -> [CArith]
-- Some more constants which *ought* to have their own capability but
-- currently don't.
Say -> []
View -> [] -- XXX this should also require something.
Run -> [] -- XXX this should also require a capability
-- which the base starts out with.
Not -> [] -- XXX some kind of boolean logic cap?
Inl -> [] -- XXX should require cap for sums
Inr -> []
Case -> []
Fst -> [] -- XXX should require cap for pairs
Snd -> []
Try -> [] -- XXX these definitely need to require
Raise -> [] -- something.

byorgey added a commit that referenced this issue Jun 4, 2022
As described in
#26 (comment)

`calculator` device provides `arith` capability.
@byorgey
Copy link
Member Author

byorgey commented Jun 10, 2022

Some additional ideas related to #361 . I want to wait until #373 lands and then add these things.

  • quartz can be mined. From quartz one can make silicon; also quartz could be an ingredient for making a clock.
  • silicon + strange loop + some number of bits -> circuit
  • Add red, green and blue pixel entities that grow and can be harvested, like bits
  • glass + 10 red pixel + 10 blue pixel + 10 green pixel -> camera
  • camera + circuit -> scanner

Started implementing these things on https://github.com/swarm-game/swarm/tree/quartz .

@byorgey
Copy link
Member Author

byorgey commented Jun 13, 2022

Ideas for a device to give the compare capability: a comparator perhaps?

Recipe?

  • 2 copper wires +
  • 1 see-saw (made out of 1 board + 2 wooden gears)

I think we want comparison to be available pretty early. All the basic things you want to do with arithmetic (e.g. writing repeat : int -> cmd () -> cmd ()) also require comparison.

OK, this is now also in https://github.com/swarm-game/swarm/tree/quartz .

mergify bot pushed a commit that referenced this issue Jun 15, 2022
- Add quartz and quartz mines
- Add `clock`, `silicon`, and `circuit`
- Add `comparator` device
- Metal drills can now drill through boulders too
- Add pixels to the world, and recipes for `camera` and `scanner`

See discussion at #26 (comment) and #361 .
@xsebek xsebek pinned this issue Jun 15, 2022
@byorgey byorgey unpinned this issue Jun 16, 2022
@byorgey byorgey pinned this issue Jun 16, 2022
@byorgey
Copy link
Member Author

byorgey commented Jun 16, 2022

Didn't realize we have a create capability. I always intended for create to be available only in creative mode, so maybe we should make it CGod also?

@byorgey
Copy link
Member Author

byorgey commented Jun 16, 2022

I think we should just get rid of the say command, at least for now. It used to do something but kind of got left behind when we added logger devices.

@xsebek
Copy link
Member

xsebek commented Jun 16, 2022

@byorgey I was thinking say would become useful as a global God log (we could read messageQueue in some pop-up creative window) and check in the tests (no log required). Maybe other robots could hear you too if they are nearby and listen.

But CCreate and raise are definitely outdated, let me make a PR...

This was referenced Jun 16, 2022
@xsebek
Copy link
Member

xsebek commented Jun 16, 2022

How about making a copper coin and iron coin that would give the random capability?

@byorgey
Copy link
Member Author

byorgey commented Jun 16, 2022

Or how about combining a bit (0) and bit (1) (+ maybe some copper or iron ore?) to make a bitcoin that gives the random capability? 😁

@byorgey
Copy link
Member Author

byorgey commented Jun 16, 2022

I was thinking say would become useful as a global God log (we could read messageQueue in some pop-up creative window) and check in the tests (no log required). Maybe other robots could hear you too if they are nearby and listen.

Ah, those are all good ideas, let's keep it.

@byorgey
Copy link
Member Author

byorgey commented Jun 19, 2022

Idea for 3D printer recipe:

mergify bot pushed a commit that referenced this issue Jun 23, 2022
- remove `raise` command
- rename `error` to `fail` - should suggest both that it is:
  - recoverable - can be caught with `try`
  - pure - `fail: string -> a` - so it can be used outside `cmd`

---

The problem with `raise` was that it was merely a specialized version of `error` (which was not limited to `cmd a`):
```
let raised: string -> cmd a = error in raised "ha"
```
I noticed this while making the list for #26.

On a meta-level, it also conflicts with the `raise` Haskell function we use to throw an error when a command (like `build`) fails.
This was referenced Jun 26, 2022
@xsebek
Copy link
Member

xsebek commented Jul 18, 2022

Run this should also require a capability that the base starts with.

@byorgey do we need that? If #495 is implemented, the program will be inlined and checked for capabilities when hitting Enter in REPL. Unless I am missing something it should not give you any extra power than copy-pasting.

In particular, you would not be able to do:

waitForCommand <- build {require "rock"; until {run "put.sw";ishere "rock"}; grab; nowDoStuff};
// echo 'place "rock";' >> put.sw

@byorgey
Copy link
Member Author

byorgey commented Jul 18, 2022

Oh, I totally agree with you. I wrote that comment a while ago before thinking things through more in #495.

@xsebek
Copy link
Member

xsebek commented Jul 18, 2022

I will also remove say from the list, as I am currently trying to revive it in #513 and it will be useful for it to not require any devices.

We can imagine that speaking is natural to robots, perhaps they just bang the robot shell or whizz with the motor to signal. 🤔

@xsebek
Copy link
Member

xsebek commented Jul 18, 2022

@byorgey you mentioned in #550 that water should be carried in some container - what do you think about using that instead of detonator to allow robots to shortcircuit?

@byorgey
Copy link
Member Author

byorgey commented Jul 18, 2022

@byorgey you mentioned in #550 that water should be carried in some container - what do you think about using that instead of detonator to allow robots to shortcircuit?

Pouring water on yourself to shortcircuit is funny, but it sounds to me like it would just make the robot halt, not cease to exist.

Honestly self-destructing doesn't seem very useful except for system robots. Maybe we should just make it a CGod thing and forget about detonator?

@xsebek
Copy link
Member

xsebek commented Jul 18, 2022

I guess using shortcircuit as a weaker halt (#392) also makes sense, but once you pour water on an electric circuit it can be destroyed forever, so self-destruction seems also plausible to me.

I can imagine situations where you would want to get rid of the robot quickly without collecting it with salvage. Once we have the meet command (and later antennas) one robot left around could break your expectations and any protocol you built on them.

Also, it is just nice from an aesthetic standpoint - once I can create as many robots as I like, I will eventually not want to bother with salvaging them to clean my map view, unless they had an important task.

@byorgey
Copy link
Member Author

byorgey commented Jul 19, 2022

once you pour water on an electric circuit it can be destroyed forever, so self-destruction seems also plausible to me.

OK, sure.

I can imagine situations where you would want to get rid of the robot quickly without collecting it with salvage. Once we have the meet command (and later antennas) one robot left around could break your expectations and any protocol you built on them.

Also, it is just nice from an aesthetic standpoint - once I can create as many robots as I like, I will eventually not want to bother with salvaging them to clean my map view, unless they had an important task.

Yes, good point, you've convinced me. 😄

mergify bot pushed a commit that referenced this issue Jul 28, 2022
Initial list of commands in the commands dialog now includes any commands which
- require a capability provided by an installed device
- require a capability provided by a device in the inventory, or
- do not require any capability.

Right now there are too many things in the list because we need to finish #26 , but that's a separate issue of course.

Closes #588 .
@xsebek
Copy link
Member

xsebek commented Sep 8, 2022

While we no longer plan to finish this issue for the Alpha release, it is IMO good to leave it pinned. 📌

If anyone has a good idea for devices/recipes feel free to discuss it here, in a separate Issue or on IRC. 🙂

mergify bot pushed a commit that referenced this issue Jan 5, 2023
Add a new `GPS receiver` device which enables the `senseloc` capability (and hence the `whereami` command).  Towards #26 .

- My immediate motivation is that I want to be able to define `excursion : cmd unit -> cmd unit` which executes the given command and then returns to the same location and orientation as before.  Being able to use the `whereami` command is one of the last missing pieces of machinery necessary to be able to do this in classic mode (the other is a `heading` command, see #955).
- The proposed recipe for `GPS receiver` is `antenna + circuit + clock + compass`, which is a somewhat difficult recipe (`antenna` requires `silver` which requires a `deep mine`; a `clock` requires `quartz` + a bunch of `iron gears`, etc.).  One might wonder whether we should make the recipe easier since finding out where you are seems like a kind of fundamental operation.  However, consider that in order to even be able to make use of the result of `whereami` you need at least (1) an `ADT calculator` to deal with the pair (which transitively requires `typewriter` -> `circuit` -> `silicon` -> `quartz`) (2) probably things like `comparator` and `calculator` to do anything useful with the coordinates.  By the time you have those things you can definitely already build `circuit` + `clock` + `compass`, and you're probably not that far away from getting some `silver` for an `antenna`.  Also, in practice it's an interesting/fun constraint to build up machinery that has to work entirely based on *relative* position without being able to find out your absolute coordinates.
- For some reason this is causing `Testing/508-capability-subset` to fail.  I think perhaps it is due to #397 ?  I will investigate. *EDIT*: unfortunately, that wasn't it!
@xsebek xsebek unpinned this issue Jan 15, 2023
mergify bot pushed a commit that referenced this issue Jan 23, 2023
mergify bot pushed a commit that referenced this issue Jan 23, 2023
@byorgey
Copy link
Member Author

byorgey commented May 12, 2023

There are only two items left (creating a device for teleport, and a recipe for detonator), neither is that important, and both have their own issue marked as "low hanging fruit". I think I'm going to close this issue now, but anyone should feel free to reopen if there's a reason it would be helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Project A larger project, more suitable for experienced contributors. G-Design An issue having to do with game design. G-Entities An issue having to do with game entities. L-Capability checking Capability checking determines which capabilities are required by a given piece of code. S-Critical This is an issue that seriously affects playability or user experience. Z-Feature A new feature to be added to the game.
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants