My experience using SK REPL in a C++ team project (for debugging and testing mechanics)

So, i can’t talk much about the project i’m working on. I only want to say how awesome Skookum Script is for a C++ team project even when we don’t use :sk: for the programming part. We use C++ almost exclusively, exposing just a few stuff to Blueprints (can’t change that much because i’m kinda new on the team). However, we have many attributes and methods using UFUNCTION, UPROPERTY macros. And :sk: can work with those!

Initially, it took me a few hours to setup everything because :sk: was giving me some errors with the project, and i managed to solve the issues by using+SkipClasses on the troubling classes. I also setup :sk: in my local repo (locally ignoring the files needed for making :sk: work so i don’t mess with the master repo) and now everything is golden!

I seriously feel like i have superpowers now lol, i should have done this weeks ago.For example, before, when i wanted to debug some C++ obscure attribute, i had to either expose the attribute to BP, or log it on a Tick or something similar. Unreal c++ doesn’t really help on that part since compilation can take some time, and most of the time i also need to restart the editor to be able to view the changes.
Now, as long as the attribute is using a UPROPERTY macro, i can just use the :sk: workbench and log it on demand, no need to make changes on the C++ code just to debug the values! Similarly with the UFUNCTION methods, i can trigger them on demand and test them on different situations!

Well, that’s all i wanted to say. I’ve been using :sk: with this project for 2 days now and it’s working great! I still have to deal with Unreal++ for writing the actual code for the project but still, my productivity has definitely increased (and my frustration dealing with the awful iteration times has been reduced).

Now, let’s see if i can convert some coworkers to the :sk: side :smiling_imp:. At least for the debugging aspects, since i don’t think we can use :sk: for the actual code (but oh boy, i wish).

2 Likes

This is exactly how I originally got hooked :fishing_pole_and_fish:.

It is pretty crazy what you can do with :sk: just from the REPL. You could realistically mod an entire game. I have a few early projects where I would check in a text file to the repo whose purpose was to execute huge swaths of debug :sk: from Notepad++.

Basically something like

loop
[
  !p : BP_RobPawn.instances_first
  if p.@show_debug?
  [
    !loc : p.actor_location
    SystemLib.print_screen("Pawn State: ", p.@rob_state)
    SystemLib.draw_debug_line(, loc, loc + [p.@aim_dir * 100.0])
   ... tons more
  ]
 
  _wait
]

I also like to queue up one-liners to help live-tune things while the game is running, just chimp numbers and hit F4:
BP_RobPawn.instances_first.@camera_boom.@socket_offset := Vector3!xyz(0 -90 -20)
BP_RobPawn.instances_first.@camera_boom.@camera_lag_speed := 4.3

Or clear out actors in a level to restart a test:
BP_BadGuys.instances%destroy_sk_actor

Once you have this power, not having the ability to run simple code in an editor session, in a running game or in a packaged game starts to feel pretty stupid eventually :slight_smile: Glad you’re getting use out of :sk: as a super-console.

1 Like