Search Unity

Web Player Questions

Discussion in 'General Discussion' started by dingosmoov, Apr 21, 2006.

  1. dingosmoov

    dingosmoov

    Joined:
    Jul 12, 2005
    Posts:
    559
    First let me say, you guys are doing a great job on creating the new Web Players. I currently have Unity Indie, and the web player is a great reason to upgrade.

    I have been looking at the best ways to sell/distribute unity games. I was looking at numerous shareware solutions, but I believe the webplayer may solve many issues for independent developers.

    My plan is to offer a subscription or micropayment service that allows a user to login to a secure website to play a game. This will also allow me to control a "trial period" for the game by limiting a login, and redirecting to purchase page.

    I have a couple questions regarding the web player:

    1. How is the game in the web player protected from being viewed offline?

    2. Is it possible to make the game have to communicate with a server in order to play?

    3. Can game saves occur from the web player to a server?

    I'm sure I will have many more questions but thought I would at least ask those.

    Is anyone else working on a similar strategy?

    dingo
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    There are 3 common ways web players might get pirated

    1. A Unity Web Player file is downloaded, extracted and played back in a standalone player.

    2. A Unity Web Player file is embedded in a html page on the crackers web site but it links to your page. This is especially bad because you have to pay for the bandwidth.

    3. A web player is copied to the crackers web site and used from there.


    All of those can be circumvented by using the following two functions:

    Application.srcPath is the src tag in the html file eg. (src="cargame.unityweb")

    Application.dataPath is the absolute path from where the data file was downloaded eg. "www.otee.dk/cargame.unityweb"

    In your game code you simply need to make sure that the data path is still at the location you intended it to be and the src file is relative to it and not an absolute path.

    Code (csharp):
    1.  
    2. if (Application.srcPath != "cargame.unityweb")
    3.     DoSomethingBadToTheGame();
    4.  
    5. if (Application.dataPath != "http://www.otee.dk/cargame.unityweb")
    6.     DoSomethingBadToTheGame();
    7.  
    Note that srcPath does not exist yet but will be added when we release the Windows Web Player.

    You can use the WWW interface for this.
     
  3. dingosmoov

    dingosmoov

    Joined:
    Jul 12, 2005
    Posts:
    559
    Joachim, that is exactly what I was looking for. You guys are great!

    Seriously this answers so many issues regarding distribution. At least for me. For trial versions and capturing user data this is definitely a big PLUS for independent developers. Heck I could see someone :) developing a portal for Unity Developers to sell playtime with their games.

    Could use micropayments to create an online arcade.

    Can anyone else think of other things to consider in that scenario?

    On a different note: What limitations, if any, are there in using the web player than a standalone?
     
  4. mjjw

    mjjw

    Joined:
    Nov 12, 2005
    Posts:
    59
    Application.dataPath appears to be blank when running from the webplayer? Which would appear to be correct according to the manual.

    Is there any way for the web player to know where it was run from?

    I need to get URL's relative to the location of the webplayer (which could be in one of several places - so I can't hard code it). Any suggestions?
     
  5. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    This feature is missing, but will be coming in an upcoming release.

    d.
     
  6. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    I don't know what all is possible as far as browser-to-webplayer communications, but could some scripting on the HTML page be used to inform the Unity player of its location? As a workaround for now?
     
  7. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    That's not even possible right now. So many things can be worked around, but in this case I can't think of one.

    ...

    Well, ... of coures if you really want it, right now, there's always the crazy options like making a server side script which modifies the .unityWeb file on the fly depending on the URL used. Or simply making multiple builds to put at the different URLs (possibly using Apache redirection/mod_rewite to control which one gets sent).

    But you could also wait for it to come in an upcoming release.

    d.
     
  8. greenland

    greenland

    Joined:
    Oct 22, 2005
    Posts:
    205
    I'm working on developing a sort of abstraction layer to synchronize variables in unity with that of a remote server using .net sockets to a java tool that plugs into a mysql database. :D

    If I ever finish it, I'll post the code.
     
  9. mjjw

    mjjw

    Joined:
    Nov 12, 2005
    Posts:
    59
    On an almost similar topic, is it possible for Unity to launch a browser? E.g. I want the script to launch Safari/IE with a specific URL?
     
  10. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    Only in the standalone as of now. In a pinch you could use AJAX over a server to communicate between Unity and the webpage, in which case you could get it to work.

    d.
     
  11. mjjw

    mjjw

    Joined:
    Nov 12, 2005
    Posts:
    59
    Can I wishlist this function for a future version please? When making demos it is extremely useful to be able to have the user click an in-game link and be redirected to a website to purchase the full game.
     
  12. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Absolutely. Unity 1.6 will have support for communicating with the container website and of course a function to open another browser page.
     
  13. dingosmoov

    dingosmoov

    Joined:
    Jul 12, 2005
    Posts:
    559
    Currently when the web player crashes, a dialog box appears in which you can add a statement, and then send a log/message directly back to OTEE.

    Is it possible for the dialog to be customized or adjusted to send crash messages back to us?

    Is that crash dialog only available while the webplayer is in beta or will it come up if peoples shipped webgames crash?

    If that dialog comes up and users send back crash reports to OTEE will/can that data be forwarded back to publisher?

    Can it be implemented if individual studios games crash, could that help in figuring out an actual gameplay bug?

    For example, lets say I create a game and release that game as a webplayer(without Unity loading logo). Then it crashes. What will the user see? If a crash report is generated will the data be forwarded back to me? Just in case there is something on my end that I can do to help it not to crash?

    I hope I am asking this correctly, and I don't want to infer that it will always crash, just trying to think of all angles when using the webplayer to release a game.
     
  14. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Basically, if it crashes it's our problem. No matter what possibly stupid things you do in the game code, it should never ever crash. So the only situations where it does, is a bug in Unity, or video drivers (that we have to work around), or the browser (that we have to work around) etc.