Getting started game development on Unity with SymOntoClay
Contens
- Install SymOntoClay CLI
- Create new project on Unity
- Install SymOntoClay components for Unity
- Write SymOntoClay DSL code
- Set up scene for using SymOntoClay components for Unity
- Run scene
- Build game
- Write more code
Here is a tutorial how to use SymOntoClay in Unity scene.
You can see, learn and run this example in repository https://github.com/Symontoclay/demo1_linear_code.
Install SymOntoClay CLI
See here or here about installation SymOntoClay CLI.
Create new project on Unity
Create new project on Unity (if It's need) or use exisiting project.
The unity project should contain a humanoid NPC model.
Install SymOntoClay components for Unity
See here about installation components for Unity.
Write SymOntoClay DSL code
Get started with writing simple code for walking NPC by a path.
- Open a command prompt and navigate to Asset directory of your game.
-
Create new SymOntoClay worldspace SymOntoClayDSLCode.
soc new -world SymOntoClayDSLCode
- Navigate to directory SymOntoClayDSLCode.
-
Create new NPC called MyNPC.
The NPC be created at path /Asset/SymOntoClayDSLCode/Npcs/MyNPC.soc new -npc MyNPC
- Navigate to the created NPC and open file MyNPC.soc for editing.
-
Write code:
app MyNPC{on Init =>{"Begin" >> @>log;"The Beatles!" >> @>log;@@host.`go`(to: #@[20, -45]);"End of step 1" >> @>log;@@host.`go`(to: #@[10, 90]);"End of step 2" >> @>log;@@host.`go`(to: #@[10, -20]);"End of step 3" >> @>log;@@host.`go`(to: #@[10, -10]);"End of step 4" >> @>log;@@host.`go`(to: #@[5, -20]);"End of step 5" >> @>log;@@host.`go`(to: #@[14, 2]);"End of step 6" >> @>log;@@host.`go`(to: #@[20, -90]);"End of step 7" >> @>log;@@host.`go`(to: #@[20]);"End of step 8" >> @>log;"End" >> @>log;}}
- Save changes and close file MyNPC.soc.
Set up scene for using SymOntoClay components for Unity
Set up world
- Add component World to Terrain.
- Choose SymOntoClayDSLCode in property World File.
Set up Humanoid NPC
- Add component Humanoid NPC to target NPC.
- Choose MyNPC in property App File.
Add host endpoints to Humanoid NPC
Elementary (basic) actions are Unity ar even game specific because It could require interaction with animation, visual effects or something else.
You should implement host endpoints.
You can use ExampleSymOntoClayHumanoidNPC.cs as example. Copy and add this file to target NPC.
Run scene
Use Play in Unity Toolbar.
After starting Play mode you can see that NPC walks by defined in SymOntoClay DSL path.
Build game
Use standard Unity tools for building game.
SymOntoClay builds itself into Unity build pipeline.
Write more code
Learn more about SymOntoClay DSL.
See examples of using SymOntoClay's components for Unity.
Try SymOntoClay DSL examples.