RTS Style Visual Scripting

Hello all,
I’m new to the forums here so I’m getting my bearings, I apologize if this has been previously posted. I did find some discussions about this using Lua scripting, but I’m looking for something using the VSS. Though I really should look into learning Lua. Anyway on to the subject of my post.

What I would really like to do is create an RTS style concept using the VSS. I have no real interest in 1st or 3rd person games with control bound to the keyboard, at this time anyway. I am looking to:
A. Display the mouse cursor in game, and move that cursor around.
So far I’ve been able to display a mouse cursor using the UI canvas, but haven’t added any functionality to move it around. Whether this is possible or not, I’m not sure.
B. Ability to use this mouse cursor to select a point in the world space or terrain to move a selected character to that point.

Whether this is even possible using the VSS at this point is unknown to me. I did find a topic discussing this using a gem created by Scott. This was more for just the cursor and enabling the camera to move when moved to the edge of the screen. It also had a zoom in/out functionality. The only problem was, this post was from 2016 using 1.10.0.0 and it failed to build.

Perhaps my best option is to learn Lua since the VSS functionality seems limited, I do already know Java pretty well, some C#, some HTML5/CSS3 and some bits and pieces from C. How does Lua compare to these languages? I dont know C++ well or really at all, certainly another good one to learn. But the process of bringing a C++ script into the editor seems a bit daunting. Game engines like Unity make this much simpler, create the script in the editor, open it open in VS, code, save and its in there.

Thanks for your help!

Hi @Frammer, I’ve been working on something similar. I did start with messing around with the Mouse Cursor Position gem you mentioned. To get the gem to build you just need to remove line 19 from MouseCursorPositionComponent.cpp and it should build. Thats the line with SerializerForEmptyClass(), which is deprecated. It was working with version 1.20 so it should be fine.

Unfortunately you may find you will need to write some custom Script Canvas nodes in C++. But it is certainly possibly to create it in Script Canvas if you are willing to do that, and writing and editing a few Script Canvas nodes is a great way to learn the engine’s framework. Also there is all the code in the Script Canvas Gems for reference, and the Lumberyard documentation. Also, people will generally assist you on the discord if you get stuck.

Keep us posted on your progress!

I’ve been looking through the directories to view some code examples on the different nodes. So far in the dev/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries, I’ve found some of the Logic, Math, Operators etc. But this is all I can seem to find, and not being that familiar with C++, I’m having trouble finding the actual files that generate the logic for those nodes. I’m really looking for the Input nodes, because I think that will be the best place to start looking, but I cant seem to find them. I searched Discord on here and joined the first one, though one of the comments suggested this was not a good Discord to join because of some elitist attitudes and discouraging constructive criticism. I of course will discover this for myself and make my decision.

I also deleted that line of code and I still got a build failure: 1.23.1.0\dev\gems\mousecursorposition\code\source\StdAfx.h(4): fatal error C1083: Cannot open include file: ‘platform.h’: No such file or directory

Ok,sorry for the misdirect. The following will work in 1.23.1. You will need to delete or comment out the line previously mentioned, and also in your “\dev\Gems\MouseCursorPosition\Code” folder, open the wscript file and add an additional include so it looks like below:

        # Add custom build options here
        includes    = [bld.Path('Code/CryEngine/CryCommon'),
        bld.Path('Code/CryEngine/CryAction')]

Then Configure and Build, drop the Camera slice into your level and it works with a lua script.

You can find Script Canvas InputNode code in StartingPointInput Gem, if that is more helpful.
There is the documentation, and also this book by one of the LY programmers:

This book is a great reference and has information on how to write custom script behaviors. The first few chapters are available for free via preview on the Amazon site.
The discord is invaluable (as is the forum) for more timely assistance, but also allowing you to search the channels for information previously discussed.