# Web based game

**URL:** <https://forum.kirupa.com/t/web-based-game/7761>\
**Category:** flash\
**Created:** [November 7, 2002, 5:34am UTC](https://forum.kirupa.com/t/web-based-game/7761 "2002-11-07T05:34:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patola](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@patola](https://forum.kirupa.com/u/patola)\
**Post date:** [November 7, 2002, 5:34am UTC](https://forum.kirupa.com/t/web-based-game/7761/1 "2002-11-07T05:34:38Z")

</div>

I need to make a web based game using flash etc for my college project. I want users to log on and select a room. With a max of 5 players in one room, the 5 players compete with each other on the board(like yahoo games).

My prob:

1. I dunno how to divide the users ino rooms.
2. I dunno how to control 5 or less players in a room playing the same swf.

PLEASE HELP!:q:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 7, 2002, 6:00am UTC](https://forum.kirupa.com/t/web-based-game/7761/2 "2002-11-07T06:00:45Z")

</div>

Wow that would be some master coding. I don’t know if you could even do that with the basic Flash. Actually, there is probably a way to count the number of users, store it as a variable, and then each time a user enters the site, check the variable. If the number is more than 5, you oculd probably redirect him to another .swf. I don’t know…

Again it would be massive coding.

Good luck!  
-brad-:cowboy:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 7, 2002, 7:49am UTC](https://forum.kirupa.com/t/web-based-game/7761/3 "2002-11-07T07:49:40Z")

</div>

Assign each room and array. When a user wants to go to a room if the array for that room is not full then add him to the array.

As for controlling users in the same room, u need to build a server/client system.

The important instructions are done by the server. The client just makes requests from the server.

For example

on SERVER:

function updateText(textString)  
{  
textBox=textBox+textString;  
for(i=1;i\<5;i++)  
{  
client\*.textBox=this.textBox  
}  
}

on CLIENT:

function sendText(textString)  
{  
server.updateText(textString)  
}

OK so this isnt actally how you reference the client and server, ull have to figure that out but the message passing is the same. a client invokes the sendText when he enters a message and clicks send, the function then passes this to the server who then passes that string out to all users. U would then have a method updateText ont the client :

function updateText(textString)  
{  
textBox=textBox+textString  
}

Hope this helps

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 7, 2002, 6:17pm UTC](https://forum.kirupa.com/t/web-based-game/7761/4 "2002-11-07T18:17:19Z")

</div>

Thank you Dravos my friend. Great Help!  
The room thing in an array is a cool idea.  
I was thinking I would have to do this stuff in php or something.  
Im still not clear about how to handle different users to use same swf file in same room.

Any suggestions are still welcome.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 7, 2002, 7:13pm UTC](https://forum.kirupa.com/t/web-based-game/7761/5 "2002-11-07T19:13:14Z")

</div>

**Patola** ,  
I think **Dravos’** suggestion about using an Array for each room is a good idea. Another approach you could take is to make each room a node in a linked-list. It might come down to more of a personal preference (as it would work either way), but I just thought I would make the suggestion. 🙂

LilShieste  
BTW- Hello everyone!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 7, 2002, 7:31pm UTC](https://forum.kirupa.com/t/web-based-game/7761/6 "2002-11-07T19:31:31Z")

</div>

or if you want to get complicated and rooms came under categories which came under categories you could consider using binary or multi noded trees! but its only a small project!
