game_structure 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. intro
  2. a game structure file describes how the data of a video game is structured.
  3. this should only be useful for someone wishing to write a compiler
  4. that compiles an abstract video game into an actual game in another language.
  5. example
  6. here is an example file to understand what a game structure looks like
  7. .game
  8. @scene ~ # scenes in game
  9. .scene
  10. ^ # name
  11. @object ~ # scene objects
  12. .object
  13. $ ~ # object shape
  14. $ ~ # object color
  15. $ 16 # object matrix
  16. this basically describes a game with an unspecified amount of scenes,
  17. considering that every game has different scenes.
  18. each scene has an unspecified number of objects, and each object has a shape (described in vertices)
  19. a color (for each vertex) and a 4x4 matrix.
  20. symbols
  21. the first symbol declares a structure, used for grouping data
  22. . create a new structure of data
  23. these symbols describe data types that belong to a structure
  24. $ number
  25. ^ string
  26. @ structure
  27. after that, an optional symbol can appear, showing quantity of the data
  28. [1-9] amount of data
  29. ~ arbitrary amount of data, until '~' is encountered
  30. comments
  31. # comment until end of line
  32. syntax
  33. the first symbol of any file must be a dot (.) to create a new structure.
  34. then, either dots (.) or other data-types can be followed.
  35. after a data-type an optional quantity can follow, the default is "1".
  36. the structure "game" is the top-level one, and should always be active.
  37. note that everything after the # is a comment, it is only there to make it human-readable
  38. data-types can describe anything the developer wants, for example to include the game's title:
  39. .game
  40. ^ # game's title
  41. it is possible to describe multiple data-types:
  42. .vector
  43. $ 3 # vector has 3 numbers for x y and z
  44. this says there are 3 numbers inside a vector. if the number of data-types is different
  45. for each game, use the tilde array (~):
  46. .object
  47. $ ~ # object's shape - every object has different amount of vertices
  48. it is possible to create new data structures and add them in another:
  49. .game
  50. @vector # a vector that is stored inside the game
  51. .vector # describe the vector structure
  52. $ 3 # it has 3 numbers for x y z