Comment by Razengan
2 days ago
I'll start a brainstorming/drafting repo once I'm confident in deciding what I want.
Stating my sources of inspiration will win some people and turn off some people: In terms of syntax, Godot's GDScript comes closest to my ideal. In terms of features, Swift.
One thing I really want to try: instead of "functions" I want it to be "event handlers", so instead of
func doSomething()
you'd say
on doSomething()
A class instance could "contain" or "own" another class instance at runtime, similar to Godot's node-based hierarchy, and sending the `update()` event/signal to an instance could propagate it down the tree, making it easy to implement an entity+components architecture.
and you could overload handlers based on which type raised the event or emitted the signal:
on doSomething() by PlayerClass
`caller` would be a keyword/object just like `self` is, in every handler scope so you could see `if caller is Player` or Monster for example.
Most relevant in terms of gameplay, I want `Stat` to be a core type: a number that has a maximum and minimum, and conditional buffs/debuffs affecting the final value, and so on.
Hmm, interesting! Sounds a bit like a DSL for ECS with tight integration of event handling.
There's other out-there ideas that I don't remember seeing elsewhere and I don't know what made me think of them, but I definitely want to try:
For example, let's call it "environments" or "event scopes": If a game entity (class) is in a certain environment/scope, that environment can trap/intercept all events/signals sent to/from that entity.
I'm not yet sure how exactly it would work/look, but I feel like it could be useful for easily implementing complex RPG-like conditions like: "Hitting {purple} {orcs} with this sword on a {Tuesday} night with a {full moon} deals +42 damage"
So none of the base objects need to know about that condition, but the "environment/scope" could impose or "overlay" extra conditions on every event passing through it..