MSSQL as game server

MSSQL as game server

Post by Marius Traelne » Sat, 10 Feb 2001 20:42:16



Hello!

We have made a game that uses Flash connected with asp
pages and MSSQL Server. It is a online live game and many
players see the same live results from the game at the same
time. The technique is much in the same way as the many flas/ASP
Chats we have seen, but this goes all the way down to the MSSQL.

We hav set tha flash to update from the ASP page every 2. second.

This means that when there is 20 players logged on at the same time
an ASP page with a SQL connection is executed 20 times every
2. second (or 10 per second)(we can of cource set this to be 1 second or 3
seconds...).
This means further that when there is 200 players online at the same time
this ASP page is executed 100 times per second (and of cource 100 requsts
to the MS SQL server).

My questions are these:
How many requests can a ASP/SQL page take per second?
(The page is optimized in every way and the SQL is from a
stored procedure and the table is indexed......)
What are the other options?
Is any way to "push" the data to the Flash-client?
Is there any way to "bind" the data to the Flash-Client?
What about the XML(Socket,HTTP)(?), is that an option?
Are there other aspects we could consider?

I would appriciate any help on this topic!!

Marius Traelnes
Kunnskap & Internet AS

 
 
 

MSSQL as game server

Post by Mujahid Wazi » Sat, 10 Feb 2001 21:37:04


You could have an MTS Component between your ASP Pages and the Database. By
utalizing MTS, you are open to many of its advantages. From your point of
view, you can achieve optimuim utalization of resources and connection
pooling and your website can scale and accomodate a far more number of
concurrent users.

I guess subsequent data from the ASP page is dependent on how the game goes
? But if it is possible try to further minimize the number of calls to your
SQL. The ASP Page can fetch as much relevant data in one shot and return an
XML stream to the Flash page. Load and parse the XML stream in your first
Frame itself and access the Arrays in your subsequent Keyframes. The XML
object as most objects in Flash is event driven and a bit different from the
MS XMLDOM parser. The more number of calls your Flash page makes, the more
slow it is going to be.

-Mujahid

 
 
 

MSSQL as game server

Post by Marius Traelne » Sat, 10 Feb 2001 22:06:04


Hello!

Thanks for that answer!!
There are to points in your answer and both of them could maybe help!

I will just explain the game a little further:
There is to call:
1. One call gets the status of the game all the time, like points. This is
changing all
the time.
2. One call gets new question with answers and alternatives(this is a trivia
like game).
3. One third call saves the answers to the questions and awnsers.

Number 2 and 3 are done in the same ASP page.

I think i understand that the questions with answers and alternatives is a
typical thing for
the XML STREAM to the FLASH page, i could just load all the
question/answ/alt at once
and go through the xml file.(and then only send the answers to the questions
to the server
instead of sending and loading a new question....).

But i am not sure how to use MTS, i guess that should be used when there is
a lot of calls
against the same thing so both 1 and 3 is maybe both be good for that use.
But could you
maybe give som hint on how (I'm not telling you to do the work just set me
on a direction
so that i can search around...(i haven't used MTS before)

Thanks in advance!!

Marius


Quote:> You could have an MTS Component between your ASP Pages and the Database.
By
> utalizing MTS, you are open to many of its advantages. From your point of
> view, you can achieve optimuim utalization of resources and connection
> pooling and your website can scale and accomodate a far more number of
> concurrent users.

> I guess subsequent data from the ASP page is dependent on how the game
goes
> ? But if it is possible try to further minimize the number of calls to
your
> SQL. The ASP Page can fetch as much relevant data in one shot and return
an
> XML stream to the Flash page. Load and parse the XML stream in your first
> Frame itself and access the Arrays in your subsequent Keyframes. The XML
> object as most objects in Flash is event driven and a bit different from
the
> MS XMLDOM parser. The more number of calls your Flash page makes, the more
> slow it is going to be.

> -Mujahid

 
 
 

MSSQL as game server

Post by Mujahid Wazi » Sat, 10 Feb 2001 23:03:38


Marius,

From what you say there is a definate scope of improvement in your design.
Design in such a way that you have to make only 2 Calls to SQL for the
Questions.

1. One call from the ASP fetches all your questions, choices, and the right
answers. The ASP page creates a XML stream.

Here is an example. You could easily program to create an output XML stream
that best suits your intrest. Here the Question Set is my root XML. I have
an attribute that identifies the user currently answering my questions (so
that I can later update his row in the db)

<QUESTIONSET Userid="1000">
 <QUESTION id="1" text="What is the national animal of Australia?">
  <CHOICE-A>kiwi</CHOICE-A>
  <CHOICE-B>kangaroo</CHOICE-B>
  <CHOICE-C>elephant</CHOICE-C>
  <CHOICE-D>giraffe</CHOICE-D>
  <ANSWER>kangaroo</ANSWER>
 </QUESTION>
 <QUESTION id="2" text="Who are the original inhabitants of the Australian
continent?">
  <CHOICE-A>vikings</CHOICE-A>
  <CHOICE-B>sardars</CHOICE-B>
  <CHOICE-C>aborigines</CHOICE-C>
  <CHOICE-D>red indians</CHOICE-D>
  <ANSWER>aborigines</ANSWER>
 </QUESTION>
 <QUESTION id="3" text="Who is the black athlete from Cleveland who won 4
golds at the 1936 Olympics">
  <CHOICE-A>DaleyThompson</CHOICE-A>
  <CHOICE-B>Jesse Owens</CHOICE-B>
  <CHOICE-C>Ben Johnson</CHOICE-C>
  <CHOICE-D>Carl Lewis</CHOICE-D>
  <ANSWER>Jesse Owens</ANSWER>
 </QUESTION>
 <QUESTION id="4" text="Which martial art has been introduced in the 2000
Olympics?">
  <CHOICE-A>Taekwondo</CHOICE-A>
  <CHOICE-B>Karate</CHOICE-B>
  <CHOICE-C>judo</CHOICE-C>
  <CHOICE-D>kendo</CHOICE-D>
  <ANSWER>Taekwondo</ANSWER>
 </QUESTION>
</QUESTIONSET>

Once your ASP file is capable of doing this much.

Then all you got to in your first Frame

oXML = new XML();
oXML.onLoad = myFunction;
oXML.load("http://www.myserver.com/mypage.asp");

function myFunction() {
// Here you parse the XML object --> oXML

Quote:}

I woud suggest you have a look at sites like www.flastkit.com and
www.were-here.com
I have seen a couple of articles that parse XML data in Flash.

Once each question is answered you build a new XML stream.
A. It contains the UserID
B. Contains the asnwers the User has selected (or typed)
Send it across and the ASP page will submit it to the Database.

I do  not understand the points system. Why should u make calls to get
detremine the points.
Based on his answers cant you determine his points ? or if each question has
a set of points
say Question one has 5 points, Question two is harder, it has 8 points, you
could pass the points data in the XML Stream itself and manipulate. I would
assume even time taken is taken into consideration for points.
Use the ActionScript in ExpertMode. You can do amazing things from there.
Even manipulate with the Data Objects.

Regard MTS, if you know VB or component based development you could use MTS
But I suggest leaving out MTS for now. I suggested MTS for the whole
website, for all its ASP pages, for using a DLL (middle tier) and not
accessing the database from the ASP page etc. for speed an efficency. It
will be too much for your requirements.

BTW- I hope you are using Flash 5.

HTH
-Mujahid

 
 
 

MSSQL as game server

Post by Marius Traelne » Sun, 11 Feb 2001 02:10:43


Hello!

The ting about the points is that an ASP page is loaded for every 2. second
that
reads the names and points of all the other players so that they can see the
other
players names and points. Now you problably wonder how everybody can have
the same questions, but they don't the questions are pulled our randomly.

So in the flash "screen" there is something like this:

Player    Points
nameA    20
nameB    15
and so on.....

And these points are updated by geting the results from an ASP file that
connects
with the SQL server. I do not think i can get around that without using a
java server
or something like that.

Thanks for the answer!!

Marius

 
 
 

1. online game and mssql-server 7.0

hi!

at my company we are developping an online game, that supports many users
changing the environment. we want to save the data using mssql-server 7.0,
since it should be able to handle the big amount of data. now i have some
questions:

1. is it a good choice to use mssql-server.
2. which API to use (we develop in VC++ 6.0). i tried ADO, which is pretty
easy to use. but how about OLE DB? is the extra performance worth the more
complicated structure?

thanks,
gottfried

2. PRESS: IQ Software Acquires Soft Systems

3. Games, Games, Games...

4. Any suggestion on embedded adhoc reporting tools for VB & SQLSERver Apps...

5. please help does game enhancer work with ALL games

6. Access to VB4

7. Data exchange via XML from one MSSQL server to another MSSQL

8. Relational value lists on the web (FM 5.0)

9. Sql server database on the web playing strange games

10. A server that needs no CGIs and handles Web-based multi-player games

11. Conecting SQL Servers: MSSQL Server 7 and Open Data Services (ODS)

12. Problem: national characters converted in the way from MSSQL Server 7 to Web server

13. MSSQL SERVER + COM SERVERS