Jump to content


Photo
- - - - -

[HTML5] Saving With INI File


  • Please log in to reply
12 replies to this topic

#1 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 15 November 2011 - 01:04 AM

  • Title: HTML5 Saving Game With INI File
  • Description: Since the default saving features of GM don't work with GM:HTML5 A lot of questions have come up on how to save a game.
  • GM Version: GM:HTML5
  • Registered: Yes (No free version)
  • File Type: .zip, .rar
  • File Size: 1.98MB
  • File Link: Single Save Slot Version 1 | Live Example
  • File Link: Multiple Save Slot Version 2 | Live Example
  • Required Extensions: N/A
  • Required DLLs: N/A

Summary

With Game Maker: HTML:5 you can no longer use the built in saving functions of GM. If you want to save a game, you now must use your own method. This is a VERY basic way of saving a game with an INI file. I avoided complicated code to make it as simple as possible, however it is in GML and not D&D. Hopefully this example will give you a jump start to understanding the process of saving a game via an INI file. This version only allows 1 save slot., but if the need is there I can update to allow multiple save slots of you can't figure it out, however I think the method is simple enough anyone should be able to modify it to their needs and build on it.

HTML5 used Local Storage to save your ini files on the end users PC, not on the web server.

You can see it live HERE Play a couple levels and save your game. The restart it and you will see the load button to load your previous game with.

UPDATE: I have has several people PM me about multiple save slots, so I have created a revised version that features 3 save slots instead of just 1. I am keeping both in the topic as the 3 slot version is slightly more complicated, so If you do not need multiple save slots use the first one. When you open the game, click New Game and you will see 3 save slots. They should
all say NEW. LEFT Click one and enter a name then press enter. Then you can click your name to start the game. RIGHT click on a slot to delete it.

INI Saving 2

You can play it live HERE!

Spoiler

Edited by Destron, 26 June 2014 - 06:58 PM.

  • 2
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.

#2 john316

john316

    GMC Member

  • GMC Member
  • 27 posts

Posted 14 December 2011 - 04:08 AM

can you please give an example on multiple save slots with some sorta of login feature?thx in adv
  • 0

#3 _253314

_253314

    GMC Member

  • New Member
  • 1 posts

Posted 13 February 2012 - 04:38 PM

sir i cant download the file . . the domain is expired . .
  • 0

#4 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 01 March 2012 - 10:13 PM

Sorry link is fixed. Tried to transfer my domain from godaddy and they decided to get in a pissing match with the new registrar over it.
  • 0
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.

#5 Osmium

Osmium

    Graphic Artist

  • GMC Member
  • 308 posts
  • Version:GM:Studio

Posted 03 March 2012 - 02:48 PM

Works fine.Thanks! :thumbsup:
  • 0
Posted Image

#6 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 25 March 2012 - 08:06 AM

Because I had a ton of inquiries, I added a second version with multiple save slots.
  • 0
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.

#7 Molinware

Molinware

    GMC Member

  • GMC Member
  • 35 posts
  • Version:Unknown

Posted 06 June 2012 - 01:36 AM

So how it works?
Like... where the files keep saved?
  • 0

#8 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 06 June 2012 - 01:53 AM

The files are kept in your browsers HTML5 local storage on the users PC.
  • 0
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.

#9 pfaustino

pfaustino

    GMC Member

  • New Member
  • 9 posts
  • Version:GM:Studio

Posted 22 December 2013 - 08:25 PM

domain is suspended again and download links no longer work. please fix.


  • 0

#10 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 01 January 2014 - 02:07 AM

Sorry for the inconvenience I have been having ongoing issues with my web host, apparently they struggle with the whole paypal subscription things so I will be moving hosts. Until then the live examples are down but I have posted links for the downloads.


  • 0
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.

#11 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 26 June 2014 - 06:59 PM

I forgot to update this post, but since I have been getting PM's I updated the post again to include the live links. 


  • 0
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.

#12 Briana83

Briana83

    GMC Member

  • GMC Member
  • 32 posts
  • Version:GM:Studio

Posted 16 June 2015 - 05:28 AM

I don't want to fool with objects, just save the exact state of my game... the way GM usually does...


  • 0

#13 Destron

Destron

    GMC Member

  • GMC Member
  • 1361 posts
  • Version:GM:Studio

Posted 16 June 2015 - 06:18 AM

With the INI file you can save as much or as little information as you like about your game. You can simply save lives, health, etc or you can follow further and save the location of items on screen. It's up to you.
  • 0
HTML5 INI Saving Example | HTML5/GMS Saving/Loading/User Login with PHP/MySQL/Async | GameMaker Examples/Tutorials | PHP/MySQL cross platform high score list/leaderboard
Those who try to do something and fail are infinitely better than those who try to do nothing and succeed.