Live data from Hacker News

Swift and the Cute 2d game framework: Setting up a project with CMake

layer22.com

41–50 of 85 posts

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#41
post #11

Last night I tried for maybe about 6 hours so many combinations of efforts to compile a C++, SDL3 and Lua program on Windows, with different IDEs, build systems, compilers, package managers etc. Finally I'm just giving up and using VS with CMake and vcpkg. The main problem is that there's way too many words on all those documentation pages. It would have taken 3 or 4 days to read them all, and maybe only 2 hours wort…

What's the relation of your comment to this blog post?

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#42
post #32

Earlier quoted context omitted.

My theory is that good C++ devs haven't yet made a simple yet powerful build system because they're too busy making lots and lots of money writing enterprise C++.

We all just accepted CMake. It's not perfect but it works. C++ with SDL and Lua in a mono repo should be trivial. SDL3 supports CMake and Lua is simple to compile and make a CMakeLists.txt for.

This is correct. It has the key things that most C++ devs tend to care about:

- Cross platform support well integrating into "native" tooling

- Endless ability to add weird hacks to things to get around problems

The syntax is ...passable. I've never gotten a java stacktrace during a build failure (ahem bazel ahem).

It's straightforward enough to do the horrible things that C++ devs do all of the time like having 3 dependencies from system apt, 2 vendored, actually a 3rd is vendored but only used on windows, where the other 2 come from vcpkg, and 4 of these are statically linked but the last (openssl) is dynamic and accepts any version in order to support both ubuntu LTS and arch, but shipped as a dll on windows.

I have prayed before the CMake gods and they have accepted me.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#43
post #41
post #11

Last night I tried for maybe about 6 hours so many combinations of efforts to compile a C++, SDL3 and Lua program on Windows, with different IDEs, build systems, compilers, package managers etc. Finally I'm just giving up and using VS with CMake and vcpkg. The main problem is that there's way too many words on all those documentation pages. It would have taken 3 or 4 days to read them all, and maybe only 2 hours wort…

What's the relation of your comment to this blog post?

Mainly it just reminded me of what happened last night and seemed like good timing because of the similarity, but also I appreciate blog posts that are short and get right to the point of how to do something.

Half of the problems I got past were thanks to odd blog posts like this with code snippets that I found on google and got me unstuck immediately.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#44
post #11

Last night I tried for maybe about 6 hours so many combinations of efforts to compile a C++, SDL3 and Lua program on Windows, with different IDEs, build systems, compilers, package managers etc. Finally I'm just giving up and using VS with CMake and vcpkg. The main problem is that there's way too many words on all those documentation pages. It would have taken 3 or 4 days to read them all, and maybe only 2 hours wort…

If you’re interested in Zig check out https://github.com/castholm/SDL . Try the breakout example, I play around with it a lot. You’ll just need the Zig 0.14 compiler and it should be painless.

Something about me has always wanted to learn and master C++. I've read through Stroustrup's book almost entirely, and still never written a single line of C++. I don't know why I have this goal in life, but I do. This project still doesn't do that, since I'm just wrapping SDL3 with QuickJS and will probably almost entirely just write C functions to do it with. But a man can dream.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#45

> For many games variable timestep is a good choice. It really isn't.

You can use fixed time step. Choice is yours.

What's funny is that searching for "cute framework fixed timestep" in Google points to this Hacker News thread as the first result. What I would have wanted to find is this page:

https://randygaul.github.io/cute_framework/#/topics/game_loo...

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#46
post #33

> For many games variable timestep is a good choice. It really isn't.

Care to elaborate?

Assuming the timestep refers to the parts of code dealing with game logic updates, such as physics or motion, variable-sized steps tend to cause nasty issues. Collision detection is an example, where variability is undesired.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#47
post #26

> For many games variable timestep is a good choice. It really isn't.

If you divorce the game's time-step from your math it isn't too much of an issue. You just need to keep track of the time-delta so you have it for your calculations.

Gaffer has summarized most of this quite well years ago. E.g. https://gafferongames.com/post/fix_your_timestep/

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#48
post #34

Thanks for sharing a simple setup that avoids SwiftPM. It is nice to have more options. Swift has to shed the perception that it only works on apple platforms. I've found the the C++ interop to be pretty good for my computer vision use cases.

Yeah, it's nice to use a cross-platform, well established tool to actually build a Swift project.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#49
post #29

Earlier quoted context omitted.

Very often you can snatch free copies. Join the Discord. Just ask :)

As someone who dreams of making a living selling software that I've poured years and years into, that comment makes me very sad.

But why?

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#50
post #33

> For many games variable timestep is a good choice. It really isn't.

Care to elaborate?

https://randygaul.github.io/cute_framework/#/topics/game_loo...

You can request a fixed timestep, and your own loop callback will be called at fixed intervals, which allows you to completely ignore delta time.

Post reply on HN