How do I encode .json files

0 favourites
  • 7 posts
  • Hi all, I'm approaching a project and deciding how to set up my levels. I've decided I want to have a level editor, and if I made it good enough it would be the easiest way make official levels for the game. My problem with this though, is that I would have to create the levels with the editor than import them at runtime, and to do that I have to include that level data in .json project files. This game will probably also have a multiplayer mode that may be influenced by single player progress, and I don't want achievements to be easily hacked. By including the .json files for each level, players can easily modify level data and cheat, so is there a way to encode these files and decode them on C2 import, or another solution to this issue? Thanks.

  • Regardless of whether you encode the level data or not, the triggers for achievements will be able to be modified, if your server side app blindly trusts what the client reports.

    Disclaimers aside, you could use the CBHash plugin to do this - https://www.scirra.com/forum/plugin-cb-hash-md5-sha-1-and-sha-256_t62215

  • Regardless of whether you encode the level data or not, the triggers for achievements will be able to be modified, if your server side app blindly trusts what the client reports.

    Disclaimers aside, you could use the CBHash plugin to do this - https://www.scirra.com/forum/plugin-cb-hash-md5-sha-1-and-sha-256_t62215

    Well achievements are handled by steam, but again it's more an issue of multiplayer balancing. I'll look into that plugin, thanks!

  • You should just have a server that dictates the JSON and secure your server.

    The problem with hashing is that it is one-way, you cannot "decode" a hash.

  • You should just have a server that dictates the JSON and secure your server.

    The problem with hashing is that it is one-way, you cannot "decode" a hash.

    That would require the player to be online though to play the game at all, which isn't ideal. And it would end up being saved somewhere would it not, just harder to find.

  • As far as I know, you'll need to write a bit of code or use a plugin to encrypt/decrypt your json when you save/load it. One of the simplest ways is a character shift/replacement. It can be cracked, but if you have the luxury of worrying about the tiny population that would go through the effort, you probably have a wildly successful game already anyways (And then you can just change the method if you REALLY care that much. Which you probably won't.)

    Loading the files from a server is indeed the most secure method. At the very least, a user would not be able to change the file.

    If you think any offline game can be safe from hacking, that is simply not true. Effort and time is best spent improving your game rather than worrying about hackers, or you will never get to the point where you make a game worth hacking to begin with.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > You should just have a server that dictates the JSON and secure your server.

    >

    > The problem with hashing is that it is one-way, you cannot "decode" a hash.

    >

    That would require the player to be online though to play the game at all, which isn't ideal. And it would end up being saved somewhere would it not, just harder to find.

    Not necessarily. You can just have the game ask the server on start for all of the JSON necessary to run the game. Then you would talk to the server once at start and never again after that.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)