Which is the fastest/lightest way to make the game Multilanguage

Discussion in 'Programming' started by Sorry_For_Dumb_Questions, Jan 11, 2019.

  1. Sorry_For_Dumb_Questions

    Sorry_For_Dumb_Questions Member

    Joined:
    Nov 24, 2018
    Posts:
    19
    1) Global 2D Array and store all text in it. (150+ value)
    2) INI file.

    I think 1 is bad for CPU but i don't know, whats your opinion?
     
  2. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    1,929
    150 values? That's nothing to worry about.

    I would do both. Store the values in a text file of which using an ini file is one possible solution. At the start of the game, load all the values into a global 2D array.

    Then you have the best of both worlds. A file format that can be easily updated, and the speed of having the values stored in memory when the game is running.
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    3,689
    I wouldn't want either option. I'd use JSON to store my localization data, and take advantage of constant-time lookups that a map could offer.
     
  4. Sorry_For_Dumb_Questions

    Sorry_For_Dumb_Questions Member

    Joined:
    Nov 24, 2018
    Posts:
    19
    How can use JSON for this?
    Can you give example please?
     
  5. Sorry_For_Dumb_Questions

    Sorry_For_Dumb_Questions Member

    Joined:
    Nov 24, 2018
    Posts:
    19
    When i say INI, i thought like this;

    var text1;
    ini open "file.ini";
    text1 = ini read ( english, "text_key" , "defaulttext");
    ini close;

    Opening and closing ini files for each text quary maybe forcing the CPU?
     
  6. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    1,929
    @FrostyCat is right, JSON data loaded into a ds_map is a good solution.

    Yes, opening and closing an ini file is time consuming if you were doing this in something like a Step Event that runs every frame. That's why loading everything at the start of the game into a ds_map will be optimal.

    There are plenty of example posts of loading and saving data to and from a map using JSON on this forum.

    I haven't watched this particular tutorial, but here is one example that perfectly matches:

    https://forum.yoyogames.com/index.p...ltilingual-via-auto-loading-json-files.57659/

    I just used the search box on the forum to search for "json map loading" and this was one of the first results.
     
  7. Sorry_For_Dumb_Questions

    Sorry_For_Dumb_Questions Member

    Joined:
    Nov 24, 2018
    Posts:
    19
    Sorry and thank you
     
  8. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    1,929
    You're welcome and no need to be sorry, just pointing out there are already some great resources that explain the topic. Feel free to ask more if you get stuck along the way.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice