• Nenhum resultado encontrado

Creating a chat room using Unity Game Development Tool

N/A
N/A
Protected

Academic year: 2023

Share "Creating a chat room using Unity Game Development Tool"

Copied!
40
0
0

Texto

Therefore, creating a chat room using Unity was an excellent opportunity to create something useful while learning the basics of Unity multiplayer programming. In the fourth chapter there is some information about data communication to help with the terms used and an introduction to a chat room service. The sixth and seventh chapters consist of the supplementary appendices and the sources used.

It does not include creating a game for this chat room service, as that would double or triple the software development time. This chat room service does not include support for third-party servers, because this is not the first step I need to take when exploring the network capabilities of Unity. Wikipedia was chosen because it has up-to-date basic information on the topics and it was not desired to fill this thesis with technical specifications and standards.

The sixth and the seventh chapters consist of the additional appendices and the sources used.

History of Unity

Developers Conference (Unite) in November, which allows Unity developers to sell their assets to other Unity developers. During this conference, a new unit called Union in Unity Technologies was created that helps Unity games reach a wider audience. (Seyler 2010.) (Unity homepage 2011.) In 2010, Unity Technologies won many awards and recognitions. Just to name a few, they won the Wall Street Journal's "Technology Innovation Award" and Develop Magazine's "Grand Prix Award".

Licensing

Currently, Unity has many large companies as registered users, such as Cartoon Network, Disney, Microsoft, Coca-Cola, NASA, and LEGO. Other licenses, such as educational or game console licenses, must be negotiated with Unity sales representatives.

Rendering

Other licenses, such as educational or game console licenses, must be negotiated with Unity sales representatives. which must be visible regardless of current lightning, e.g. power-ups or collectibles such as coins. Unity offers great scalability for high-level shaders, so they run well even on the lower-end hardware. This is further aided by graphics emulation of the Unity editor under development to simplify testing.

Unity uses batching to minimize draw calls by automatically batching geometry and uses a custom GLSL (OpenGL Shading Language) optimizer developed for Unity to double or even triple the fill rate. Perhaps the most significant enhancement is Occlusion Culling, which was developed for Unity by Umbra Software. It is used to render only those objects that are visible to the camera and therefore necessary, for example, hundreds of crates are not drawn if they are behind a wall.

Unity also includes Frustum Culling, which limits the rendering of objects to those objects that are visible in the camera's field of view, i.e. objects behind the camera are not drawn.

Lightning

Unity Pro includes a Screen Space Ambient Occlusion (SSAO) visual effect that makes the game look much better by darkening creases, holes and surfaces that are in close proximity. As real-time shadows, this image effect is expensive to compute, although Unity 3.0's Deferred Lightning minimizes the performance drop due to this effect. The operation of this image effect depends on the screen resolution and the given SSAO parameters.

In addition to SSAO Unity contains over twenty other image effect filters which are included in the Unity Pro license. Noise on the other hand can be used for example in horror games to create a more intense atmosphere. Since Unity 3.0 supports the creation of light maps, developers do not have to do this within the 3D modeling software.

This makes the lightmap look much better, as it integrates the main character well into the environments, for example.

Terrains

Unity's light mapping supports dual lightmap which means that one lightmap is used for distant objects and the other contains only reflected light. In addition to creating just the land mass for one's games, Unity has the tools to create the vegetation, including trees, bushes, and grass. One can paint it on site with a variety of different brushes just like when modifying the site itself.

Unity optimizes these trees and bushes when they are far away by making them tables that look like 3d objects, although in reality they are 2d sprites. This tool is great for creating lush forests or jungles with many different looking trees. Trees created with this tool can be used either as standard game objects or integrated into the terrain engine.

Physics

To create a ragdoll, simply import a 3D package file that includes sheets of mesh and open the wizard to assign body parts. With the cloth function, it is possible to optimize the clothes worn by the game characters and make them physically accurate.

Audio

It is possible to edit basic things like the pitch of the sound, whether the sound should be repeated and the priority of the sound if the sound channels are limited and the volume. Furthermore, there are 3D sound settings in which one can edit the pan level, spread, Doppler level and distances and set the roll-off damping curve. In Unity Pro one can use built-in audio filters, including low pass, high pass, echo filter, distortion filter, reverb and chorus.

Audio in Unity is provided by FMOD which is a proprietary audio library from Firelight Technologies.

Programming

Editor

On the left is the trigger and on the right is the wire ball gizmo. Once the widgets are in place, it's time to test, and in Unity that means pressing the play button and nothing else. Pressing the play button starts the game and you can try it out then and there.

It functions in the same way as a deployed version and it notifies in real time of any error or warning in the debug log. During the playtest it is possible to pause the game and go through different variables and the positions of objects. Unity's editor offers unlimited customization as it is possible to create your own tools in it.

Assets, whether scripts, 3D models or textures, can be imported in almost any format as Unity supports a wide range of applications and formats. For example, 3D models can be imported into Unity from major commercial products such as Maya or 3D Studio Max into the free Blender software. In Unity it is possible to edit an asset in other software and just hit save and it will be updated in the project.

This means there is no need to manually enter one's assets every time they are modified. This easy-to-use approach is evident in the handling of textures as it is possible to save multi-layered Photoshop files and Unity automatically compresses them. In addition, it is possible to convert any texture to a normal map which is done automatically, and Mipmap generation is supported in three different methods: Detail Fade, Kaiser Filters and.

Asset Server is based on PostegreSQL which is known for its reliability, data integrity, easy administration and backup. Asset store contains everything from tutorials and guides to real assets like textures and scripts to complete modules.

Networking

Master Server

The master server is a separate service used to list servers and make them available to a wider audience. Games can be connected to the main server if they are unavailable due to firewall or NAT. SuperShooterV2.1.12b containing the game name and its version will be unique and the main server knows which games to merge.

GameName is the server name that is displayed when a server list is requested. By default, the comment line is self-explanatory, but if a developer is going to modify the main server source code, it can apply e.g. Unity Technologies has a dedicated Master Server that anyone can use, but the Master Server and Facilitator source code is freely available as ready to build project files.

The Facilitator is used for NAT traversal and is a separate part of the Master Server.

NetworkView

RPC – Remote Procedure Call

Uses for an RPC could be, for example, a client calling other players that it has received an item or a server starting the game only after a specific number of people have joined the game. RPCs can be buffered and this allows an easy way to sync a new player to a game. As the RPC calls are buffered, a new player joins the game and receives all the previous calls in sequence and is then at the same level as the other players.

RPC function is created by inserting an "@RPC" line before a normal function, this allows it to be called as RPC. RPCs can take the following parameters in Unity: integers, floats, strings, NetworkPlayers, NetworkViewIDs, Vector3s, and Quaternions. First the function name is given, then who it is called to and finally the parameter is given.

In this example, the function is only called on the server, and the server would print "Hello World!". In the function itself it is possible to get additional information about the RPC sender from a NetworkMessageInfo structure. Through this structure it is possible to obtain a timestamp, the sender and the sender's network view information.

OnSerializeNetworkView

Server

Client

Fat clients are the heaviest as the name suggests and have local storage and local processing. Hybrid clients have local processing but no storage, and a thin client is just a client with all storage and processing done on the server side.( Wikipedia 2011.).

NAT - Network Address Translation

Chat Room

Idea

Planning

Obstacles

Implementation

The inviting user will be shown an information box informing them that the invited user is processing their invitation. If the invited user declines the game session, the inviter will receive a decline invitation message. If the invited user accepts the game invitation, both users will automatically download the game.

After booting, the user must choose whether to create or join a server.

Further Development

Chat room code examples

Referências

Documentos relacionados

Ainda que exista o Projeto Permacultura e outros trabalhos sobre sustentabilidade na escola, persistem desafios a serem enfrentados para a apropriação teórica das discussões