3d multiplayer games first time downloading

hello prospective game developers thisis Ikkir I recently went over the first major UI pass after doing multiplayerinput on our game missile comrade and I realized just how difficult doingmultiplayer let alone multiplayer UI with cursors could actually betherefore I decided to do a miniature series about getting both basicmultiplayer working as well as multiplier UI in unity during thisseries I may not end up doing things that typical unity way as I am moreconcerned about getting things running with whatever resources I can musterI will also typically be doing as much possible in-code and may at times evendrop down to lower-level materials in order to show what is actually going onat any given time my end goal is to show full project setup all the way to bothlocal and network multiplier action so let’s just get started first of all to start our set up we will ofcourse need unity itself in this step I’ll be going over all the things we’llbe using in this project as well but if you’re already completely set up feelfree to skip this part my current version of unity is 5.6.3f1 with the current version of Unity at this timeis in the 2017 range feel free to grab the latest version but ifyou want an older version go to you get unity slash download slash archive asshown here follow the directions during the Unityinstall to completion here you may want to also select additional modules likeWebGL or Android I will most likely be showing off at the very least someAndroid and WebGL basics during this series so please grab them if you wantto follow along there while unity is downloading and installing let’s take alook at what else we’re going to need in making our game assets including alot of UI we will at the very least need an art program or two we haveseveral options here including paint.net Aseprite GraphicsGale GimpPhotoshop and more I will be using GIMP that it is free and I am familiar withit but you can choose what you like I would also recommend a 3d art toollike 3ds max maya or blender for making simple models with little that I will doI will be using blender and will go over the basics of model creation and the assetimport pipeline a full blender tutorial or a 3d art tutorial however are both beyondthe scope of this video though so you may need to look that up on your own in addition to art I’ll be using somevery basic sound creation software called bfxr to create some verysimple sound effects for music I may do some very simple midicreation but more than likely will simply search for free usable game music asactual music or music creation is also far beyond the scope of this video with artprograms and the audio taken care of will also need a good way to documentour development you can use some sort of office program if you like but I will beusing notepad plus plus here I will be using some basic versioncontrol software and be keeping several sets of backups you typically alwayswant at least three backups with at least one of them off-site multiple backupsare always necessary as many things can happen whether it’s a fire or laptopbeing stolen or other such catastrophe with version control you can usesomething like SVN or git and I’ll be using git here you can create an onlinerepo for your project on sites like bit bucket or github as well in additionservices like Dropbox or Google Drive may be useful for backups groupcollaboration as well from here let’s go ahead and set up our folderand initialize git for our project have git installed you will see youright click context menus on certain folders that are allow you easy accessto git for repository management here I’m going to use a simple git GUI tocreate a new repository in this folder when this is done you may not seeanything in the folder but the repository is there is just hiddennow let’s open up unity and start a new project from here simply click on new or if youhaven’t logged in and created a unity account do that first I’m going to call my project multiplayerfrom nothing and save it

Default 3d multiplayer games first time downloadingand save it in the folder that I set up okay what we want to do right now issimple familiarization with the unity UIover here we have what’s called the scene viewthis is a look at what exists in your actual gameplay field which at the startisn’t much if anything you can move this view around by holdingdown the middle mouse button and dragging by holding down the right mouse buttonand dragging select objects by left-clickor left-click and drag to select multiple objectschange the view from 3d to 2d select various rendering options fordebug purposes and a few other things that I won’t begetting into at this point below this window we see the game windowthis window is actually a view of the scene rendered from a camera in ourscene without this camera we would see nothing just I will show ina moment also in this section we see a few other options like maximise on play mute audiostats and a few others but our most importantother thing down here is the resolution selection one of the most important things when wedo start a new project is figuring out what resolution we’ll be wantingnatively this holds doubly true if you aretargeting smartphones or tablets and you may need to do a little bit of researchinto how exactly to best setup your scene then but for our purposes I am justgoing to leave it as 16:9 for now over in this section we see the projectfolder this shows the files currently loaded in our project and is our mainasset organization point while we are down here let’s go ahead and right-click createfolder and call it underscore scenes from there we need to go to the filemenu in the top select/save scene as and save it as scenes as main the very basics of unity requires scenecreation and saving of such scenes so it’s good to get this part out of theway after thatcomes the linked sections where most of the time and energy in the editor will bespent hierarchy and the inspector windowswhenever you click on an element in the hierarchy window you can see information about thatobject in the inspector window for example here is our main cameraas you see you change the values on the camera you can see the gameview change if youturn off the object up here you can see that the game view reportsno cameras there are also other things attached to the main camera like thisaudio listener unity requires exactly one of these inany given scene as these components are what listen to audio in the scene forthings like sounds with 3d falloff effects I will go over more of thecamera stuff later but for now let’s move to game object creation over in the hierarchy window you cancreate a new empty game object by right-clicking and selecting create emptyif you right-click an object when you do this you create an empty game object asa child of that object I say empty it but it’s not quite overin the inspector we see a transform component every game object has a transform component that gives a position andplacement in the heirarchy you can see more about these componentsin the unity reference docs we’re going

1 3d multiplayer games first time downloadingyou can see more about these componentsin the unity reference docs we’re going to be seeing a lot of these docs asnearly everything you need to know about these components can be found herelet’s go back to the unity window take a closer look at the game object we justmade under the game object if you click addcomponent you could see a list of things we can possibly add right now we aregoing to add a mesh filter and a mesh renderer the mesh filter is what contains themodel data of an object mesh and the renderer determines how it is renderedright now we have no model data so let’s go to the mesh filter and add one this can be done by clicking on the knobto the right and selecting one of these defaults that appear in our new selectmesh window let’s add a cube now we can see a cube in our game andscene windows but it appears as purple because we don’t have a material added tothe mesh renderer as you can see down here in materials you can also use the knob here to select a default material for our Cube let’s select the aptly named defaultmaterial now you can see that the look of thecube changed to white overall there’s not much that we can dowith the default material though as you can see in the inspector windowwe open the information on default material everything is grayed outwe can however create a new material and add one we can do something with let’sdo that now back in the project window let’s add a new folder called materials then inside that folderlet’s right-click create new material let’s call this material custom material now over in the inspector you can see alot of modifiable values change these around if you likethe preview window will give you an idea of what your material is going to look likebut for now let’s just change the color now if we go back to our new cube pressthe knob on materials again we can see our new material in the list ofmaterials to add we can also simply click and drag fromthe project window place our new material and material slot like so notice though if you click on thematerial instead of dragging it the inspector will change that objectinstead you can lock the inspector over here bypressing the lock button or by right-clicking the inspectorwindow and selecting lock while this pop-up window is open noticethe other options here the add tab option is useful if you wish to changethe configuration of your windows as you can have an additional viewthe other most notable thing about the inspector window though is the debugsetting with this setting on you can see a lotmore very different information about the object you have selected most ofthis won’t be immediately useful to you however but if you’re ever wondering whyyou may be seeing odd things in your inspector window click to make sure thedebug mode isn’t selected anyway back to our cuberight now our cube is simply there as a decoration we go up here and press play we see that nothing happenslet’s add another component a rigidbody lets also make sure our cube is centered to our game view by going to the gear on theright and selecting reset now when you press playwe see the cube fall down this is because our rigidbody componenthas gravity which we can see over here if we uncheck this checkbox to pressplay again to gravity no longer applies let’s turn back on gravity and thencreate something for our cube to interact with instead of creating an empty gameobjectthis time I’m going to right-click and create a premade cube with 3d object cube notice in the inspector that thepre-made cube is almost like our own cube except it also has a box collidercomponent and is missing the rigidbody

3d multiplayer games first time downloading cube except it also has a box collidercomponent and is missing the rigidbody

2 3d multiplayer games first time downloadingcube except it also has a box collidercomponent and is missing the rigidbody we added to the other onecollider components are what unity calls into to actually check for objectcollisions using the inspector let’s move our new cube under our old cubeyou can either do this manually in the inspector by using the move functionality in thescene view or if you want something quick you can goto the transform on our cube go to the gearselect copy component go to the other cube click the gear and select basecomponent values then you can trivially move it under our old cube now let’s press play to see what happens as you see our cube is still falling butfalls right through our cube that supposedly has collision now that’s because we need to add collision of our own to our cube in order for the objectinteract from our cube go to add componentbox Collider now we can see the box collider component active on our custom cube if you change the values of center and size you can change information about the boxCollider this may be useful if you’re using acustom model mesh as well or if your Collider otherwise does not match thevisual of your game object you can also see a slot for materialon this box collider this is not the same kind of material as what is on themesh renderer there’s another type of material called a physic material I willgo over this more later but for now let’s just press play again to see whathappened as you can see the cube now stopsinstead of continuing through the other cube there is however one more value on thebox collider the is trigger option if we press this and press playwe notice once again that the cube falls through the other cube triggers themselvesare useful when you want something until another game object hey you just hit mewithout actually using the Unity physics system and moving the other objectaround now let’s go ahead and create a custom physic material and see if we canmake our cube bounce a bit go to assets folder right click create new foldercalled physic materials and then inside itright click create new physic material let’s call our new material cubeBounce over here we can see friction and bounciness values let’s set thebounciness value to one and see what happens when we go back to our cube drag the component over to material slot andpress play oops we forgot to take off is trigger when the cube contacts the other cube nowyou can see it bounce a little bit let’s go back and edit our physicmaterial a bit change the bounce value to maximum see what happens now our cuba is basically acting like atrampoline watch the cube bounce higher and higher until eventually it willbounce off if we go back now and set the bouncevalue to minimum or multiply however you notice the cube does not bounce at all but simply stops that’s becauseeffectively the other cube physic material has a value of zero since we haven’tattached our custom material to it and either a minimum or multiplication ofzero is simply zero by changing bounce values as well as friction values we canchange how our objects interact in our game with the unity physic system soit’s important to remember this for later there are also other colliders we canassign to our cubes which may give different resultsespecially on objects that arent centered one above one another feel free toexperiment further on other colliders and physic materials to see what happens now let’s go ahead and start with someUI over in the hierarchy right click and add UI text elementas you can see a few things got created when you do this beforewe go further make sure you can see your text on the screen you can adjust back to 2d view and look at exactly where your text appears on the

3 3d multiplayer games first time downloadingyou can adjust back to 2d view and look at exactly where your text appears on the screen as wellmove the text element until its inside or simply reset its position to 0 X 0 Yfor now now let’s look at the canvas itselfthe canvas is what holds all of the UI components here we can see severaloptions the render mode on the canvas choosesjust where and how the canvas renders on overlay mode the canvas rendersindependent of any of our scene cameras this is the default mode and most usefulfor UI in general the screen space camera mode attaches the canvas to acamera and displays its object in relation to the camera this can includebeing behind world objects however so be careful using this the worldspace option actually displaysthe canvas material as if it were a part of the 3d world so if you move yourcamera around you can actually see your UI move as well you might not be able tosee it now but the text is inside the UI worldlet’s say the camera back to overlay mode move down to canvas scalerthe default setting here is constant pixel size which means that any of yourUI will attempt to draw the same amount of pixels regards to the resolution thisalso means that if you have a wide range of supported resolutions if you arentcareful your UI could become easily unviewable the constant physical size on the otherhand attempts to make your UI the same physical size on every screen an inchper inch etcetera for now let’s select scale with screen size and leave thedefault options in let’s go back to our text object nowlet’s move our text the top left of the screen here you canmove it with the values on the rect transform which is a special type oftransform component for UI you can also change its anchor positionby clicking on the grid box to the left holding down the Alt keyand selecting the top-left option to move it and set its anchor at the sametime back in our scene view in 2d mode withthe text selected we can see the bounds of the text element in the UIif you adjust the bounds you can see that the text can become invisible if weshrink it too much this is because of the options over hereunder paragraph the text component wrap causes the text component to fill downwhen the textbox is too small while truncate causes any text that goesoutside the bounds of the rect transform to disappearyou can also set the overflow mode to overflow which means exactly that the text willno longer wrap or truncate in the direction it’s selected you can also select best fit in order toset the text automatically to fit the window size up here there are several font options thatyou can change as well including the font itself if you want to change itsfont download a new font and save it in your unity project and edit like thematerials that we added for on the font slotone notable thing about text is that your font may end up blurry at certainsizes and uses in this case what you want to do is increase your font size and then downscale the font-size up inthe rect transform depending on the UI that you do you mayend up having to do this eventually on the next episode we will go overscripting in c-sharp and how to actually change some of these values on our gameobjects programmatically for now let’s go ahead and save our scene in the filemenu and then let’s go back to our git window if you have closed this window you couldreopen it in the same folder you created it in by right-clicking and selectinggit GUI let’s go and hit rescan once we hit rescan we can see all thechanges to our files these are all the files that we added to get them ready to save in our gitsystem press stage changed to add in the commityou may get some warnings at this stage this is because unity is still open andhas temporary files if so just close unity and hit rescanthen try stage changed once more later we will go over ways to avoidannoying warnings certain classes of files some other get GUI systems andalso the get bash console once all of our files are staged let’s write in ourinitial commit message this can be whatever you like it’s bestto be descriptive once you are done here press committo save the commit to your local git repo if you have an online repo setup you canuse the push option as well to upload the files there git itself can be quite complicated so Isuggest further reading a lot of practice to decrease the amount of time youneed to mess with git itself on each commit and to also ensure the integrityof your git repo I would also suggest reading some more of the unity Docs aswell as adding other game objects in your scene to further familiarizeyourself with the unity workflow that’s it for now until next time staycoding

Leave a Reply

Your email address will not be published.