What's your workflow of using C++ to program game entities?

Ok so during my practice with lumberyard I made a pipeline to code game objects during test time.

1-Prototype behavior in script canvas or
2-Prototype behavior in Lua
3-Translate Lua or SC code into C++ for Max performance.

But I got a question I never used this pipeline yet. I am prototyping now using script canvas and Lua I just want to understand.

How to program game entities using C++ instead of Lua or SC? I have read through documents and found that I should build gems so should I build a gem for each entity or one gem that contains all behavior and link them according to the entity frankly I need help in this subject.

Thank you.

actually you do not needed gems at all for your custom code
all your code can exist in project of solution
you need your own gems only if you wants share your custom components between few pet projects.

take a look on this tutorials https://github.com/Aristo7/LYBook_1.20/commits/ch04_creating_components
select another git branches to see next steps

2 Likes

Ok @fluffy so how to add custom code to entities in lumberyard using C++? Could you explain more,

1-Should I create a visual studio solution
2-What workflow should I follow

There is a need for this workflow to be explained more clearly in the documentation.

  1. Every time when you create your own new project in ProjectConfigurator it’s generates for you - solution (engine + gems + your_project)
    so just open dev\Solutions- and find your project
    there only can be few situations when you may do not see your project in this folder.
  • fail to generate project for some reason
  • you doing project migration from old ver of engine to newer
    in this case you can generate solution for already existed project like so:
    use cmd:
cd Bin64vc141
lmbr projects create_vs_solution TypeYourGameProjectNameHere 1

if occurs errors see logs : dev\BinTemp\lmbr_create.log

  1. open your solution
    the first of all you should select profile (build) it mostly like releace but with some debug info.

then find Launchers in solution tree
set %NameОfProject%ClientLauncher as an StartUp Project

then find %NameОfProject% folder in solution three and add new cpp/h files into source
write code…xD

each component it’s pair of cpp+h files, so then you wrote some basic code and want to test it, you should add this two new files names into “projectname.waf_files” it’s just list of files what need to compile

sometime to using additional gems or 3rd-party libs you need configure wscript file.

so mainly all project work it’s just adding new sources(componenents), adding theys into compilation list (projectname.waf_files), and if needed tweak wscript file, that’s mostly all that you need then you working with code in Ly.

2 Likes

Fantastic @fluffy this should be in the documentation. I am very happy you are in the community.

Good Job :+1:

oh I forgot to mention one onother major thing
before doing all this manitulation what I’m discribeted in upper post
you should to sure that you enable all this options in SetupAssistant.exe (dev\Tools\LmbrSetup\Win\SetupAssistant.exe)

2 Likes