How to make a web browser Game

Is it possible to make a web browser game? (and get it online)

Page 1 of 1

2 Replies - 27513 Views - Last Post: 16 January 2008 - 03:09 PM Rate Topic: -----

#1 martijn 007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-January 08

How to make a web browser Game

Post icon  Posted 16 January 2008 - 07:43 AM

[font=Arial][size=1]Is it possible to make a free web browser game, and get it online?

i'm pretty good at making games with game maker, but i'm always thinking how to make a free web browser game.
if somebody could help me, please. (if i need to use any other program then Game Maker, it's also okay)

thanks,
Martijn.007 :)

Is This A Good Question/Topic? 0
  • +

Replies To: How to make a web browser Game

#2 csmanoj  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 150
  • Joined: 06-August 07

Re: How to make a web browser Game

Posted 16 January 2008 - 08:45 AM

Learn Flash to make simple games. Then learn XHTML to host them on the web. After that learn Actionscript to take your games to a cool new level. After that learn some server side scripting language ASP or PHP.
Was This Post Helpful? 0
  • +
  • -

#11 TheMagnitude  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 144
  • Joined: 12-January 08

Re: How to make a web browser Game

Posted 16 January 2008 - 03:09 PM

No other external tools or programs are required except Game Maker and a dll.

Firstly to connect to the internet and use the HTTP protocol in Game Maker. You can either use the readily made mplay_ functions avaliable, but there a bit slow. I recommend using 39dll (GMC topic) to handle all your winsock calls.

So basically download the dll and scripts for 39dll.

Once you have them heres the code to execute a HTTP protocol:
// HTTP(host, GET/POST,POST variables)
if !bufferexists(global.HTTP_buffer)
global.HTTP_buffer=createbuffer();
//if !tcpconnected(global.HTTP_sock)
 {
 global.HTTP_sock = tcpconnect(argument0, 80, 0);
 if(!global.HTTP_sock)
  {
  show_message("Unable to connect to "+argument0);
  return -1;
  exit;
  }
 }
setformat(global.HTTP_sock, 1, chr(13) + chr(10));
newLine = chr(13) + chr(10);
clearbuffer(global.HTTP_buffer);
writechars(argument1+" HTTP/1.0" + newLine,global.HTTP_buffer);
writechars("Host: "+argument0 + newLine,global.HTTP_buffer);
writechars("User-Agent: Shadow Zone/1.0" + newLine,global.HTTP_buffer);
if is_string(argument2)
	{
	writechars("Content-Type: application/x-www-form-urlencoded"+newLine,global.HTTP_buffer);
	writechars("Content-Length: "+string(string_length(argument2))+newLine,global.HTTP_buffer);
	writechars(newLine+argument2,global.HTTP_buffer);
	}
//show_message(argument1+" HTTP/1.0" + newLine+"Host: "+argument0 + newLine+newLine+argument2);
sendmessage(global.HTTP_sock,"",0,global.HTTP_buffer);
processHeader = true;
while(processHeader)
{
	receivemessage(global.HTTP_sock,0,global.HTTP_buffer);
	firstWord = readsep(newLine,global.HTTP_buffer);
	switch(firstWord)
	{
		case "":		//blank line
			processHeader = false;
		break;
		
		//read important stuff from header...
	}
}
clearbuffer(global.HTTP_buffer);
setformat(global.HTTP_sock, 2);
retVal = "";
while(1)
{
	size = receivemessage(global.HTTP_sock, 6000,global.HTTP_buffer);
	if(size > 0)
		retVal += readchars(size,global.HTTP_buffer);
	else break;
}
return retVal;


This is how you would use the above code once 39dll and the scripts are implemented into your game.

To open www.themagnitude.co.uk/index.php:
dllinit(0,1,1);
HTTP("www.themagnitude.co.uk","GET /index.php");


This function will return the HTML code of the webpage. I'm not sure how you would parse the HTML code to display it as a webpage but that is how you access a webpage.

~Ad

PS: If you meant to play your games in a web browser refer to csmanoj's post, but if you wanted to turn your game into a web browser :P use this post and reply if more help is required.
Was This Post Helpful? 1

Page 1 of 1