6

Jun 28, 2024

Matt Walker writes:

This is an extremely early stage of development, but basically at this point it is possible to:

  • Call any builtin Godot utility function or method (static, virtual, or otherwise) from OCaml easily, and with documentation comments for the original function intact an available through your favourite OCaml LSP implementation.
  • Use Godot (binary) operators in a natural way from OCaml. (Unary operators are currently broken, which I will be investigating!)
  • Construct Godot values from OCaml easily, and from OCaml analogues if they exist (e.g. I incur a dependency on Gg for low-dimensional vector math)
  • Marshalling in and out of all these functions to/from the OCaml analogues. That is, a method that is in Godot on an object of type ClassyClass taking an int parameter and returning an int will appear in Godotcaml as int64 -> ClassyClass.t structure ptr -> int64, where the ClassyClass.t structure ptr is the “pointer to the Godot object”, commonly called self. (Note that this is always the last argument, to facilitate pipeline-style programming when GDScript programmers have a method-chaining interface.)
  • Naturally define a new Godot class in OCaml that inherits from an existing Godot-registered class. (Currently NOT tested with classes defined in GDScript and/or externally.)
  • Most of the code-gen for custom engines that define new stock/builtin types and classes, etc.
  • Simulated inheritence for stock (and easily extendable to user-defined) classes using module inclusion: That is if Derived inherits from Base, then simply include Base in the module representing Derived, and you get access to all the methods from Base without explicit casting (or in the case of Rust’s gdext, object composition).
  • Naturally define a new Godot method in OCaml and have it called from GDScript or another Godot-bound language. (ergonomics still WIP).

Read Announcing Godotcaml for Godot 4.2

See also: Setting Up a Godotcaml Project (Today)

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here
this post was submitted on 15 Jul 2024
6 points (100.0% liked)

OCaml

63 readers
1 users here now

A community for the OCaml programming language https://ocaml.org

Looking for mods, if you want to mod the community feel free to dm Ategon

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 10 months ago
MODERATORS