beefviper

Game Engine/Framework

May 14th, 2020
2,012
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!--
  2.  
  3. Working on an idea I had to describe a game in a format that could be parsed and rendered
  4. by a game engine/framework. I played with a few syntaxes and found an HTML/XML style looked good.
  5.  
  6. It's still missing parts, like a way to describe the rules of the game.
  7. It's not consistent. Still not sure how to handle elements with multiple parameters.
  8.  
  9. But I like the overall look and feel so far.
  10. If you have any ideas or suggestions, let me know.
  11.  
  12. - beefviper
  13.  
  14. -->
  15.  
  16. <game>
  17. <head>
  18. <title>Pong</title>
  19. <screen width="1280" height="720" fullscreen="true" />
  20. </head>
  21. <body>
  22.     <objects>
  23.         <object name="logo">
  24.             <sprite src="images/title.png" />
  25.             <position x="screen.width.center" y="screen.height.center" />
  26.             <velocity x=rand(10) y=rand(10) />
  27.             <actions>
  28.                 <action start="state.playing" />
  29.             </actions>
  30.         </object>
  31.    
  32.         <object name="ball" />
  33.             <sprite src="shape.circle(radius)" />
  34.             <position x="screen.width.center" y="screen.height.center" />
  35.             <velocity x=rand(10) y=rand(10) />         
  36.         </object>
  37.        
  38.         <object name="paddle1">
  39.             <sprite src="shape.rectangle(width,height)" />
  40.             <position x="screen.left + margin" y="screen.height.middle" />
  41.             <velocity x="0" y="0" />
  42.             <collision enabled="true" />
  43.             <movement horizontal="false" vertical="true" />
  44.         </object>
  45.        
  46.         <object name="paddle2">
  47.             <sprite src="shape.rectangle(width,height)" />
  48.             <position x="screen.right - margin" y="screen.height.middle" />
  49.             <collision enabled=true />
  50.             <velocity x="0" y="0" />
  51.             <movement up="true" down="true" left="false" right="false" />
  52.             <actions>
  53.                 <action up="movement.up" />
  54.                 <action down="movement.down" />
  55.             </actions>             
  56.         </object>
  57.     </objects> 
  58.    
  59.     <states>
  60.         <state name="mainmenu">
  61.             <show object="logo" />
  62.             <inputs>
  63.                 <input logo.action.start="enter" />
  64.             </inputs>
  65.         </state>
  66.         <state name="settings">
  67.        
  68.         </state>
  69.         <state name="playing">
  70.             <show object="ball" />
  71.             <show object="paddle1" />
  72.             <show object="paddle2" />
  73.             <inputs>
  74.                 <input paddle1.action.up="q" />
  75.                 <input paddle1.action.down="z" />
  76.                 <input paddle1.action.up="up" />
  77.                 <input paddle1.action.down="down" />
  78.             </inputs>
  79.         </state>
  80.         <state name="paused">
  81.         </state>
  82.     </states>
  83. </body>
  84. </game>
RAW Paste Data