Wednesday, 27 April 2016

Year 3: Game update: In depth look at game camera

In depth look at game camera

Throughout development the camera as adapt and change quite frequently


On begin play:
When the game starts The camera blueprint sets some important information related to the future of the camera and user interface. first we get player controller and then set show mouse cursor is true that the most case can be seen by the player. next we Create the user interface using the creates interface widgetswe then send a self reference to let the user interface know this is the opening camera with an split into a sequence and adds this widget reference to be bought and also save the user interface to a variable called user interface so that it can be recalled easily later in the blueprints. We next user gap all after of class to get all the sport point on the map and save them to an array called spawn points on the map this is so that they can be taught to buy the camera at ease.


Controls:
The controls for this game where mostly baced of real-time strategy games and and to utilize the standard PC controls such as W,A,S,D keys and mouse. Aswell as add some features I thought could improve gameplay we first take the input of right mouse button and left mouse button.  From both events recast the player controller using the play controller at the index of zero next we send a events to that player controller called Lock mouse to viewport.

The lock mouse to view port event then set important mode game and UI it gets the player controller from a node and sets this as the target we then lock mouse to view port and set the variable to true but with the hired cursor during capture you set this to false so the player can see their mouse cursor.


For many real-time strategy games they use a camera system that uses the control keys W,A,S,D. The W key moves the camera forward, the A key moves the camera left, the S key moves the camera backwards and the D key moves the camera to the right.


When holding down the middle mouse button if the player moves the mouse it will rotate the camera in the direction that they move the mouse to the latest word is that once the player holds the middle mouse button down the events setsthe variable show mouse cursor to false then goes into a sequence splitting into two events opening the gates and the seconds changing a variable middle mouse button pressed true mouse going to the edge of the screen is shown as mouse X events the axis value is then tied by movement rotation and then a node ad at the local rotation sets the result to the Delta rotation Z. once the button is released the mouse cursor is shown and the gate is closed.


the left control plus middle mouse button to centre the camera is so that the player can centre the camera back to its normal position with a simple adding of one button. the way this works is once the left control button is pressed it then goes to a gate nodes which only opens once the middle mouse button is pressed and closes once it is released if the criteria is maths and the left control press events can enter through the gate and then is split into three events by the sequence set act the rotation node is used and sets all rotation of the RTS camera to 0 without also set the snap point left a variable to 0 as well as the snap point right variable.


This  system works by when the player moves the mouse cursor to the edge of the screen it then moves the camera in that direction accordingly.the way this works is by taking mouse X  events which works by finding the mouse cursor from the distance to the centre of the screen by either a plus value or a minus value.when the mouse is moved from the centre it bedroom is events which go straight to a branch  which checks to see if the middle button pressed  if falseit then goes into a sequence would split into two events. The way that we work out whether the mouse cursor is at the of the screen is first by getting viewport size then breaking into a vector two-day which breaks into an X and Y coordinates with and get the player controller and get mouse position from the which goes as a location X and Y with and take the axe from both nodes minus them from each other then take the result and divided by the X from the get viewport size with an take both these variables and check if they are less than0.02 or they are more than or equal to 1 back to the sequence we then check if these variables are true we then add back the local offsets which moves the camera in the Y direction. This is exactly the same for the mouse whybut instead uses the Y coordinates.


here we have the ability of the player to zoom in and out of the camera this takes the two events mouse wheel of the most real down and they are pressed and is worked out with a macro called zoom camera.


the Zoom camera Micro takes the two events in zoom in and zoom out on zoom in it first goes through a branch's checks to see the cameras position it then gets the Z axis from the camera component and the invisible object components it then minuses than from each other and uses a client value and pots this value in as the value it uses the zoom in limit and zoom out limits as men and max values the club the alt value from the clamp if equal to the zoo in limits then sets the branch as true if the branch it was false it then adds a local officer using the Delta location X zoom in speed meaning that the camera will zoom in until the zoom in limit has been reached. This is paralleled in the zoom out limits.


The next control system allows players to double-click ona ground plate and then snap towards background plates centre ring the camera at the location.  it starts off by taking the right mouse button press once pressed it then sets the click counts by plotting one to the current account then had through a sequence splitting into two events and after a 0.5 second delay it sets the click Count Zero resetting its so that players can right click without getting snapped to objects in the attentive the second level of the sequence checks with a branch to see of the click count  is more than or equal to 2if true it then sets the act the location to the object then sets the click Count Zero and reset the act the rotations so that they are in a default position.


This next system is used to find the object the player hits with the right mouse button it can be used for various different purposes of the default one is set to is allowing the players to snapped about location.  It starts off by the using the right mouse button events once pressed it fires a line trace starting from the player camera and landing under the hit result of the cursor once completed it checks to see if it hits an object if true it then breaks the hit result and sets the hit after the Right mouse hit object which can then be referred to later in the script easily until changed.


Build mode: 

The way the build mode works is once the player selects a tower to spawn it then sets the build motor true which  enters the camera into build mode which then many different features can be activated and is the main way the players build towers. 

First off start with a custom event  which once a player selected how to spawn it then sends this event to  the camera which sends vital information the camera needs in order to work out whether the tower can be constructing or not it sends the tower real object, Tower ghost object, Tower costs sunlight, Tower cost water and tower cost of food it then set all these variables that they can be referred to later with ease.

This is how camera turns off the build mode whenever the player  users right mouse button the build mode is set off and then a notification is sent to the user interface turning off there as well.


this section is where the user interface tells the camera when the build mode is turned on or turned off whatever this event is pulsed it sends through a variable called build mode and then this is set to be cameras build mode keeping them in sync.it also destroys any Tower selection boxes turns off Tower selection and resets the ground plate currently selected.


Resources:

This event is used whenever a tower back and collect resources is destroyed by even the enemy units or the player salve the tower this event is sent to the camera  and what it does is take three resources with them which is the current collection rate of that tower and then takes them away from the overall collection rates that the camera has which is accumulated from multiple tiles.


This event works the same way to the previous events what's works whenever  at Tower is spawned it takes  variables from the tower this is its collection rate and then adds them to the tower's collection rate so that it can be accumulated.


this section deals with whenever the  of the player decides to sell a tower which starred with an event that is triggered by user interface the event is called event cell tower starts off by destroying the tower on ground plates then sending a event to the ground plates resetting itthen destroying the tower selection box and then finding the three variables which are returned back to the tower which defaults to 50% of what the tower cost it then adds these variables to the currentsresource collection and sets them then the tower/unit selected is set to false.


This is the section in which the player receives resources every second depending on the gavel rates of the individual resource. It is linked to a event tech with a delay of one second it then adds the gavel rates to the currents stockpile of that resource than sets that resource


This section deals with taking the way resources from the stockpile of resources whenever a tower is spawn so it takes the cost of the resource and minuses are straight from the stockpile then sets the stockpile again.


Starting/Ending the game:
The camera blueprint also deals with the start/ending of the game this first section deals withthe first initiation of the start the game. It started off with an event it was then delayed by one second that I only activate once every second it first checks to see the towers are on the mapif this equals zero then pauses the countdown to the beginning of the first wave.


this section deals with the count of towers on map which is then Track so that once this equals to 0 it shows that there are no towers on the map and the processes towards ending the game can begin. Whenever a tower spawn this event will happen and what it does is it sets the cow on map variable by adding the current rate and plotting gets by one.


This custom event is triggered from the user interface when the player either decides to begin the wave or the time runs out on the wave it gets all the spawn points on the map for each loop and  set game has started variable on all the true meaning of vegan now spawn units.


This events happens when ever the waves end it is triggered from the user interface and gets all spawn point on the map had summer for each loopthen sends to events to them the first is change amount of enemies to spawn and the other is reset wave and then it set the variable on the camera which is AI count to 0.


The way this event works it is sent from the spawn points once they begin to spawn a eye into the scene they set their total number of a eyes they are allowed to spawn of acts we've and then adds it to the AI counts on the camera this is so the camera can keep track of all the AI with in the scene and once this variable equals zero it means  there are no AI is left on the map to be destroyed meaning the wave is over.


the enemy die count event is triggered from a eye when they are destroyed what it does is it tallies of the amount of AI killed with in the back current wave in also than gives the player resources for each kill may make of AI.it then contractually compares the AIcounts with the units killed and if equals true this means the waves over and that the next wave can begin.


In this part of the blueprint is where we can set the increasing difficulty of the AI the wave take is increased by one when I'm this event happens and here is where we can set of the logic for increasing enemies. Once the wave Tech is equal to 5 meaning that means the current wave farm five this then uses a branch and if true sets the wave detector zero and cast to all spawn point on the map sending an events to them called wave of the units and this will increase the properties of each AI making them more difficult.


this part of the blueprints deals mostly with the user interface it sends an event to the user interface called update wave number this then relates to the user interface setting the correct information visible to the player with an change visibility caught the games start visibility to true this is the countdown to the next wave and we also send another event called wave has ended which can be used to trigger many things user interface with and also set the AI count and unit killed to 0 resetting all variables for the next wave.


No comments:

Post a Comment