Author Topic: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread  (Read 10291 times)

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« on: January 13, 2015, 11:07:56 AM »
Hi Guys

I want to use this Thread for the upcoming Problems relating to my Project. I will shortly explain what i want to do, and then add the Questions that will come up.

I want this Game to be a persistent Online World. You have a Spaceship with Cargo and Upgrade Slots. The first Level is the inner Solar System with the Sun in the
middle, and the Planets Mercury,Venus,Earth and Mars. The Scale is 1:10000, 1Unity Unit=1km. I will Add the Astoeroid Belt and Jupiter Later. After Jupiter the Level
will end because Jupiter is about 778Mio km away from the Sun and i found out that everything with more than 100000 Unity units will not work properly in the Editor.
(So Jupiters Position will be at about 77000 UUnits).
The Game will have Space Stations too, so you can fight, mine Asteroids, trade, and maybe produce Items (as Upgrades for the ships).
I use Unity 5 beta18 and i have installes NGUI,Tnet and the SGSK i got from from Michael.
I have a rented Virtual Server with a fixed IP and the important ports open where the Server Programm runs.

So far the Core functionally works. But now i have 2 Questions:

(Solved) 1. When i login with two Payers every Player can see the "target cross" of the other Player. See the Picture inclusive the found Solution:

http://www.equilibrium-games.de/Showcase/showcase.html

(Maybe Solved) 2. When i open the Projekt i get Error Messages. They dont seem to do any harm, but maybe someone could tell me how to get rid of them:

http://www.equilibrium-games.de/Showcase/showcase.html

I intend to contine showing the Problems and the Solutions that i have with my Project, so others Beginners like me can learn too.

Thats it for now. Any Help would be greatly appreciated.

regards, Michael
« Last Edit: January 16, 2015, 07:14:19 AM by Equilibrium »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #1 on: January 14, 2015, 10:30:55 PM »
Errors happen because you are using an orthographic UI camera. It doesn't play well with the refractive atlas shader.

Multiple targets -- you need to check tno.isMine before creating the target reticle. You've got both clients creating them.

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #2 on: January 15, 2015, 09:03:49 AM »
The Camera is Perspective, so this cant be it. Any other Idea?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #3 on: January 15, 2015, 09:12:08 PM »
There are several cameras used by SGSK. Which one did you check? Also, your game view seems to be hidden... did you try making sure it's visible, instead of hiding it behind your scene view?
« Last Edit: January 18, 2015, 04:40:13 AM by ArenMook »

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #4 on: January 16, 2015, 07:21:58 AM »
I checked every Camera in the Game. In the Welcome Level is one Perpective Camera, and in the Game Level there is only one ortographic. I changed that to Perspective but that didnt change anything. My last try was a change in the NguiTools Script. I just deleted some code (see at Showcase on the Website). The Error Messages disappeared, but i am unsure if this will lead to later problems. I really have no clue about NGUI, i just purchased it so the T-Net SGSK Version can run.

My Game View is on the Second Monitor. I cut it out for the Sreenshots.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #5 on: January 18, 2015, 04:44:39 AM »
That code is used to calculate the screen dimensions and it runs if the camera is not orthographic, so some perspective camera is giving you this issue, likely because the UI is located outside of the camera's frustum. You need to move the UI camera so that it's actually able to see the UI.

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #6 on: January 20, 2015, 07:40:01 AM »
Now I am relatively sure that this is a Problem with Unity 5.2. The Menu fits automaticly the Screen of the Camera. There is nothing to try out left i would know of.
I turned the Code Block back on and decided to life with the Messages.

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #7 on: January 27, 2015, 04:49:13 AM »
Hi

First i have to say that the Combo of the 3 Assets was the right choice to work with. I am making progress and there where no more Problems with these packages.
The next Step in my Project is a real big one and i will need help for this: Making the Online World and the Players persistent. So now my questions:

1. The Standalone Server - what exactly does it save? I have two kinds of Objects. The First ones have a fixed ID (That would be the Planets, and Space Station).
The others are instanciated and became a ID automaticly (The Players, and in my case a spawned Asteroid Field)
I understand that the Transform of any Object is saved. But what if the Hosting client disconnects? Is anything set back to zero then?
That brings me to Question 2:

2. What does the persistent flag in the TNManager do? Am i right that this means that a client (that is the Host because it is the first one entering the Channel)
that have that flag set will set my planets and the Standalone Server will save all Transforms? But what happens when this client disconnects?
Every other Client would normally generate the world again. Does it mean that in that case the Stanalone Server would be setting the Transforms, even if the hosting
client is disconnected and another client/host connects?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #8 on: January 28, 2015, 02:52:03 AM »
The server will save anything that was marked as persistent.

For it to save, the channel must be joined with the persistent flag enabled. After that, any and objects created through TNManager.Create will persist, assuming you passed 'true' for the "persist" parameter. Likewise, all objects destroyed via TNManager.Destroy will be removed. All RFCs marked as "saved" will also be saved. So tno.Send("SomeCall", Target.AllSaved) will be saved, but tno.Send("SomeCall", Target.All) will not be.

When you will rejoin the channel, all the created objects will be sent to you (you will receive all the create calls), followed by all the RFCs that were saved. You will then receive OnNetworkJoinChannel at the end -- which you should then use as the "everything is in place, create the player avatar" signal. Player avatar is generally the only thing that should not be created with a persistent flag so that the avatar gets automatically removed when the player leaves.

You're seeing transform changes saved likely because you have TNSyncRigidbody or something similar attached.

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #9 on: February 02, 2015, 09:29:45 AM »
Hi

I just tryed to extend my Solar System with Neptun as the farest Planet. Its position is 4497000 away from 0,0,0. (1m=1UnityUnit=1tkm ingame)
I started the Spaceship and fly to try out what happens on the Way.

Everything worked just fine, but the Spaceship began to flicker, and it got worse with the raising distance.
The Flicker is caused by two things:
1.The Directional Light that is the Sun in the Game and thats scripted to always Face the Camera.
2.The Position of the Ship loose its precision. It appears in Random Positions around its original Position. (Thats why i call it "Flicker")

I already read in several Forums that this is a Problem with the float precision.

Has anyone an Idea how i can reduce this effect?

Edit: I divided the distance by 10 and turned off the Shadows of the Directional Light (Its better for 3D Vision anyway)
       I can live with the results, but the Spaceship still flickers at great Distance or/and high Speed. It moves forward and back even at low speed if it reaches Neptun.
       If i dont find a solution, i will just add nothing to Neptun so the Players can Travel there, but wont do it often because there will nothing happen.

Anyway...has someone an Idea how to reduce the Spaceship flickering?

 

 
« Last Edit: February 02, 2015, 10:51:25 AM by Equilibrium »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #10 on: February 03, 2015, 11:22:52 AM »
You can't use Unity for such long distances natively. You need to find a way to split up your space.

What Kerbal Space Program does is it moves the player ship once it passes a certain mark -- for example once the position exceeds 3000 in any direction, snap it back to 0.

There are pitfalls of this approach -- particles from particle emitters need to be adjusted as well, and it's not possible unless you are using Shuriken particles. This is why Kerbal Space Program's particles snap to appear in front of the rocket on frequent basis.

What I also suggest doing is splitting up your entire world into segments using different layers and different cameras. For example in SGSK there are two distinct layers: distant objects, and the default ones. Distant objects are used to draw planets, and they move a lot slower than regular objects to create the illusion of them being bigger when in fact they are not. Take this a few steps farther. Reposition your ship like KSP does, but every time you reposition also update some higher value, for example distance in AU units, and use different cameras to draw things: distant camera, far camera, near camera. Distant camera can be used to drawn planets, then you'll have your far camera to draw your ships that are several thousand units away, then the near camera to draw things < 3000 units away.

When using Unity you need to find creative ways to eliminate going beyond ~3000 units due to floating point issues.

Equilibrium

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Equilibrium5 (SGSK,TNet,NGUI Project) Help Thread
« Reply #11 on: February 03, 2015, 12:22:56 PM »
I was aware of that approach, but i wanted to avoid that. The Reason is the Oculus Rift. I have the DK2 and always wanted to be able to use my Game with 3D Vision and the Rift.
At this point i was never able to work with more than one Camera, because i couldnt figure out how to implement more than one Rift Camera...

I think i have to make a few new fundamental Decisions about the Game... :(

But thanks!