Custom Engine + SkookumScript?


#1

So I just recently learned about SkookumScript, and it seems really cool. I was wondering, what are the steps involved in embedding Sk into another codebase? I’ve been building my own game/engine and I would like to use Sk as the scripting language within it, but I’m not sure which classes need to be instantiated, initialized, or derived to get the Sk system running.

I’d prefer to develop/compile scripts with the IDE, then call/run them within the engine. But I’m fine with just reading and compiling during runtime if that’s easier to get started.

Really I’d just like a rundown of what code needs to be in place to get things off the ground.


#2

Hey @SethSR - welcome to the SkookumScript community!

There are a few past posts in the forum that also talk about hooking up SkookumScript to other engines:

Looking at how SkookumScript is connected to UE4 is a good start and it helps to see a working system. That being said, the SkookumScript UE4 plugin is more complex than you will need since it also has to interact with the UE4 visual scripting system Blueprints and UE4 itself is massive.

The main steps will be:

  • subclass SkRuntimeBase and supply your own custom overrides.
  • subclass SkRemoteRuntimeBase to have a live connection with the SkookumIDE and use its REPL, live editing and debugging
  • there are a number of initialization methods to start SkookumScript up - look in the SkookumScript UE4 plugin and see SkookumScriptRuntime.cpp, SkUERuntime.cpp and related files for examples.
  • call SkRuntimeBase::update() in an appropriate place in your game loop
  • there are a number of deinitialization methods to clean up SkookumScript after a level/mission if needed or once a project shuts down - also look in the SkookumScript UE4 plugin and see SkookumScriptRuntime.cpp, SkUERuntime.cpp and related files for examples.

The subclassed files are used to specify how to load files and communicate using TCP/IP. SkookumScript intentionally tries to focus just on gameplay - it doesn’t know about files, networks or even many aspects of memory. Most engines have very custom mechanisms to handle all of that so SkookumScript is designed to just hook into those existing mechanisms rather than supply its own competing ways of doing things.

This will get SkookumScript up and running - you should be able load up the core scripts, run the SkookumIDE and call native SkookumScript commands.

Next you will need to bind commands from your engine into SkookumScript. You can see some good examples in the Sk UE4 plugin such as SkVector3.cpp. You don’t need tons of commands connected before you can do some pretty interesting things.

Some recommendations to start:

  • simple math objects for positions, rotations, etc.
  • creating objects such as NPCs
  • pathing/navigation commands

This entire process isn’t especially well documented so feel free to ask more questions here and please post any discoveries or clarifications you file.

Good luck and let us know how it goes!


Integration example
#3

I’m getting a linker error for a missing external symbol.

SkookumScript-Debug.lib(SkRemoteRuntimeBase.obj) : error LNK2019: unresolved external symbol __imp_AllowSetForegroundWindow referenced in function "public: void __cdecl SkRemoteRuntimeBase::cmd_show(enum eAFlag,class ASymbol,class ASymbol,bool,bool)" (?cmd_show@SkRemoteRuntimeBase@@QEAAXW4eAFlag@@VASymbol@@1_N2@Z)

I’m not really sure what to do here, since it seems like something within the library. Is there something I’m missing?


#4

Yes. It seems that the AllowSetForegroundWindow() command from User32.lib is used in the SkookumScript library for MS Windows builds.

I will update the SkookumScript.txt file below reflect this.

So you will need to include User32.lib and you may need the following defines:

_WIN32_WINNT=0x0500 // Or higher

// Maybe these or similar
_WIN32, _LIB, WIN32_LEAN_AND_MEAN, _WIN32_WINDOWS=0x410 or WINVER=0x0500,
    _WIN32_WINDOWS=0x0500

Hopefully that helps. :madsci:


#5

I would like to see skookumscript working with godot at some point, especially now that they have released their 3.0 update: https://godotengine.org/