FloatBouncer.cs: Allows you to easily move between two values and check what the current value is, or what the percentage is.
TimeBouncer.cs: Allows you to easily use Time.deltaTime to move between two values over a period of time. You tell it when you want it move to the top or the bottom. Has plenty of events to listen for that make using it easy.
I’m using these to make things fade out over time, or appear at intervals.
I’ve done similar things in the past and I’m sure many others have as well, but I wanted to share an approach I’m taking so far for a multiple level based VR game.
Basically I have something that looks like this in each of my scenes.
When it starts, the Singleton is marked to not be destroyed.
The Game.cs is where I access my references from, which is created each time a scene is. I keep references in there to the GameSingleton references for convenience. If I want an object that will only be created 1 time in my game, I add it to the Awake method in GameSingleton. If I want something created each time a scene starts, I add it to Game.
It uses More Effective Coroutines [FREE] as well as VRTK. If you want to get these scripts running but don’t want MEC[F], then you should be able to refactor those out with some effort.
I’ve updated my Unity3D asset, Third Person Camera(s) to have better GUI interaction when using the cursor and to have rotation smoothing on input values. Both are easy to setup and adjust by going to the Input component on any controller and the GUI interaction portions of any controller.
I’m working on an asset to help make Unity network all around easier for the common man. Here’s a preview of some of the static functions I’ve made to help with that.
Generic object types
In this picture you’ll notice generic object types that can be passed. The generic types have to extend Unity’s MessageBase class (T : MessageBase in enforced, but the collapsing is hiding it). To use those generic functions, you need to map the class Type to a MsgType short in an abstract dictionary you are required to implement (though you can leave it empty or NotImplementedException if you don’t intend to use those functions). The advantage is that you could say what MsgType a class refers to and then not have to say what type you are sending every time you call the method.
Channel Id mappings and overrides
You’ll also notice “channelIdOverride = -1″. If you set this to a 0 or greater value, it will override the default channel it sends the message on. Just like with the generic type function, there are abstract dictionary<short, int>s where you can specify what MsgType you want to map to what channel. If you don’t provide an override and you also don’t have an entry in the dictionary, it defaults to channel 0 which is the default reliable channel. That is also Unity’s default functionality as well.
Things this asset has that are not default
So far the big win here is an easy to use implementation of Client -> Client and Client -> All Clients. Unity doesn’t offer that by default since all messages need to go through the server with UNet. They still do in my implementation, but behind the scenes I’ve rerouted those messages from the server to where you want them to go in an easy way.
I also provide a unique and easily accessible Player Id for all players. This can be used to send people messages (as you can see here you need a player id to send to specific players) or to disconnect individual players.
Things to come
Easy to use object spawning, including being able to request objects to spawn from a client. By default, only the server can spawn objects.
Decided to come up with a simple approach to dealing with networking.
What I want:
I want to be able to send messages to all clients from any client in a static manner from anywhere anytime
What I came up with:
Probably wanna open that in another tab. Note: NetworkHub is my class I’m extending
Basically it consists of a Networking behaviour that:
* A class behaviour that you can spawn 1 of for a player over the network using Unity’s UNet *
To use it, just extend the base and setup the abstract methods *
Gives every player a unique integer ID to identify you by *
Gives you a single point to send networking messages to every other client. Can send anything that can be written as a byte[]. *
OnPlayerConnected/Disconnected that every client can use (normally only the server gets those events) *
You can still use UNet however you want, this just gives you an additional thing you can use
The usage for me is “Send a message, it gets routed based off an ‘type’ to a handler that processes it. This way you could have say a ‘debug handler’ and a ‘play sound handler’ which could do whatever they wanted independently.” It’s generic enough with interfaces though that you can be it less complex than that.
Still have some more stuff to add and optimize, but I’ll likely put this on the Asset Store for a few dollars.
Here is the performance of some rooms being rendered using combined meshes and individual blocks.
I generated 100x100 rooms and tried to look at them (which took forever to load). After a few moments with the combined rooms, it levels out to what you see there. The individual blocks remained at 3~ FPS.
The room has like 3-5 textures in it or something. This isn’t meant to be an in depth performance analysis. I just wanna show how extreme the difference is.
Edit: Someone pointed out the texture issue in the pic. I fixed it and tested again, and the same performance was seen. Didn’t take pics tho.
Testing the scale of the environment. Trying to get the feel right so no where feels too massive or too small. Don’t want claustrophobia. Using my Third Person Camera(s) asset which I’ll be updating soon with a few improvements based on my recent testing. Also using a crummy character controller I whipped together quickly. I have a better one lying around somewhere, but I gotta find it.
This asset lets you add some protection to your game to prevent memory manipulation, like you can do with Cheat Engine or other software. So if you are afraid of users editing their scores to be higher, this can help prevent that.
Here are some videos
Are there alternatives on the Asset Store to this?
Yes, and they are more expensive. That’s why I made this. Other options cost like 30$ and they all do the exact same thing with the same performance anyway since there’s really only so many ways to protect your memory from being manipulated.
I’ve decided to build the parts I wanted for my game. That is, protecting memory from cheating, protecting against speed hacking, and protecting playerprefs and extending it.
Here’s another video of speed hacking being detected
An Event System for Unity3D that does a lot of heavy lifting for you. Has both simple and complex functionality that can give you a lot of control when needed over how events are fired.
It also fires events automatically for you, which is a feature that other Event Systems do not have. Events can be normal manually broadcasted Events, or be more advanced automatically triggered Events.
Here’s a video going over a minigame made using it
I’ve updated the Unity3D asset, Third Person Camera(s) to have a simple to use implementation of Smart Follow from World of Warcraft on the Basic Camera Controller.
You can see me demoing off some features here. I forgot to demo the “Only rotate when mouse locked” feature in this video.