MySQL + php + Download object = Internet Game

This forum is currently in read-only mode.
0 favourites
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • ...well kinda...

    <img src="http://dl.dropbox.com/u/939828/screenshot3.PNG">

    http://dl.dropbox.com/u/939828/WorldDrawer.cap

    Note: Scirra is not responsible for the content. The drawing is community made so if it becomes offensive to anyone report it and I will clear the database content

    Loading the world

    Basically when you click 'load' it downloads a webpage that contains all the lines.

    http://steamgauge.com/misc/construct/da ... wnload.php

    As you can see if you download it in a web browser, its a bunch of numbers which wont mean much to you. However, to the application, each line represents an object in the form:

    X, Y, Width, Angle, Colour

    Saving the world

    Saving is a bit more complicated. Basically it generates a url in this form:

    upload.php?X=1,2,3&Y=...&X=...  etc[/code:1wiom92z]
    The php script can obtain X as a string like this: "1,2,3,4,5" and then split it into an array using the commas. 
    
    This is really just a proof of concept, but something like this could be used for something much bigger. For example, you could have a login system which stores all the usernames in an SQL server, and then you use the download object like this:
    [code:1wiom92z]login.php?username=Davo&password=awesome[/code:1wiom92z]
    And then compare what the website returns.
    
    However, there are many things to consider with this approach.
    1 - A hacker might be able to trick the computer into sending the 'logged in' message back without ever contacting your server
    2 - Any url you send could be viewed by hackers potentially, so the data should be encrypted somehow
    
    The advantage to using php to communicate with the database is that you dont have to worry about the username and password to the database being stored locally on everyones computer 
    
    Later I'll provide edited (so people dont know the password to the database ) versions of the php scripts I used for upload and download.
  • Wow, this is amazing stuff Davo! I was hoping someone would eventually make an example like this. But I can't seem to make separate shapes; it keeps continuing from the last line I drew.

    Edit: oh well, just made my own drawing code :p

  • login.php?username=Davo&password=awesome[/code:1gfxrcc5]
    

    If you ever do something that involves transmitting a password as plaintext, I will get a plane to Australia just to slap you

  • It just keeps telling me that it failed to download the world. How come I can't see all the cool stuff you made David?

  • same problem here

  • Hm. Double clicking on the downloaded cap results in:

    <img src="http://img189.imageshack.us/img189/6566/rhfjdjejdn.png">

    Opening Construct then browsing to the cap results in:

    <img src="http://img189.imageshack.us/img189/3704/rhfjdjejdw.png">

    Out of memory? Granted I have shittons of other stuff open, but I doubt that's the problem.

  • I dunno if the download object is unreliable or the server is unreliable (i think its more likely the download object) but just keep retrying the cap a few times clicking download. Also it uses Construct 0.99.72

  • How big is the canvas? Chances are the graphics card is choking.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i left my mark

  • Hm. Double clicking on the downloaded cap results in:

    <img src="http://img189.imageshack.us/img189/6566/rhfjdjejdn.png">

    Opening Construct then browsing to the cap results in:

    <img src="http://img189.imageshack.us/img189/3704/rhfjdjejdw.png">

    Out of memory? Granted I have shittons of other stuff open, but I doubt that's the problem.

    Download the latest construct (Unstable). I had the same issue with his split-screen concept.

  • *One month old topic bump : <*

    This is great! I was wondering if you could post the PHP Script so we can take a look at it =D

  • Just wanted to let everyone know that you can also do this with the Data Storage side of the Game Jolt API. It allows you to store data globally for the game, so your users won't have to sign up to Game Jolt to store global data. It's also coded as a straight up Plugin for Construct, so the reliability seems fairly good so far.

  • I still don't get how on earth you uploaded information.

  • How about using Dropbox? It is a stupid question? We can share a folder between players, and check for updates from those files. For turn based like games.

  • How about using Dropbox? It is a stupid question? We can share a folder between players, and check for updates from those files. For turn based like games.

    Dude... this may just be the most jenious idea I've ever heard, I'm gunna try it out.

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