MySQL + php + Download object = Internet Game

Post your Construct-made creations!

Post » Wed Jan 06, 2010 3:53 pm

...well kinda...


http://dl.dropbox.com/u/939828/WorldDrawer.cap
[color=#FF0000:1wiom92z]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[/color:1wiom92z]

[size=150:1wiom92z]Loading the world[/size:1wiom92z]
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

[size=150:1wiom92z]Saving the world[/size:1wiom92z]
Saving is a bit more complicated. Basically it generates a url in this form:
[code:1wiom92z]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 :P) versions of the php scripts I used for upload and download.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Jan 06, 2010 4:28 pm

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
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed Jan 06, 2010 4:29 pm

[quote="David":1gfxrcc5][code:1gfxrcc5]login.php?username=Davo&password=awesome[/code:1gfxrcc5][/quote:1gfxrcc5]
If you ever do something that involves transmitting a password as plaintext, I will get a plane to Australia just to slap you :P
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Wed Jan 06, 2010 6:42 pm

:(

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? :cry:
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 06, 2010 7:30 pm

same problem here
B
11
S
3
G
4
Posts: 622
Reputation: 3,186

Post » Wed Jan 06, 2010 8:45 pm

Hm. Double clicking on the downloaded cap results in:


Opening Construct then browsing to the cap results in:


Out of memory? Granted I have shittons of other stuff open, but I doubt that's the problem.
B
2
S
2
G
3
Posts: 193
Reputation: 1,636

Post » Wed Jan 06, 2010 9:47 pm

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
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Jan 06, 2010 9:48 pm

How big is the canvas? Chances are the graphics card is choking.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Jan 07, 2010 12:19 am

i left my mark
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Thu Jan 07, 2010 2:23 am

[quote="Dataflashsabot":3qb13yvv]Hm. Double clicking on the downloaded cap results in:


Opening Construct then browsing to the cap results in:


Out of memory? Granted I have shittons of other stuff open, but I doubt that's the problem.[/quote:3qb13yvv]

Download the latest construct (Unstable). I had the same issue with his split-screen concept.
B
4
S
1
G
5
Posts: 98
Reputation: 1,648

Next

Return to Your Creations

Who is online

Users browsing this forum: No registered users and 0 guests