Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gdevelop5:all-features:filesystem [2019/05/21 20:57] piyushpalawat99 |
gdevelop5:all-features:filesystem [2020/12/26 13:56] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | # File system | + | # File system |
This extension gives you access to the file system of the pc the game is running on. | This extension gives you access to the file system of the pc the game is running on. | ||
< | < | ||
Line 6: | Line 6: | ||
GDevelop offers two different ways to save data permanently. The storage extension and the file system extension. | GDevelop offers two different ways to save data permanently. The storage extension and the file system extension. | ||
- | Since GDevelop is built upon web technology, at the time of writing, every game is basically a website that either runs directly in a browser (Web export) or inside a stripped down browser container " | + | Since GDevelop is built upon web technology, at the time of writing, every game is basically a website that either runs directly in a browser (Web export) or inside a stripped-down browser container " |
- | All these platforms offer web storage, integrated into the browser component of their runtimes where data can be saved in a dictionary like key/value style. | + | All these platforms offer web storage, integrated into the browser component of their runtimes where data can be saved in a dictionary-like key/value style. |
- | For security reasons web browsers don't let websites write any data to the file system of the pc, they are executed on. Only Electron-based export offers | + | For security reasons, web browsers don't let websites write any data to the file system of the computer |
- | ### Storage: | + | ### Storage |
- It is available on all platforms, a game can be exported to. | - It is available on all platforms, a game can be exported to. | ||
Line 22: | Line 22: | ||
- The player has no direct access to web storage. | - The player has no direct access to web storage. | ||
- | ### File system: | + | ### File system |
- | - It is only available on Windows, Linux and MacOS. | + | - It is only available on Windows, Linux and macOS. |
- You can save any kind of data. | - You can save any kind of data. | ||
Line 36: | Line 36: | ||
## Asynchronous execution | ## Asynchronous execution | ||
- | By default, actions get executed synchronously in GDevelop. This means that the game loop waits for each action to finish its execution before it will run the following event. | + | By default, actions get executed synchronously in GDevelop. This means that the game loop waits for each action to finish its execution before it runs the following event. |
- | Actions that take longer than a few milliseconds to execute, will freeze the whole execution of the game until they finish. | + | Actions that take longer than a few milliseconds to execute will freeze the whole execution of the game until they finish. |
- | To avoid these freezes, GDevelop supports asynchronous execution of certain | + | To avoid these freezes, GDevelop supports asynchronous execution of specific |
- | In order to get notified about the status of the background task, the asynchronous actions have an optional result variable. This variable will be updated with the result of the operation, at the moment the background task has finished. | + | To get notified about the status of the background task, the asynchronous actions have an optional result variable. This variable will be updated with the result of the operation, at the moment the background task has finished. |
- | By checking its value, you get to know when exactly | + | By checking its value, you get to know when precisely |
- **" | - **" | ||
Line 51: | Line 51: | ||
Saving the name of the next level after completing the previous one in a linear puzzle game, need not be done asynchronously. | Saving the name of the next level after completing the previous one in a linear puzzle game, need not be done asynchronously. | ||
- | On the other hand, when trying to add an autosave function to an open world game with procedurally generated unlimited terrain, the game developer will probably not get around saving the game asynchronously due to the heap of data to be written into the file. | + | On the other hand, when trying to add an autosave function to an open-world game with procedurally generated unlimited terrain, the game developer will probably not get around saving the game asynchronously due to the heap of data to be written into the file. |
It is up to the game developer to decide which variant of the action is suitable for the individual situation. | It is up to the game developer to decide which variant of the action is suitable for the individual situation. | ||
--- | --- | ||
- | |||
- | --- | ||
- | |||
## Conditions | ## Conditions | ||
Line 192: | Line 189: | ||
## Expressions | ## Expressions | ||
- | These expressions return the path to special folders on the users operating system. If you use these expressions for loading and saving files it will be guaranteed to work on all supported operating systems. (Currently Windows, Linux and MacOS) | + | These expressions return the path to special folders on the users' |
=== Desktop folder === | === Desktop folder === | ||
This expression returns the operating system independent path to the //Desktop// folder of the user that runs your game. | This expression returns the operating system independent path to the //Desktop// folder of the user that runs your game. | ||
Line 205: | Line 202: | ||
=== Temp folder === | === Temp folder === | ||
This expression returns the operating system independent path to the //Temp// folder of the user that runs your game. | This expression returns the operating system independent path to the //Temp// folder of the user that runs your game. | ||
- | This folder is used for temporary files that your operating system can delete any time. | + | This folder is used for temporary files that your operating system can delete |
=== Userdata folder === | === Userdata folder === | ||
This expression returns the operating system independent path to the // | This expression returns the operating system independent path to the // | ||
This folder is used for storing application settings. | This folder is used for storing application settings. | ||
=== Path delimiter === | === Path delimiter === | ||
- | This expression returns the operating system independent path delimiter character. (" | + | This expression returns the operating system independent path delimiter character. (" |
Use this expression to build cross-platform file paths that can be accessed on all supported operating systems. | Use this expression to build cross-platform file paths that can be accessed on all supported operating systems. | ||
## Example | ## Example | ||
- | In order to save a screen shot to the // | + | In order to save a screenshot |
``` | ``` | ||
Line 220: | Line 217: | ||
``` | ``` | ||
- | This will work on Windows, Linux and MacOS. | + | This will work on Windows, Linux, and macOS. |