Author Topic: Rudimentary Login/Registration  (Read 3785 times)

Kreag

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Rudimentary Login/Registration
« on: July 11, 2014, 05:33:47 PM »
I'm loving TNet so far (bought it 2 days ago).  I'm making what some would call an MMO, but it really isn't like WoW or anything like that.. more of a graphical representation of a MUSE/MUD.

1) So, if I added some custom packets for RegistrationRequest/Response and LoginRequest/Response and stored it in a lite database on the server side.  Would that slow down the whole server while it accessed the DB to read/write?  Or is it multi-threaded for each connection? 

2) If I wanted the server to do some lightweight spawning of things in a scene, is that something I can throw in the main loop somewhere? (I haven't looked at the server code enough yet to figure out where that might go)  I know that TNet is really meant to be a client controls everything type server, and for the most part that is fine with me for now (assuming I can figure out anti-cheating/authoritative stuff later)

I know this kind of thing isn't really designed into this product, but it really is lightweight stuff I want to do.  Even player tracking packets will only happen a couple times a second with lots of prediction code on the client side.

Thanks!

Kreag

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Rudimentary Login/Registration
« Reply #1 on: July 11, 2014, 05:54:26 PM »
Actually, I suppose for question 2, I could have the host player (first player in the scene usually I guess) spawn everything that needs to be spawned.  I'm sure I'll read this somewhere shortly, but how does a player know if they are the host player in a channel?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Rudimentary Login/Registration
« Reply #2 on: July 11, 2014, 07:30:23 PM »
1. Packet arrival is multi-threaded, but processing happens on one thread. So yes, it would effectively halt packet processing while this new packet is being handled.

2. Yes, but as you pointed out TNet ideally lets the host player do that instead. The server just forwards packets to the correct destination. There is no game logic. If you want game logic, I'd suggest spawning a thread for each channel or something similar.

Kreag

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Rudimentary Login/Registration
« Reply #3 on: July 12, 2014, 08:12:27 AM »
Thanks for the reply Aren!
Actually, couldn't I spawn a thread for database activity? Or even better, since I'm lazy, upgrade the server project to .net 4 and use the new Task stuff?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Rudimentary Login/Registration
« Reply #4 on: July 12, 2014, 04:55:19 PM »
If you are comfortable with making your app thread-safe, sure.