defun-games / claylib

A Common Lisp 2D/3D game toolkit built on top of Raylib 4.5.
zlib License
73 stars 4 forks source link

I want to make a forks. #78

Open Filipp-Druan opened 1 year ago

Filipp-Druan commented 1 year ago

Hello! I like a Raylib but Claylib not everything suits me: 1) Raylib and Raygui are merged into Claylib as a single wrapper library. 2) The Raygui executable is bundled with the wrapper instead of being installed separately. This is slightly inconvenient for me as I would prefer to install the executable myself. 3) Probably due to the second point, Claylib is not available in Quicklisp. I have to clone the repository into local-projects. 4) I am not satisfied with the implementation of vectors and matrices. In the Lisp community, there are very successful libraries for 3d-vectors, 3d-matrices, and 3d-quaternions (let's call them the "linear trio"). The function names in these libraries are much more convenient (although the names are shorter, so it will take some getting used to). It would be great to use them instead of reinventing the wheel.

I would like to suggest splitting the library into two separate libraries. Additionally, I would like to replace your implementation of linear algebra with the "linear trio" libraries that are widely used in the Lisp community. Do you think it would be difficult to make these changes? I'm ready to write new libraries on my own.

Thanks!

shelvick commented 1 year ago

Hi there, thanks for your enthusiasm and willingness to push the project forward! I'll say that overall the changes you're proposing are more work than I (personally) am willing or able to do right now -- but that doesn't mean I wouldn't merge any PRs you submit, as long as they make sense. You could also of course make a fork; no offense taken.

It may be helpful though to understand some of the design choices before you go on that path:

Raylib and Raygui are merged into Claylib as a single wrapper library.

Yes, the vision of Claylib was as a beginner-friendly "batteries included" tool, which meant including things like Raymath and Raygui and wrapping them in a strong Lispy layer. cl-raylib exists for people who might want just a thinner wrapper over Raylib only. I suspect it wouldn't be too difficult to split into something like Claylib and Claygui. Where you'll run into trouble is with Raygui itself, because you actually have to build Raygui differently depending on whether you're using it with Raylib or standalone. That would in turn cause issues using Claylib and Claygui at the same time.

The Raygui executable is bundled with the wrapper instead of being installed separately. This is slightly inconvenient for me as I would prefer to install the executable myself.

Claylib does support this, via the CLAYLIB_USE_SYSTEM_RAYLIB_LIBRARIES environment variable. See #71. Though, do also see #77 -- it expects the tagged Raylib 4.5 release.

Probably due to the second point, Claylib is not available in Quicklisp. I have to clone the repository into local-projects.

That's not due to the second point, but the fact we've only tested comprehensively on Linux and SBCL. This is relatively low-hanging fruit and I'd love to be able to build for Mac and Windows, and ideally other CL distributions too.

I am not satisfied with the implementation of vectors and matrices. In the Lisp community, there are very successful libraries for 3d-vectors, 3d-matrices, and 3d-quaternions (let's call them the "linear trio"). The function names in these libraries are much more convenient (although the names are shorter, so it will take some getting used to). It would be great to use them instead of reinventing the wheel.

We didn't reinvent the wheel -- not exactly. What we did was create "pass-through" CLOS objects. If you look under the hood you'll see that they're really just convenient ways of interfacing with Raylib's own C structs. I'm not entirely familar with how those Lisp libraries work so am willing to be proven wrong, but I suspect it won't be as easy as you're hoping to just plug those in and have them work seamlessly with the passthrough Raylib functions. For Claylib's own native shape classes, maybe, but then that seems like more trouble than it's worth.

Filipp-Druan commented 1 year ago

Thanks, I'll consider if it's worth creating a fork for professional development. I don't think you should split the library. Look, you've got a huge amount of code generated there that connects C and Lisp. Could you talk about how you did it? Can I post your answer on my blog?

shelvick commented 1 year ago

Look, you've got a huge amount of code generated there that connects C and Lisp. Could you talk about how you did it?

Are you talking about the claw wrapper layer, or all the Lispification on top of it? Or both?

For the wrapper layer, to rebuild that you can check the docs in wrap/lib/BUILD.md and wrap/README.md. Not sure I'd have much more to say on that part.

For Lispification, the short answer to that is: Macros. :grin: The critical parts are in src/helpers.lisp. I am certain some of those macros could be better written, and they may steepen the learning curve if you're creating a fork. But once you get used to them, extending the toolkit is a breeze.

Can I post your answer on my blog?

Of course! Did you have any specific questions?

Filipp-Druan commented 1 year ago

Please, tell my, can Raygui support a Cyrillic chars?

shelvick commented 1 year ago

I don't know the answer to that one. You'd have to check the Raygui issues/docs. If Raygui does but Claylib does not -- maybe I can help with that.