Author Topic: Server Spawning objects  (Read 2656 times)

Wuild

  • Guest
Server Spawning objects
« on: March 27, 2013, 01:47:59 PM »
Im trying to make a standalone server that will spawn objects in the game.
Is this even possible? or does the clients have to do all the spawning?

Example: Server spawns weapons that the players can pick up.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Server Spawning objects
« Reply #1 on: March 27, 2013, 08:30:41 PM »
Client marked as host should do the spawning. There is really no point in spawning anything if there are no players in the game anyway.

Wuild

  • Guest
Re: Server Spawning objects
« Reply #2 on: March 28, 2013, 06:53:50 AM »
So i can set a client as host even if i'm running the server on a standalone?

If so can i set the first player to join as host? and how do i detect this?

broknecho

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: Server Spawning objects
« Reply #3 on: March 28, 2013, 10:19:44 AM »
The first person to join a channel is automatically set as the Host.  You test this by using:

  1. if(TNManager.isHosting)
  2. {
  3.     //Do hosting Stuff
  4. }

If that person leaves the channel, someone else in the channel with become the "Host" and then that IF statement will start working from their client.  I quoted "Host" because it's still really just a client.  It just has a kind of authority given based on the isHosting being set to true.

Your standalone server is more of a message relayer if that makes sense.