Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’ve been braining about a hypothetical language made from the ground up to be ideal for coding gameplay logic, and not worrying about hardware.

I’m designing from the syntax first but have no idea/energy to actually implement the language/runtime or have it be usable with Godot etc.

If I make the syntax and someone likes it, how to get someone to help me make it? :)



I'm probably not gonna do it, but just out of interest: What is the syntax?


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..




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: