Author Topic: Pooling issue - Objects that are not instantiated .. must have a non-zero ID  (Read 3364 times)

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Hi,

i have a new problem.
I set up a own pooling system for game, and im trying to Create on the Hosting side the objects. (with TNManager.Create...)
In this sample i have 9k trees, we plan more trees in the future.

And if i start my server, i got this error Objects that are not instantiated via TNManager.Create must have a non-zero ID.
I can't look into the Unity window, if the trees got an ID or not, because the Unity Editor is hanging and i cant press anything on it.

Sometimes it works, sometimes not. Why? Is there any solution to solve this problem?

And i have issues with TNManager.Ping, it doesnt give me an feedback.

My code looks like this:

  1. TNManager.Ping(data.ServerEntry.externalAddress, GotPing);
  2.  
  3. private void GotPing(IPEndPoint ip, int milliSeconds)
  4. {
  5.     Debug.Log("ms" + milliSeconds);
  6.     Latency.Text = milliSeconds + " ms";
  7. }
  8.  
« Last Edit: June 24, 2014, 02:19:31 AM by Rexima »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
The ping is because I never added the handling for it to the UDP lobby server. Open TNUdpLobbyClient.cs, line 121 (inside the 'case' statement of the ProcessPacket function) and add the handling for the Ping packet:
  1. case Packet.RequestPing:
  2. {
  3.         BeginSend(Packet.ResponsePing);
  4.         EndSend(ip);
  5.         break;
  6. }
Note that you should also modify the TNGameClient's Ping() function on line 655:
  1.         public void Ping (IPEndPoint udpEndPoint, OnPing callback)
  2.         {
  3.                 onPing = callback;
  4.                 mPingTime = DateTime.Now.Ticks / 10000; // <-- this was missing
  5.                 BeginSend(Packet.RequestPing);
  6.                 EndSend(udpEndPoint);
  7.         }
As for the "objects not instantiated" message... why do your 9k trees all have a TNObject script attached? Remove it. TNObject should only be attached to what actually needs it. The error message is telling you that you are using Object.Instantiate instead of TNManager.Create, and happen to be creating an object that has a TNObject script attached. Since this TNObject does not have a unique ID, TNet won't know which one of your 9000 trees is supposed to be receiving messages. Objects shouldn't share TNObjet IDs.

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
The ping is because I never added the handling for it to the UDP lobby server. Open TNUdpLobbyClient.cs, line 121 (inside the 'case' statement of the ProcessPacket function) and add the handling for the Ping packet:
  1. case Packet.RequestPing:
  2. {
  3.         BeginSend(Packet.ResponsePing);
  4.         EndSend(ip);
  5.         break;
  6. }
You mean the TNUdpLobbyServer.cs, right? Because, i cant find any case statement on TNUdpLobbyClient.cs.
And the TNTcpLobbyServer.cs doesnt have this lines, too.

Note that you should also modify the TNGameClient's Ping() function on line 655:
  1.         public void Ping (IPEndPoint udpEndPoint, OnPing callback)
  2.         {
  3.                 onPing = callback;
  4.                 mPingTime = DateTime.Now.Ticks / 10000; // <-- this was missing
  5.                 BeginSend(Packet.RequestPing);
  6.                 EndSend(udpEndPoint);
  7.         }
I added this line, but i dont receive any ping from the external GameServer.

I also active your disabled Packet.ResponsePing Debug Logs, to see if i got an response, but nothing.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Yes, I meant the server, sorry. Might be easier if I just send you the latest TNet scripts as I've been making other modifications. Get in touch with me via email (support at tasharen.com) with your OR#, I'll hook you up with the latest beta.

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Thank you, i wrote you an email :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I'm not seeing one?

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Mh strange, i send an new mail.

Here is the delivery report:

  1. X-Postfix-Queue-ID: 9BFB03226B2
  2. X-Postfix-Sender: rfc822; drumstein@gentleforge.de
  3. Arrival-Date: Wed, 25 Jun 2014 16:31:02 +0200 (CEST)
  4. Final-Recipient: rfc822; support aat tasharen.com
  5. Original-Recipient: rfc822;support aat tasharen.com
  6. Action: relayed
  7. Status: 2.0.0
  8. Remote-MTA: dns; tasharen.com
  9. Diagnostic-Code: smtp; 250 OK id=1WzoE3-00071L-I2
(I replaced the @)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Nevermind, I already responded later that evening.