Advertisement
Guest User

Lua Game Concept

a guest
Jan 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. Engine
  2. EngineContext :luaFile
  3. targetfps : field
  4. resolution : field
  5.  
  6. Objects : C++ Class
  7. LuaScriptObject : C++ Class(loading the lua script)
  8. contains all fields in lua : can be seen as the constructor
  9. name, pos, materialfile(other lua script), objectPath(.obj)
  10. included behaviour scripts
  11. Update() : ordinary update loop(gets called by C++)
  12. OnDestroy() : Gets Called by c++
  13. contains included scrips
  14. LuaBehaviours
  15.  
  16. LuaScripts
  17. Contain OnCreate()
  18. Contain Update()
  19. Contain OnDestroy()
  20. Contain InteractionTypes
  21. Contain Interact(source, type)
  22. source: who interacted
  23. type: what does it want?(pickup/change stats)
  24.  
  25. LuaGameBoard
  26. Amount of tiles x,y
  27. bool SetWalkable(x,y)
  28. to manipulate the map(only possible in luagameboard)
  29. WalkableMat
  30. UnwalkableMat
  31.  
  32. LuaParser
  33. Create GameObject with LuaScriptObject parameters. Creates a new instance of each luabehaviour
  34.  
  35. LoadDialouges(Folder)
  36. load all dialouges into c++ structs from the folder and puts them into a hashmap/list for fast referencing
  37.  
  38. LoadMaterials(Folder)
  39. Loads the material properties to c++ code. and stores the structs to a list/map
  40.  
  41.  
  42. CreateMaterial(name/id)
  43. creates a material in heap
  44. passing all the params from the material table to the shader
  45.  
  46. LoadGameBoard(file)
  47. loads the "map" && loads materials for walkable and unwalkable
  48. has to be loaded after all the materials get parsed.
  49.  
  50. LoadSounds(folder)
  51. Loads every sound onto an array.
  52. Using reference id's to find stuff
  53.  
  54. LuaMaterial
  55. name
  56. FragShaderPath
  57. VertShaderPath
  58. GetParams() returns table of string, value, type
  59. when a material is created the lua parser will create a new material with the parameters specified.
  60. it should use the string as shader attrib/field location, the value as value and the type as custom string
  61. the custom string gets split up to decide the expected type of the shader(["","i","d"]vec{2,3}/bool/float/double)
  62.  
  63. fields named the same as in glsl shader
  64. when filling the shader loop through the table of fields
  65.  
  66.  
  67. LuaDialouge
  68. Text msg
  69. Dialog Text
  70. Options[] options
  71. Available Options
  72. SelectOption(int)
  73. C++ Calls this method when the player made a diag decision
  74. Options
  75. text button text
  76. dialougebox text when clicked.
  77. OnDialougeFinish(optionid)
  78. Gets Called by LuaDialouge Script
  79. followingdialouge dialouge that is following after this one
  80. can be null/nil
  81.  
  82. API
  83. Interact(objectName, source)
  84. Calls the LuaObjects Interact(source, interactionType) function
  85. Each lua script does its thing
  86.  
  87. GetPosition(objectname)
  88. GetRotation(objectname)
  89. SetPosition(objectname, x,y,z)
  90. SetRotation(objectname, angles, x,y,z)
  91.  
  92. SetParent(parentname, childname)
  93.  
  94.  
  95. Destroy(objectName)
  96. CreateInstance(luascriptobj)
  97.  
  98.  
  99. RemoveBehaviour(objectbehaviour)
  100. AddBehaviour(objectname, luabehaviour)
  101. creates new lua script and attaches it to the given object
  102. AddBehaviour(objectname, sourceObjectname, sourceLuaScript)
  103. creates a new behaviour from an existing one. (keep the variables?)
  104. Restart()
  105. Stops Game and Reloads the complete engine(aka new game)
  106. Imma do hacking to just restart the whole process.
  107. Stop()
  108. Stops Game(AKA. Close Game)
  109. GetGridCellWalkable(x,y)
  110. returns bool
  111. SetGridCellWalkable(x,y,bool)
  112. sets the cell walkable state & updating the material for this tile
  113. PlaySound(string)
  114. simple sound playng by path?
  115. PlaySound(referenceID)
  116. simple sound playing by reference id(should be a lot faster)
  117. GetSoundRefId(string)
  118. returns the reference id of the loaded song of not loaded it will be loaded by trying to find the supplied string in the sound folder
  119. ShowDialouge(diagName)
  120. Shows the diaglouge by name
  121. IsDialouge()
  122. is any dialouge shown in this moment?
  123. IsDialouge(diagname)
  124. is the diagname currently shown?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement