•• New idea: Save a game table to a CSV file by sending to your own local server
New idea: HOW TO SAVE A GAME TABLE TO A CSV
How to save a game table so it can be brought back into GameSalad creator already populated with data, or for reviewing the state of a table mid game.
It's always been a little frustrating that we can't save and review the tables in our games to see what values they hold during gameplay. Also that we can't fill them with data that can then be integrated into a game from the start.
I can get round being able to review the data in game using my own Table-izer setup (lots of spawned actors displaying table values that can be scrolled), which is handy but it would often be more useful to be able to save out the current state of a table, to review afterwards or to use as info to put into a game from the get go.
A good example (at least I think it's a good idea) is the A* pathfinding in gamesalad I've been working on. It takes a considerable amount of time to compute the final path from point a to b round obstacles. So for a small game it would be great to have the paths pre-computed and saved into a game table. This could then be used in the game to deliver the best path much quicker (as quickly as GameSalad can find the appropriate saved path). A Grid of 12 x 12 would have at most 1728 possible paths to have saved before hand. (Edit make that 20736 ish without any walls)
So the theory:
- Fill table with data whilst in game preview
- Send table to Server (using Send to URL)
- Where it is stored in a database
- Then export as CSV file . There seem to be a number of approaches to do this.
- Import into GameSalad It may then need re-formatting to match the format GameSalad likes.
Just an idea at the moment but seems like it should be possible, so I thought I'd ask to see if anyone has tried and succeeded with this already before I roll up my sleeves and give it a go.
Never tried it, but am I right in thinking a table can have more than 100 rows if they're added in game? ... can we then also import a table with more than 100 rows?
Comments
Good questions and interesting theory. I've never tried sending stuff to my own server yet (for shame!) so I'm no help there. The theory sounds good though. I'm interested in hearing the results!
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
How many open spaces are you assuming for that path count? Or are you using a minimum space distance before checking the table?
@Moik . I see what your getting at . . make that 20736.. .
Must have done 12 * 12*12
Rather than (12*12) * (144)
I had thought the number seemed low compared to the last time I did the math.
That's a grid with no walls. So once it has a few obstacles it would be possibly a 3rd less.
Plus my pathfinder is probably quick enough as is if you were only looking 3 spaces away so that could reduce the area further (though ideally I wouldn't have to ).
Cheers
Is a table with 20000 rows searchable or even possible with gamesalad (I've never made a word game so never dealt with large datasets)
@StormyStudio yes you can import a table with more than 100 rows. I used @jonmulcahy method in thread "Sending and Receiving data using your own SQL Server - PHP file and TestProject included" to import a table 12,000r x 17c. A table that size imports very slow 125 seconds on an iPad 5 and 4 minutes on an iPone 5 all lessor devices crash during import.
At the moment you can't import a csv file from a server but @stevej intends to add it at some point. If more of us want it he may add it sooner rather than later.
Here is what he said in thread "Async multiplayer early-adopter documentation" page 16
"A csv file might be slightly quicker, but at the moment there's no way to download one (well, technically you could have a string table cell that was csv text, and then parse it in-game, but that would definitely be slow). I do want to add an option to the data<->URL functions to handle csv data, but I don't know when I'll get the time to implement it at the moment."
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Thanks @colander sounds very promising then.
I was actually meaning to import the CSV through the import CSV button inside the creator rather than via the GET URL behavior. So the info is there at run time.
I'd be sending a table to the local server once to retrieve a table populated with data.
It should also save me from the problem of the lengthy import times.
How has performance been when searching a table with that many rows?
At some point soon I'll get back to my own multiplayer shenanigans.
Ok got it.
How big is the table you plan to send and retrieve from the server?
I search one column three times to find the beginning and end of an event and it does it almost instantly. That table search function is unbelievable quick.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Probably between 14000 and 20000 rows, 3 columns (if I can figure out how to store some info into a string).
I'd only be sending to the server the once. Where it would be saved to a database. I could then go into PHPmyAdmin manually and export it as a CSV file.. (I think there are ways).
That's what I wanted to hear
Well it works...
I've populated a able with 600 rows worth of data whilst in Game preview mode inside of GameSalad creator.
Sent to my local server, where the data is stored in a database.
Went to 'export' table in PHPmyadmin.
Choose CSV for Excel , select Excel for Mac 2008.
(making sure to choose to save the result as a file and not preview it as text'.
Import CSV into a gamesalad table.
Brilliant...
Now onto see if it allows me to get my game working the way I would like it to.
Were you able to use my string data-reader thing
@StormyStudio when you imported the csv file you created on your server do you mean you stopped Preview and used the "Import CSV" button in the Tables tab or did you somehow import the csv file into your game while it was running in Preview?
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@Fajlajp
Yep just got round to that bit, I tweaked it ever so slightly as all my strings started with a '!' so I had to look for the second one, then find the text before it, ignoring the first letter.
@colander ... Yes I stopped Preview, and imported the CSV file that I'd been and downloaded from my server. I don't need to update the data of that particular table when the game does live, I just want the data in the game for actors to read quickly. It's reducing some processes that would take 10 or 20 seconds to 1 or 2 10th's of a second.