Overview Of This Week
This week I was introduced to the first set of programming fundamentals which was creating and accurately representing a flow chart of key game mechanics. I was also introduced to a new coding language that I haven’t used before: JavaScript.
With the creation of flow charts, I intended to show a slice of a game mechanic from an indie RPG by the name of Kenshi. There is a mechanic where you can automate people in your squad to do jobs such as farming, cooking, crafting and more, to help with gathering and using resources. This mechanic is mostly used for creating your own outpost and then developing it into a city rivalling all the other factions in the world. I wanted to try to implement this slice of gameplay because it is very close to the use of iteration in languages that I have used such as C++, C# and java. It is similar to iteration due to the fact that the jobs that you add to the job bar will keep looping until the job button is deactivated. I find this mechanic amazing as it will keep looping forever regardless of what character you are controlling and where you are in the vast open world of the Kenshi map. The image of the flow chart will be shown below:

I also experimented and ended up creating a flow chart for a guard patrolling around a 2d level whilst searching for the player. Image shown below:

This week I also learnt the basics for JavaScript. I learnt how to create variables, functions and objects. Variables are made with typing “let” or “var” and proceeding with an identifier then defining the value. Creation of a variable is shown below:
let mySimplePi = 3.14
Functions are created by typing “function” proceeding with an identifier then brackets for possible parameters and will have to have curly braces where the code will be placed in. Functions can be called at any point in the program and can either have a return or no return. Example is shown below:
function addStuff(x , y)
{
return x + y;
}
I learnt that objects are used when there would be repeated data types and you reference objects by typing the identifier then a full stop to access what is inside. Objects are made like this:
let thisIsMe = { name: "Danny" , lastName: "Mills", age : 18}
To access what is inside:
let myName = thisisMe.name;
Extra things I have learnt or problems I have solved this week
Flowcharts
- The most important thing I learnt about flowcharts is how important abstraction can be to create the more complex code that I will certainly make in my future projects. Abstraction is the simplification of certain characteristics to make the process of creating code more readable and understandable for the coders as well as possible managers I will be working with in gaming studios who have no coding experience.
- I had a problem with the “Guard patrol flow chart” where I would be repeating conditions. This is a problem due to the fact that, if this would be coded in, there would be data repetition which would lead to unoptimized running of the program. I realized that the best option would be to create a method which is shown in the image (image is above) with the sequence named “Pursue the player” which can be called regardless of which direction the guard was patrolling previously. Originally, I had two methods that would lead to the same outcome of pursuing the player when the guard was either patrolling left or right. I also created a function that would check which direction the guard was previously patrolling to create a seamless iterative loop instead of having too many conditions which, in coding languages, would equate to a lot of “if” statements. This simplification, if implemented into code, would create, again, a more optimized running of the program.
JavaScript
- I was introduced to “let” and “var”. What confused me was why there were two ways to create variables. I conducted further research and found that it was to do with scope. “let” is equivalent, in other languages, to being private whereas “var” is the same as public.
extra challenges or important things i need to learn for next week
- I learnt the most simple aspects about JavaScript this week so would love to learn more complex things about it such as the use of arrays as this is the most important tool a game developer will be using
- I want to get more familiar with the basics of the use of html as JavaScript is closely tied with the functionality of html to create such things as websites and online games which I will most likely be working on in the future