How to import excel data or create database easily for RPG game?

Discussion in 'Programming' started by krugen, Apr 9, 2019.

  1. krugen

    krugen Member

    Joined:
    Jan 24, 2019
    Posts:
    180
    What happens when a game requires massive data base for player's and NPC's stats?
    What I think initially is that I have to do the following manually by hand:

    data_table[row, column] = 90

    for all entries.

    Isn't that crazy?
     
  2. Danei

    Danei Member

    Joined:
    Mar 23, 2018
    Posts:
    278
    JSON!

    Lists within lists. Maps within maps. Lists within maps. Maps within lists within lists within maps. It's structures all the way down!

    If JSON was a human being I would ask them to marry me.
     
  3. krugen

    krugen Member

    Joined:
    Jan 24, 2019
    Posts:
    180
    So does this mean I have to code each entry manually? No simple way to import an excel table or such?
     
  4. krugen

    krugen Member

    Joined:
    Jan 24, 2019
    Posts:
    180
    I dunno anything about jason. Are u saying Json is what I need?
     
  5. Danei

    Danei Member

    Joined:
    Mar 23, 2018
    Posts:
    278
    I don't know for sure but I bet there are tools for outputting or converting excel files to JSON format, and if so, you can then import the JSON to gamemaker with some coding. Importing JSON itself isn't quite as simple as one might wish it to be, but it's not really complex either.

    JSON is a way of structuring strings and values in maps and lists, and GMS has functions to import and encode it. It's useful for organizing and accessing large sums of game data. Or at least I sure find it useful.
     
  6. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    1,212
    Excel is easy, just export it as a .csv file (comma separated value file) and then write a string parsing script that takes the csv file and parses the string into chunks using the comma as a separator and stores each chunk into the corresponding row/column in a ds_grid. Doing it manually is absolutely not required.
     
    DaMuffin likes this.
  7. krugen

    krugen Member

    Joined:
    Jan 24, 2019
    Posts:
    180
    Thanks guys. I'll try out your suggestion
     
  8. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,204
    Excel Spreadsheet. (CSV format)

    Use the function load_csv() to load it into a ds_grid.

    You could then choose to manipulate the data as you wish, even copy it into a map and save it as JSON at that point if you wanted to.
     
    DaMuffin, krugen and RefresherTowel like this.
  9. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    1,212
    Lel, I did not know load_csv existed. How useful.
     
    IndianaBones likes this.
  10. Danei

    Danei Member

    Joined:
    Mar 23, 2018
    Posts:
    278
    Omg same
     
    RefresherTowel likes this.
  11. Tony Brice

    Tony Brice Member

    Joined:
    Feb 4, 2017
    Posts:
    67
    I've used load_csv before and it does work but the important thing to remember is to use the real() command when you load in a number from the data. I found numeric comparisons were not working with them otherwise.
     

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