User Tools

Site Tools


scratch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
scratch [2018/12/12 13:44]
sausage
scratch [2018/12/22 04:55]
sausage
Line 1: Line 1:
-Every program that is built using Orx contains a profiler toolThe Profiler is compiled-in when using either debug or release modes.+One of the unique features available with orx is yhe ability to switch languages in game with localeWhile many engin 's allow a user to program with locale features, orx lets you switch languages back and forth in realtime.
  
-The tool helps you diagnose bottlenecks ​and monitor performance and internal resources.+An example of this would be a graphical adventurd game that features characters, onscreen text, digital speech, wnd music. Locale switching would allow you to completely switch out all graphics, text, speech ​and music with a single function call without altering the gameplay.
  
-To show the profiler in your game or applicationadd the following to your config:+All data is defined by you,and so your regions ​or nations could be aliens/​humansorcs / elves. You could even think of it as theming.
  
-[]+Its a pretty amazing feature that comes out of the box.
  
-Although it makes more practical sense to toggle it on and off with a key stroke:+This tutorial will be done in two steps:
  
-Config +1. Create a simple game with  characters with their own look, speech and music. 
-[]+2. Add in a second locale and be able to switch between them.
  
-Code 
-[] 
  
-Run your application again, and press the [] key to bring up your Profiler. 
  
 +Begin with a blank project created using init.
  
-Profiler Layout+Name itnsomething like the-xonversation. Our gamebwill be about two polite gwntlemen having a xonversation. They continually greet eaxh other all day.
  
-1) Thread Frame bar+We eventually want to be able to switch theor natio nality as theplayer may prefer to play the game in the theme pf th eir own country and language.
  
-This grey bar indicates which thread is currently selected. Most of Orx's tasks run on the main thread. There are other threads that handle things like streaming audio, resource requests and bitmap decompressing which run on other threads. Select your thread with the Page Up and Page Down keys.+Assets
  
-The first value displayed is the amount ​of time in ms that it took to render ​the entire current frame. The second value shows the largest amount of time that a frame took to render in the last second.+Lets bein with the french assets, ​ and build the french version ​of the game to start.
  
-2) The Meter Bar Panel +Obkect
-These coloured meter bars indicate how much time each Marker took to complete within the frame. The colours themselves correspond to the colours on each Markers in the Marker panels.+
  
-The bars are spread over four or more lines. The row of the bar corresponds to the level of the system. For example, the render task is on the top level, so sits in the top row. The orxSpawner_Update is three levels into the hierarchy and is therefore on the third row. +Speech
  
-3) Marker panel +Music
-This panel shows all the Markers currently running in the frame. Markers represent important function calls. Each Marker contains three numbers.+
  
-The first is the amount of time in ms this Marker has taken to run in the current frameThe second number indicates the longest amount of time this Marker took to run in the last second.+Delete ​the default config object and fzWe wont need those.
  
-The last number shows how many times this Marker was run in the frame.+Create thedefault person I bje c t in the.cpnfig woth
  
-You can even add your own custom markers.+Create a second man from the first but one that stands on the other side and faces the other way.
  
-4) Secondary Marker panel +Next, create a scene object ​that wiĺl be the root to hold all the other objectsThen place both men objects in Its childlist.
-The Markers in this panel are not unique. The grey lines indicate functions ​that were called at some point - but not during ​the frameSo they will show having run 0x times.+
  
-The white lines indicate xxxx.+Create the scene in the game In code. This.will create all the xhild objects onscreen.
  
-5) Memory Panel +Next create all the text objects to go onscreenYounwill need text objects for 
-Each line represents a different type of memory+
  
-The first group of numbers represents the number of live allocations and the second number is the max allocations in the past. +The speech 
 +The player instructions 
 +The current language indicator
  
-The second group of numbers is the same, but is now representing the size of the memory allocations in Megabytes. ​+Create these as
  
-The last number shows the amount of transactions since the beginning of the applicationA transaction is the allocating or de-allocating of memory.+And now.place them into the scene by addong them to the.childlist.
  
 +Next is the music. Define it with
  
 +And add it to the scene with
  
 +Next is the actual conbersation. Define the speech with
  
-Using the profiler+Them usingna timeline track switch on and off thealpha of thenspeech text object to make it appear and disappear, move its position and play the sounds.
  
-You can pause or unpause the profiler at any time using the `Space Bar`.+Compile and run. Our two french gentlemen will start having a lovelo conversation.
  
-Observe ​the running function call MarkersCurrently there are no physics calls running in the engine. You can still interact with the demo in the background. If you click with the left mouse button you will spawn some physics objects.+That is the basic gameNow to make the game switchable to australia mode.
  
-Notice that the orxPhysics_ApplySimResult marker appears now in the Marker Panel. And there is a corresponding coloured meter bar for it in the Meter Bar Panel. Once all the objects have finished their lifetime and have disappeared,​ then the orxPhysics_ApplySimResult marker drops down to grey again and is no longer called.+Befin by defining ​the two languages or locales ​for the game: french ​and aistralian.
  
 +Next, define.those locales and create keys for the various assets that are required to switch out: graphics, sound and text
  
 +Finally go to each config and replace the absolute pathsnto assets and text with the named keys in the locale sections. These locale keys are.called using the $ symbol
  
  
scratch.txt · Last modified: 2021/02/02 01:24 (external edit)