Server side programming

zoultrex
zoultrex
edited July 2010 in Photon Server
I need to make some basic npcs in my game.
Where exactly I need to code the the npc in the server side. I know that in the client side i will follow the same idea as the players, i mean, to check the players array and spawn them if they are not there already.

Is there any NPC programming done in any of the examples that is available to download?

Comments

  • What kind of game do you build?
    Is your current server based on the MMO demo or on Lite?
  • There is some very basic npc programming but not server side. Instead in the Mmo example - dotnet client you can spawn bots which in this case then are client updated.

    but the same logic should very well apply also on the server side, the primary thing you would have to do is introduce an NPC Manager that handles the recurring "thinking" and movement planning
  • Boris wrote:
    What kind of game do you build?
    Is your current server based on the MMO demo or on Lite?

    Im planning to do that using the last island demo:
    ExitGames-Photon-MMO-Demo_v2-0-2-RC5\src\Photon.MmoDemo.Client.UnityIsland
    Because that is the closest version of the new photon comming out so Id like to stick with that.
    dreamora wrote:
    There is some very basic npc programming but not server side. Instead in the Mmo example - dotnet client you can spawn bots which in this case then are client updated.

    but the same logic should very well apply also on the server side, the primary thing you would have to do is introduce an NPC Manager that handles the recurring "thinking" and movement planning

    Thats the idea... I wanna keep it simple for now, something like, create a bot when the server starts, and be able to see the bot as soon as someone connects for the first time.
    If i know where to code only that id be able to do the AI and all the rest.
    Its just that I have no idea where to start coding the class to manage this, and when I say where I mean, if I open the server SRC where should I start coding. BTW: the server im running is: ExitGames-Photon-Server-SDK_v2-0-1-RC4\deploy\bin_Win32

    What I think I get so far is that I believe that unity demo is running the mmo demo, so I opened PhotonSocketServer.xml and found:
    <!-- MMO Demo Application -->
    <Application
    Name="MmoDemo"
    BaseDirectory="MmoDemo"
    Assembly="Photon.MmoDemo.Server"
    Type="Photon.MmoDemo.Server.PhotonApplication">
    </Application>

    I see that in my server sdk, there is a MmoDemo folder and there a src folder with the files,
    I believe the file that the server logic is programmed is: Photon.MmoDemo.Server.dll right? :?:
    So I think that I should find the server source for that compiled MmoDemo project(god i hope im on the rick track at this point :P) so here I go to the src-server folder inside the server SDK, But once I get there I could only find the folling folders:
    CounterPublisher
    Lite
    LiteLobby
    Policy

    If so far im right, that means that With that current version of the sdk I have I wont be able to do any server side programming as I want because the source files for the application that the unit demo is running(MmoDemo) Is not there...?
  • Download ExitGames-Photon-MMO-Demo_v2-0-2-RC5.zip at http://exitgames.com/Download/Photon

    To add NPCs you can create items with or without an interest area, depending on how smart you want it to be.

    Mmh. just noticed you already have the island demo. The server source is in that very same zip file where you got the island demo.
    Open the Photon.Mmo.sln in the src folder.
  • Boris wrote:
    Open the Photon.Mmo.sln in the src folder.

    So inside Visual studio the assembly I have to work with is: Photon.MmoDemo.Server
    projss.jpg

    Uploaded with ImageShack.us

    And then after I build the assembly, its bin folder is where I get the new application server files to replace what I currently have running?
    So from the new build bin folder, to my current photon server, MmoDemo/Bin folder?

    BTW thank you so much for the fast responses. This kind of great support is one of the reasons I choose Photon for my game =)
  • Correct, you can either copy the bin folder to Photon or copy photon into the mmo directory and adjust the application path in the config file.
  • Awesome =)
    Thank you guys!

    I might be back later with more questions, lol :P
  • Hi all

    I have been looking in the internet for more information on server side programming and i think i still dont get the basic concept of the autonomous control of the server-side objects and entities.

    Unfortunately there is few information about these details on the internet, rather people often post general ideas of the concept and not an actual example in most cases. The only few examples I was able to find were extremely outdated, most of them dating back to the AoE 1 and Quake =(

    If you have any advice on a recommended reading please do, I will happily check it :lol:

    Oh and one thing im in particular trying to understand and that wasnt able to find yet, its where am I going to code my npcs that will be controlled by the server and other things that will be there doing their business even if there is no one connected.

    Is it correct to say that I will have to create that in unity and run a kind of "unity server controller application"(just like the game client but with a special login like a game master does) that will be running alone alongside with the server in the same machine and that this unity-server-controller is the one that will spawn the npcs and deal with their autonomous behaviour?

    I found out many people having this same doubt in the internet as me.
    In counter to my last idea of the unity-sever-controller, i found out in the Unreal forums that they actually do (or used to do) it all in the same game application, except that one will be the dedicated server, but all the code is built in the same .exe application.
    I know that this is not totally possible using photon as it is an application separate from the game.

    So with that in mind, can I say that i could use photon really only to send and receive data and let it manage only data transmission and events related tasks and then all that is interactive like npcs, game objects, and entities (all that is interactive with the player, or have an autonomous behavior) should be coded inside unity and then it would also connect to the server to manage those player-independent events and features of the game?


    ..sorry about the huge post, i think more people will find it useful :D
  • where you run such code is totally up to you. you could do it all in your photon server code actually and I don't see a reason why you wouldn't do it.

    but it heavily depends on if you are willing to create a fullscale mmo server backend that especially is able to do collision checks and path finding with navmesh etc
  • I will make 2 games that will use the same basic idea.

    One will be a Real Time Action Space Shooter, so in this one, positioning will be 100% of my concerns, positioning i mean the ships and the laser projectiles.

    The other one will be another Real Time Action but Fighting style, so positioning will also be a high priority followed by collisions.

    I dont plan to start messing up with collisions just yet, i might even not have to at all depending on the outcome of the game run, if it will be smooth enough and accurate enough which I really hope so.

    In the case that its up to me to decide where the Arbitration will be I would prefer in a Unity Client acting as a second server running alongside with photon but just because it would be easier for me to code.

    But then I get concerned with performance, since I imagine that the Unity Client acting as a server would be like a proxy/peer connected to the server and it would be increasing traffic from photon to itself and then back to photon.
    I think it makes a lot of sense to say that If I code all that in photon it would be much faster.

    In regards to where the scale of my game will go, im not too sure because I cannot say that I have any expectations of a certain number of players, its really hard for me to predict that.
    But the network design would be that the player would open the game and look for rooms to play, those rooms would have a number of players that I cannot say as I havent tested to know at what point it would start to be too much, but, as much as close to 70 or 100 at the same time per room would be great.

    If I implement the Unity Client Server approach, would it mean that I will need one client for each room?
    I ask that because Im not sure how one this one Unity Client Server Arbitrator would "broadcast in-and-out" data from all the different rooms.

    I guess it would be in a way simpler to code it to the server, its just not as easy to do server side programming for me, but I guess it would be the best idea anyway, and in regard to that, im not sure how to start doing npcs and game events programming in photon source codes, also things like, match timing, and game overs and stuff like that.