x


Web Player and DB communication

So how would the web player communicate to a DB backend. It has to somehow or that Tiger Woods game would not work. Do I have to send messages to my web browser which in turn sends JSON messages to a DB middleman like Rails?

more ▼

asked Jan 17 '10 at 04:00 PM

Brad Hutchins gravatar image

Brad Hutchins
21 1 1 2

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Yes, the 'middle-man' idea is pretty much correct. You use the WWW class in Unity to make POST or GET calls to scripts which reside on your server, which in turn talk to the database which is often also on the same server.

These server-side scripts are generally written in php, asp, perl, or some other server-side scripting language. The scripts receive data from your webplayer and then talk locally to the DB. If the data is sufficiently complex, you might want to use a data format such as JSON, however often it's enough to just have a few named parameters which the script accepts.

There's a good example in the manual which shows you how you can use these features to send and retrieve high score data to a server-side scoreboard, here (it's after the PNG example):

http://unity3d.com/support/documentation/ScriptReference/WWWForm.html

more ▼

answered Jan 17 '10 at 05:43 PM

duck gravatar image

duck ♦♦
41k 92 148 415

I know the Web player for Unity is for... Duh... Games. But I saw a lot of users of Unity use it for non-Game apps, but usually fairly graphical ones. That is what I am thinking. To not only develop games in Unity, but to also use it to develop an RIA for my day job instead of use of Silver Light or Flex/Flash because the Unity Web player is meant to be interactive where (at least flash) is a modified movie file.

Jan 17 '10 at 06:08 PM Brad Hutchins

Yes, you can send whatever data you like via the WWW class. Eg, the other example on that page I linked to shows how you can send a PNG file to your server.

Jan 17 '10 at 07:14 PM duck ♦♦

Whether unity is a suitable platform for whatever RIA you're considering is another matter, however! :-)

Jan 17 '10 at 07:15 PM duck ♦♦
(comments are locked)
10|3000 characters needed characters left

games like tiger woods or fusion fall use .NET sockets to connect to other applications using TCP/UDP ports. for database connectivity you can use the above approach or use DB connectivity APis. then you can use ODBC to manipulate your database. take a look at these links database connection i think you can use many of the managed providers too but i did not test it. sockets the serverside script based approach is good in some situations if you know server side scripting languages well.

more ▼

answered Jan 17 '10 at 07:34 PM

Ashkan_gc gravatar image

Ashkan_gc
9.1k 33 56 117

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x814
x232

asked: Jan 17 '10 at 04:00 PM

Seen: 3239 times

Last Updated: Jan 17 '10 at 04:00 PM