Author Topic: Setting up and spawning a player  (Read 13556 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting up and spawning a player
« Reply #30 on: May 07, 2013, 05:06:34 AM »
SQL would be on the server-side, so how would cheaters have access to that? You are mixing the terms "host" and "server" I think.

Server is a stand-alone application you connect to. It has no knowledge of Unity, or your game.

Host is just another player. Only one player per channel is designated a "host".

Braveheart

  • Guest
Re: Setting up and spawning a player
« Reply #31 on: May 07, 2013, 05:34:58 AM »
I know that. You advised I keep variables in memory do you mean for example a static variable? If storing stuff in memory as opposed to SQL and requesting it wouldn't a hacker be able to modify the static variables?

Yeah I know the difference. Seeing how the host is another player processing everything that is required to play, will having a lot of additional processes and validation (AI, shooting, SQL updates etc) affect the host player's performance?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting up and spawning a player
« Reply #32 on: May 07, 2013, 04:08:16 PM »
Any variable you have is stored in memory. It has nothing to do with being static. If you have a custom SQL manager, you can have it query the database in the beginning, getting all the entries back. Use these entries to create your own table in memory (just an array or dictionary of structs), and from that point onward consult this table rather than executing queries. This should only be done on the server -- which is inaccessible from hackers.

Braveheart

  • Guest
Re: Setting up and spawning a player
« Reply #33 on: May 08, 2013, 04:12:38 PM »
Thanks Aren. Could you explain in a little more depth how I would use tno.isMine etc inside of a JavaScript script? I don't own NGUI so I don't know what you meant by place them into the Plugins folder.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting up and spawning a player
« Reply #34 on: May 08, 2013, 05:05:24 PM »
http://www.tasharen.com/forum/index.php?topic=6.0 has a picture. With TNet the idea is the same. Everything except the Editor folder should be moved into the Plugins folder. This makes all C# classes accessible from JS.

Braveheart

  • Guest
Re: Setting up and spawning a player
« Reply #35 on: May 08, 2013, 07:16:42 PM »
Thanks again, got it all working!

I'm still having issues with choppy movement and slight delays in RFCs (both send and sendQuickly) though, even playing locally movement is extremely choppy... any further assistance you can offer? Strangely, using Unity's own networking the same code has no choppy movement.
« Last Edit: May 08, 2013, 07:21:48 PM by Braveheart »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting up and spawning a player
« Reply #36 on: May 08, 2013, 07:53:24 PM »
Depends on how you send your data. It's best to send sync updates infrequently, and to separate renderer from collider. Look at what I did with the second example -- boxes there have their renderer lag behind and smoothly follow the immediately updated collider.

Braveheart

  • Guest
Re: Setting up and spawning a player
« Reply #37 on: May 09, 2013, 07:11:10 PM »
Does that technique only work for rigidbodies?

I'm getting an odd error - TNet is telling me it can't sent a function and asking if I may have missed an RFC. The thing is, the function it's talking about I removed from my code ages ago but it's still throwing the error and causing my movement script to stop working.  I've tried using an entirely different player prefab which never included the offending code and still I'm getting an error about it. Any ideas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting up and spawning a player
« Reply #38 on: May 09, 2013, 11:47:35 PM »
Was it a persistent function, used in a persistent channel? Delete server.dat file.

Braveheart

  • Guest
Re: Setting up and spawning a player
« Reply #39 on: May 10, 2013, 05:56:02 AM »
Of course! Yes it was, thanks Aren.