I have started translating existing BP to SK. As a newbie, it’s not as easy as there aren’t many examples and documents are scant. I’m especially having problems instancing objects. It doesn’t seem to work as I would like. For an example, creating new Widget ( First thing I tried is to try Widget!new ) but it crashes the UE editor. I’m not sure how to create instances of various objects other than using the simple ! contructor but they require different arguments. Anyway, my request is that if there are some automatic translator from BP to SK, it will really be helpful to quickly transfer the functions and also for a tool to learn how things are done in SK. There is one-to-one correnspondence between BP and SK, and I guess it’s doable as there are BP to C++ translator already.
Hey @chrisk414, glad you are digging in even more.
Converting from BPs to is not ideally a 1:1 operation - they both have different ways of doing things. For example Sk deals with time completely differently than BPs by using coroutines.
The BP to C++ nativizing is not a trivial amount of work and the C++ code that it generates is not meant to be human readable. If you are converting from BP to Sk, then it would be to use Sk for development and not as a final crazy optimization step before making a final shipping build. You will want to be able to grow and maintain your Sk code as you develop your project. We might look into something to help automate the process though we currently have many other features that will give a bigger bang for your development experience so auto-BP translation is less of a priority.
Porting or translating a project is never fun. Obviously the easiest thing would be to have started primarily with Sk in the first place. That being said, we know that people have existing BP (and C++) projects and they want to start doing game logic with Sk so we want to make the process as easy as practically possible.
Since you are just learning how Sk is different and its advantages, this makes porting a project over in the best SkookumScript way an extra challenge.
One good example of a BP project fully converted to SkookumScript is the default UE4 Blueprints project - aka the Butterfly project - which we call the Blueprints_SK project.
Look at both the classes Butterfly and Butterfly_Sk. One is coded in Blueprints and one in , both are equivalent in behavior. You’ll see how the version makes use of a coroutine (_fly) to describe the flow of the behavior of very naturally. This would be almost impossible to convert automatically.
Keep posting questions and ideas on the forum and we’ll answer as best as we can and continue to add more docs and features to make development easier.
(We’ll answer your question about instancing Widgets in an upcoming post too.)
Another good project to take a look at would be the intermediate tutorial that uses UE4’s TwinStick shooter sample minigame. One actor’s control and interactions were left in BP and the other was created using to mirror the exact same scripts.