News for hackers. Stuff that matters.
Re:Parsing S-expressions in C (2019) by outworlder on Thursday August 20, 2020 @04:31PM (#24228555)
Those Scheme interpreters are tiny!

I can guarantee you that a game will need a scripting language. Better get that done already.

That's if you prefer Scheme. You could use Lua too.

Re:Parsing S-expressions in C (2019) by learc83 on Thursday August 20, 2020 @04:48PM (#24228762)
>I can guarantee you that a game will need a scripting language. Better get that done already.

Myself and thousands of people before and after me have written games without a scripting language.

Re:Parsing S-expressions in C (2019) by outworlder on Thursday August 20, 2020 @05:04PM (#24228951)
You _can_ write a game without any scripting language support whatsoever. You could also write the whole game in assembly if you so desired.

However, if every single time you want to change any piece of logic in your game, you have to do the edit/compile cycle, your development will be extremely slow. Especially if you compare with the ability to change code while the game is running.

Not having all the game logic in C or what have you makes the game easier to mod too.

Re:Parsing S-expressions in C (2019) by sarchertech on Thursday August 20, 2020 @05:37PM (#24229318)
>However, if every single time you want to change any piece of logic in your game, you have to do the edit/compile cycle, your development will be extremely slow. Especially if you compare with the ability to change code while the game is running.

1. I'm working on a game in Unity right now that takes about 10 seconds to compile and reload the assemblies for the scripting language (only about 2 seconds of that is actual compilation, the rest is time that would be applicable to an interpreted scripting language).

2. I've built games in C where the entire project took 4 seconds to compile. Incremental compilation and modular architecture can get that down to near instantaneous for most changes.

>Especially if you compare with the ability to change code while the game is running.

Take a look at handmade hero for an example of an architecture that allows you to hot-reload C code while the game is running.

>Not having all the game logic in C or what have you makes the game easier to mod too.

That's completely architecturally dependent. You can make a game easy to mod for non programmers by storing data in a human readable/editable format. If you want to make it easy for players to write code there's a lot more work that needs to be done than just using a scripting language. For most games worrying about allowing modders to easily edit code is premature optimization.

Re:Parsing S-expressions in C (2019) by svvcfb1212 on Thursday August 20, 2020 @06:15PM (#24229657)
> For most games worrying about allowing modders to easily edit code is premature optimization.

I was involved in a game project that died extremely quickly a few years ago. The project lead made every decision re: architecture, tooling, etc. somehow involve worrying about modding. As a result, we ended up with nothing to show since everything got derailed by a bizarre obsession by one person with modding before we even had anything to mod. I believe that person doesn't take lead roles on projects any longer...

Re:Parsing S-expressions in C (2019) by pengaru on Thursday August 20, 2020 @05:26PM (#24229203)
Fast iteration can be achieved with compiled game logic as well, it all comes down to how things are factored in your project.

An excellent example most with OpenGL experience may be familiar with is supporting hot reloading of GLSL for fast vfx development iteration. It's a compiled language, it gets compiled at runtime without significant delay, and most of us making games have created simple tools to support live editing of GLSL, maybe even supporting it in-game for dev builds.

The demoscene has even turned it into a form of competitive performance art:

https://github.com/Gargaj/Bonzomatic

Edit:

Forgot to mention Casey also goes through support of hot-reloading game logic using C in the Handmade Hero series on YouTube.

Re:Parsing S-expressions in C (2019) by heavenlyblue on Friday August 21, 2020 @02:12PM (#24237392)
You could just expose the logic as DLLs though
Re:Parsing S-expressions in C (2019) by pengaru on Thursday August 20, 2020 @04:52PM (#24228804)
> I can guarantee you that a game will need a scripting language. Better get that done already.

Is that really so certain?

http://www.youtube.com/watch?v=y2Wmz15aXk0

Re:Parsing S-expressions in C (2019) by pansa2 on Thursday August 20, 2020 @07:04PM (#24230040)
> I can guarantee you that a game will need a scripting language.

Embedding a scripting language (e.g. Lua) seemed to be very common around 2010, but I get the feeling that it's much less common today.

Has the use of embedded scripting languages in games declined over the last 10 years? Any particular reasons?

Re:Parsing S-expressions in C (2019) by dfox on Thursday August 20, 2020 @05:29PM (#24229234)
The issue with scripting engine for game is that for game your almost certainly need scripting engine with completely different semantics than whatever existing implementation will provide. Ie. you either need to save the state or replicate it over network, both with reasonable performance. And looking at various AAA games (from modding standpoint) there is embedded Lua or Python that mostly only changes state of some lower level VM, which more often that not is itself turing-complete.