HTTP server Maker?

dripple

  • Posts: 747
Ah, okay, I didn't realize you were talking about writing the server with Stencyl.
Like Joe said as well, Stencyl is not the right tool for that.
It wasn't me. I think also that Stencyl is not the right tool :-)
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

dripple

  • Posts: 747
I'm the friend he's referencing. I'm a Sysadmin focused mostly in the Windows space. i've created a amazon AWS image running windows/IIS/asp/mssql, but scratched that and setup a LAMP stack instead.
The technoglogy is your choice. Choose whatever you're feeling comfortable with :-)

What I am not is a web coder/scripter. If someone had some sample back end php code for doing an initial http post/get.  Anyone know where I could find that?
Stencyl has a tutorial for their side for the http requests, I just need to see the other side and I can expand from there.
If you have setup LAMP correctly, you're almost there. The "interface" between the game and the server is simple PHP page. Use the Stencyl HTTP GET blocks to call the page from the server and return the content back to your game. Use a POST block an another PHP page to post information to your server.

This two pages would make the framework of your back-end then. Google PHP request (I am the Java guy, sorry)
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

aaronski

  • Posts: 2
Stencyl is very similar to Unity, which I have a fair bit of experience supporting. I'm used to being the SysAdmin with a  PHP programmer and a MYSQL admin by my side.
Once I have a "hello world" equivalent up and running I can bring it to my friends and say, how do I ? but I need something to start with first.


MeToo

  • Posts: 355
A bit of what I've read around the net suggests that for asynchronous multi-player (which this game is) something like SmartFoxServer is more complicated and expensive than would be required.

dripple

  • Posts: 747
@aaronski, MeeToo Don't get me wrong, I am really willing to help. But without any information about the game type and what the server has to do (I asked it another in a post somewhere above) we can't lead you to the right direction.

- Do you want to do a Game-Center clone?
- Do you want to do a turn-based game and the server maintains the persistence and broadcasting to other players?
- Do you want to do a real-time strategy-/action game where the server updates the others player information in real-time to a game clients?
- Do you want a community like back-end which chatting, messaging and some leaderboards?

If you don't want to expose your game idea / concept (which I understand), pm me and I might give you the right direction.

Cheers,
Heiko
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

dripple

  • Posts: 747
This might help you as a jump start:

This is a simple PHP script called helloworld.php that retrieves an attribute (by reading the REQUEST), stores it in a variable and responds with a "Hello World" and the attribute in simple string:
Code: [Select]
<?php // save file as "helloworld.php"
$param $_REQUEST['param'];
echo "Hello, World with param="$param
?>


This simple Stencyl code (placed in Scene events) calls the PHP (you have to change the URL to your local one) and draws the response on the Scene.
(Three local game attributes of type Text: <URL>, <param> and <response>)



NOTE: You have to deploy the game to your server where the PHP script is hosted, or you'll get a security warning and the game won't work.
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

MeToo

  • Posts: 355
It is for an asynchronous mutliplayer game that is comparable to Clash of Clans, but with a different combat style and themes.

We will need the server to handle things like match-making, ranking and possibly a chat interface.

Additionally to prevent players from hacking their client side to alter their stats/money/etc (cheating their fellow players, and us) there is a method where changes to those things are made and checked up on by the server at certain intervals, aaronski could better explain the details of that, or maybe when I reference that sort of idea you already have a wealth of knowledge on the concept.

Edit: The way that you have it set up to visit URL and param, exactly how will that send the data off?

 Will it be

http://localhost/heikokanzler/helloworld.php?Test

?

Or &test

or (space)test

or does it execute the URL, and then somehow know that the "param" is separate (given the it's all in one stencly block I wouldn't expect it to, unless it was going to anyway if we had simply put

"http://localhost/heikokanzler/helloworld.php?Test"

in the Visit box)


your example is a helpful one, and I'd have an easy time duplicating it, and doing others in that exact same way, but I think it would help me a lot to be sure I know the format in which the server is receiving these things.

« Last Edit: June 04, 2013, 11:48:52 pm by MeToo »

dripple

  • Posts: 747
Hi MeToo, thanks for the information, that make things clearer in the discussion.

In my example, the full URL the server is called looks like this
http://localhost/heikokanzler/helloworld.php?param=Test
You can easily check it out by calling the URL from your web-browser and then play around with the param-values or change the script to retrieve different params (see below).

In my example, the script is located under the URL /heikokanzler/helloworld.php and you pass the parameters to the script in the way param=value. The script itself looks for the key="param" and retrieves the value (this is often referred as a REST API)
If you want to pass more attributes / parameters to the script, you append them in the way &another_param=anothervalue&differentparam=waydifferentvalue. Please note that the additional attributes are delimited by a "&", that differs to the inital "?" right after the script name.

You can access the params in the script by asking $_REQUEST['another_param'], i.e.
Code: [Select]
<?php // save file as helloworld.php
$param $_REQUEST['param'];
$another_param $_REQUEST['another_param'];
$differentparam $_REQUEST['differentparam'];
echo "Hello, World with params="$param .", "$another_param .", "$differentparam
?>


In Stencyl, change the line
[set <param> to [param=Test&another_param=Test2&differentparam=Test3]]
to call the script with the new parameters.

With securing a online game, preventing from hacking and cheating, there's a lot to consider. We do cash games and are faced to this challenge everyday. Not an easy task, but possible :)

I suggest, you should discuss with your game architect and technical architect / php developer, they should know what to do and advice you as the game developer how to interact with the backend.

Cheers,
Heiko

« Last Edit: June 05, 2013, 01:11:40 am by dripple »
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

MeToo

  • Posts: 355
Thank you VERY MUCH dripple! I am finding this EXTREMELY helpful/well explained/interesting!

It is really helping my understanding of how Stencly's HTTP requests and the server can interact.

Aaronski doesn't have as loose a schedule as I do, so without being in constant contact with him, I will in some cases being asking you things here not knowing if he needs them, or if they will only be teaching me. But if you'll indulge me I'm loving this, and think it may help some other Stencyl users who find themselves in my position.

Can we talk a little bit about the management of the data? I suppose this is the back end you have been referring to. I was looking at a Google Sites Tutorial that lets you practice parsing data in an XML file.

(I'm hoping to eventually learn to do these kinds of server things, that's why I'm looking around, if the XML tutorial I did is completely inapplicable to the kind of thing you network guys are talking about, please let me know. I'm hoping to get into a position eventually where I can at least program the back end data management and http requests, though I know that for now you two will be having a discussion a fair bit over my head. )

How would you explain (or direct me to learn about) the process of handing the data from the server to the application that will process it?

Server side I will in some way need to keep track of variables like money/strength/levels of buildings and spells etc, add or subtract them at appropriate times, and also keep track of a clock, to keep a sense of how far along buildings should be in their progress (given that they take time to upgrade) there will also be issues of matchmaking. I guess what this mostly comes down to is managing a database, setting it up to properly handle this sort of reaction:

Stencyl sends http post to server ----> server gets it, then sends it to database management app (MySQL? XML spreadsheet in google docs/google sites? other?) -------> database management app processes the request and returns a string to the server -------> server provides a response to stencyl -----> I use the response block in Stencyl.

Is that how it goes?

Any sort of further enlightenment you can give me is greatly appreciated! Thanks dripple!

dripple

  • Posts: 747
Hi MeToo.

We're now stepping into something thats seriously called Enterprise Development and might be way of the scope of this board :)

Usually, you have a number of tiers in such applications, starting from the client down to the back-end, which might have up to 3 or 4 tiers, depending on the choosen architecture. Look at my graphic below, it gives you also an overview about the squence of a simple action like save a score to the database.

If you want to have different clients connecting to your server, i.e. Flash, Native, HTML5, you might also want to use different connections methods (e.g. HTTP or Sockets - latter not implemented in Stencyl, as far I know) and put the game logic into a separate server application. This allows you later to scale, but for the beginning, having everything the "web server" would be a good start.

Think of Behaviors, you separate them from the Scenes and Actors to reuse them. Thats what you do in the application server.

I am sure, aaronski will be familar with this and might give you more detail on this.

A very good book to start playing around with (php based-) web applications and databases is "PHP and MySQL For Dummies.

With your game: you should do your game design document first, create the story and then strip down the game mechanics, figuring out what mechanic is multiplayer or needs persistence. This is then something for the to-do list of your application developer.


« Last Edit: June 05, 2013, 04:51:35 am by dripple »
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

MeToo

  • Posts: 355
Awesome, thank you! 2 questions:

1. Does "persistence" refer to things that we are trying to keep anyone from cheating about client-side?

2. The book that you've recommended,does it require a previous knowledge of any coding language, like html, java, C? Or can I pick it up knowing no computer languages?

Thanks Dripple!

dripple

  • Posts: 747
Persistance is about saving information permanent to disk, i.e. a database.

Securing your game is something complete different. Terms here are obfuscation, hashing, encryption, SSL and HTTPS.
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

Kjsten

  • Posts: 65
Sorry to chime in again, but seeing more of your questions and getting a better understanding of what you're trying to do... the questions you're asking indicate that you're way way over your head.  I suggest starting small, like setting up a little LAMP (or WAMP) environment for yourself, create a few PHP pages on a site that do basic GET/POSTS.  You can do all this for free and on your own laptop.  Learn about what the A M P actually means and involves. THEN think about getting a simple game running and work your way up to more advanced stuff.

OH, and it sounds like you're new to Stencyl and programming. Same thing...you're going for the gold right off the bat (you must be very young...I want it all and I want it now!!!!).  Learn the tool first with smaller projects.

« Last Edit: June 05, 2013, 07:22:07 pm by Kjsten »

MeToo

  • Posts: 355
As I've said, someone far more network savvy than me is handling that end of things for this game. Dripple was also giving me some insight on where to start for a future where I might be able to personally handle the network side of these things.

In terms of network stuff I am, as I have previously said, over my head, but I'm solid with Stencyl, and it is going really well. Thanks though.

Kjsten

  • Posts: 65
Well good luck.   Can't fault your determination  ;)