Wednesday, 27 April 2016

Year 3: Game update: Ground plate

Ground plate 

In order to spawn towers in the world i had to come up with a way to do this. Similar to other tower defense game I decided to use a grid format to spawn towers on for many different reasons. 



There were two main reason that the science choose the system sport towers the first one is because it looks clean and to the player is easily visualise where they can construct towers and where they can't. The second reason is that it is integral and the blueprints were to selecting and previewing towers which would have been a little more difficult to do if the towers were constructing freely  meaning if they could be spawned anywhere.

The way the system works it starts off with an object called "ground plate" with an attachment blueprint to the object. With a duplicator and set out in a square this creates the base map for the player. 

Spawn a ghost tower:
The blueprint start's off On the main player camera this is where the blueprint code starts. It starts off with an event tick and then split into two with a sequence in an server gets split into three sequences which deal with  checking resources to see if they are viable.  The second sequence goes to a branch which checks to see if the camera is in the build mode this variable is changed from the user interface whenever the player clicks on what to some lack a tower to spawn. If the offence goes through the branch is true it then draws a line traced by Channel from the player's camera to the play's cursor. if the line trace hits targets it then passes through the branch is true then breaks down the results of the line trace we don't split the true action into a sequence. we set the hit actor from the break hit resultsto a variable called build mode hit object then with your partner sequence we use a cast to ground point node and  the variable build mode hit object to cast to. if the  cast is successful with and send in events to that ground plate called plate hit we are also send a highlight texture variable through this is the texture but how will turn to and give the appearance that it is selected. Then also send a number of events to the ground plate called Tower selection actor this sends through two variables one called Tower real and one called Tower ghost this is so it spawns a miniature version of the selected tower on the ground plate and also can spawn the real tower when prompted to.  with these variables they are editable so that they can be changed too many different tower types by a events change. 

Spawn the real tower:
The system that lets the players construct towers is reliant on the first system of changing the material of the ground plates and ghost Tower. It uses the events left mouse button  this is  to detect player import once the pressed event has been triggered it then goes through a series of branches to check certain conditions are metthe first condition is that it checks to see if the camera isn't billed birds if true it then proceeds through another branch checking to see if the sunlight variable is available if false then checks to see if the water variable is available if false checks to see if the food variable is available it then casts to the round plate using the build hit object from the previous segment. it then checks of variable on the ground plate called pleated used realif this is false then passes through a branch and breaks into two texts using a sequence.  The first event spawned the tower on click and this is an event that goes straight to the ground plates utilising the variables are sent to it when the ground players selected the second event set information to the tower this is so the tower can have a reference to the camera that spawned it and its user interface allowing the tower to speak back and forth allowing information to be transferred.


at the end of the event tech there is a sequence of it splits into three sections here is one of the events that is included with one of the pulses of the sequence. what this does is it checks the current resources with the cost of the new tower being constructive and if the resources why were than the required amount it set a variable to each resort of saying they are unavailable this is then used to stop the player from spawning towers.


This event is triggered after the player spawns a tower and what this does is it takes away the cost of the towers from the current resource pool player has and then updates the resources accordingly.

once the ground plate is hit by the selection process from the camera cost event is triggered called Tower selection actors this sends to variables to the ground plate from the camera these are then set on the ground plates slide can be referred to later at these.



the next event sent from the player's camera called platelets because of the frequency that this event is call that being every frame the role of checks and balances that have to  implemented to make sure this does not use too much performance they are. We first split into a sequence into two events with an split the sequence of further into five more events we first staff use of the favourable delay on a very short time what this is meant to do is that so long as the event is pulsing which means the player's cursor is over the ground plate this event will not complete but once the player moves the cursor away and stopped using this event  the retriggerable delay will complete. once it is complete it then uses a data nodes and enters through the gates and if the conditions are met it then proceeds to set the material of the ground plate to normal and then also set of variables such as play in used a false and play used ghost to false and then destroys the current ghost Tower that occupies the plate. Here is a video example:

The second event of the of the sequence uses a delay which at the time of 0.01 seconds and once completed allows the gates to be opened. The third event of the sequence are instantly goes to the gate and closes it what this creates is once the events plagued her stops being triggered those reach a global delay is still on a time while the delay opens the gates and because of the third event take bean instance the delay opens the gates and Retriggerable the way finally triggers when the gate is open along to go through.

Before the events of the sequence sets the material of the round plate to the highlights  text variable came through on the events meaning about the material that the ground play changes to one selected can be altered from the camera and will affect all ground plates simultaneously. the final event of the sequence goes strange were a branch where checks to see the ground plate  is in use if true it then goes to another branch which checks to see if the ground plate  used ghosts if false windows to another branch with checks to see if plate used real and if false then spawns the Tower ghost object at the location of the ground plate. It then sets to variables at the end taking the return value from the spawn of the node and send this to a current ghost Tower and then setting the plate use ghost of variable to true.

The first sequence at the beginning of the events has a number to events this simply set plate in use variable to true.

once the player decides to spawn a tower and the conditions are met on the camera to check whether there are enough resources to proceed with this event the spawn tower on click event is triggered on the ground with. This checks with a branch to see if  plate used real if false it then takes the town were real variable and spawns an actor with a at the ground plate location. The event is then split into a sequence into two events we first off set the variable plate used real to true and use a destroy act the nodes to destroy the current ghost Tower that sits upon the ground place. With the second of entity of the sequence we take the return variable from the spawn at the node and set this to Tower on play to variable we then send a Advent message to the tower on plate object with a self reference and this event's message is called set ground plate for tower.

















No comments:

Post a Comment