Connecting to a web server
by Hilbert Reijngoudt · in iTorque 2D · 04/21/2012 (7:55 am) · 6 replies
I want to connect to a webserver from within my game. Anybody done this before? I want to use it to send/receive data(text and/or images) from/to my web server.
I tried using the httpobject but that doesn't work all that well....
Any help would be appreciated.
I tried using the httpobject but that doesn't work all that well....
Any help would be appreciated.
#2
I'm a c++ programmer and never coded in objectivec before so there's a challenge:-)
04/23/2012 (7:36 am)
Thanks, i was afraid that that was the way to go. I was hoping it could be done with the standard functionality of the engine.I'm a c++ programmer and never coded in objectivec before so there's a challenge:-)
#3
04/23/2012 (9:11 pm)
My game Go Beryllium connects to a webserver to submit high scores. Just google "Go Beryllium source" for the source code (in torquescript). The game is in T2D but the same scripts work in iT2D.
#4
04/23/2012 (11:12 pm)
Thanks! Can i also use this method to send/receive pictures to/from my webserver or is it text based only?
#5
04/23/2012 (11:53 pm)
I've only used it to send/get text from a php page.
#6
04/24/2012 (12:37 am)
Ok, i will see if i can use this for images also. If not i will write something myself in objective-c. But thanks for the suggestion!
Torque Owner Hugo Munoz
Tinkuq Games
#include "platformiPhone/platformiPhone.h"
#include "console/console.h"
create a function that connects to the server:
void connectToServer()
{
// do whatever is needed
}
finally expose that function to the script:
ConsoleFunction(connectToServer, void, 1, 1, "connectToServer()")
{
connectToServer();
}
Hope it helps