Mandoid. Developer.
Wednesday 14 September 2016
Do I like coding?
I guess it has taken me a while to get stuck in to coding because I wasn't sure if I would really enjoy it or not. I mean, I like the *idea* of coding, making things from scratch, working things out, being logical, and I love video games, so surely I would enjoy coding??? But I wasn't really sure; it just seemed so hard and so daunting.
Do I have a coder in me? Will I be passionate about it? Will I stick it out when things get tough? Will I be able to progress beyond a basic level?
Since I started the Unity course and this blog I have come back to coding with vigour and more of a belief in myself. The Women in Games conference and the people I met there gave me new confidence. So I feel more certain than ever that this is something that I really want to do. And a very long car journey back from the Lake District provided an unexpected answer to the questions above.
Husbandcoder and I started to talk about my latest Unity project, Number Wizard, and some of the extension tasks that had been set by the course tutors. How could I make it so that the computer guessed a random number to start with? How could I make it so that the player did the guessing rather than the computer? Then on to other theoretical prototypes, this time including graphics (which I haven't really done much of before).
We talked about this stuff for hours. At least 5 hours I think. It sure did help pass the time! It challenged me and pushed me further than I had gone before, and all of this was in my head, we didn't write a single thing down. If I can attack these problems head on like this and come up with answers (not all of them right, but each one helped me get there in the end), if I can spend that long solving coding problems, if I can draw on what I have learned and make educated guesses, if I rise to the challenge then I CAN BE A CODER!
I don't just like coding. I think I <3 it.
Mandoid. Developer. Coder. :D
Peace out coderinos!
Thursday 8 September 2016
A little sprinkle of confidence
Yesterday I went to the European Women in Games conference, organised by Women in Games and held at Greenwich University, London.
The night before I told myself that I was going to strong and brave and to talk to anyone and everyone.
I arrived after a horrendously packed tube journey in ugly hot weather, the kind of experience that makes you cry for a little more personal space. Face in an armpit, someone's leather jacket rubbing against my bare, sweaty skin, definitely no seat.
This did not really help to make me feel like a winner. Strong and brave were turning into corner and hide.
So at first I was a little intimidated by all the lovely ladies who seemed to know each other and were all bona fide games people, which I am not. I felt like I shouldn't be there. I started to slip into my usual 'ahhh what's the point' jogging bottoms.
Anyway, THEN THE CONFERENCE STARTED. Almost immediately I was captivated and inspired by what I was hearing. I met so many brilliant people. Received so much excellent advice. Made vital connections.
And most of all I felt confident about what I was doing.
I am meant to be here.
I am a strong, brave woman.
I am a games developer.
Just not an employed one that makes any money.
Yet.
Monday 5 September 2016
Playing Number Wizard
Artist's representation |
Woohoo!
I have finished Number Wizard and I wanted to show you :DI put it in a video for you to see it in all it's glory, so please enjoy the following 14 minutes of greatness, including the bits where I cannot do VERY simple maths.
I'm sorry if it's a bit long and I say OK too much... :/ I promise I will get better!
Please let me know whether the video is good/helpful or not.
Link to Udemy here
Saturday 3 September 2016
Stupid squiggly curly pieces of crap
Right now I have a real issue with the curly bracket {, so much so I am considering asking it to step outside, but GODDAMN IT I don't know which one to ask.
A routine compile on what was an otherwise perfectly operational piece of code before some minor changes has resulted in this:
Errrrrr you what, bruv? |
AAAAAAAAAARRRGHHHHHHHH!!!
So I know there is an error. But I don't understand enough about Unity/C# to identify what that is yet. At the bottom of the Unity screen the error log is repeated, but you can see the full message. Which looked like this:
I searched the code methodically, first with a visual scan, then with a trusty pencil and post it note (my speciality).
Maybe you can spot the error? |
This post it note has lines printed on it :D |
I got some help from Husbandcoder. He spotted it straight away, but still patiently listened as I explained what I had done so far. Explaining things to him was good, because I got to cement what I had just learned in my mind, but it didn't solve the problem!
He pointed something out to me that I am going to find invaluable, as I know in the months and years to come I am going to find many errors! In the error log it actually tells you what line the error occurs on - in this case line 28.
Ahah! I have located the devil! |
Ok so cut to line 28 and whooopah right? Hmmmm, no. Line 28 didn't have an extra }, nowhere did, I had already checked that.
So the next nugget of gold from the Husbandcoder was to look at the line of code just before the one that the compiler was saying that the error was on. This is because as the error could well be with what came just before, but the compiler doesn't realise there is an error until it gets to the next piece of code.
So I looked at line 27. Have you spotted it yet?
It's in there somewhere... |
That's on small ; for man, one giant error for Mandoid. |
So I added the pesky little critter and all is well! Sleep tight coderinos!
Sunday 28 August 2016
If else...OR ELSE!!!
I'm sorry if the title is a little aggressive. I don't know what came over me.
Had a little bit of time yesterday so I did another lecture on my Unity course. This one focused on if and else if statements. I have worked with these before when doing the Codecademy tutorials for JavaScript, but I was a bit rusty so it was a good refresher.
In fact I came across if and else if when working on Pet Me! the other day, writing probably my most complicated piece of code so far. I wanted to create a puzzle where the cats won't come to you until you have wiggled a wiggly stick (a cat toy, this is what I call them...) three times. Each time you wiggle it the cats respond in a different way. I had managed to find a script which specified that the first time you wiggled the stick a certain thing would happen, and then any wiggle after would make a different thing happen.
But I wanted the player to wiggle the stick three times before the cats would be pet-able. So this didn't work for me because the second and third wiggles produced the same outcome.
In my own very cack-handed style I thought I could circumvent this by adding in an if statement. So I already had code that said the second time the stick was wiggled that the cats would come out of their hiding place and therefore be visible. Then I told the game that if the cats were visible and the stick was wiggled then the cats should be pet-able.
I thought I was being all clever with my if statement.
But it didn't work! (This happens a lot!)
The way it was written, the game was resolving the if statement at the same time as the instruction before it because it became true. So as soon as I wiggled the stick the second time, the game printed the text for the second and third wiggles.
Pah.
So I must admit I got a little bit of help on this one, as my husband happened to come home at that moment. "What you need," he said, "is an else if statement".
Now I had seen if and else if statements and I hadn't understood the difference between them. On the face of it they seemed to do the same thing (in Quest at least) so I wasn't sure why this would make the difference.
So imagine I had a key which would unlock a door with one turn, and then open it with another turn. A simple (but incorrect) example of what I was trying to do would be:
If I ran this statement then both sets of text would print because as soon as the door is unlocked it would read the second line and carry out the command. This isn't what I want, because I wanted it to take two turns of the key to open the door.
So in this case an else if statement would be just the ticket, because then it would only carry out one of the two options.
This would result in either the first or the second statement to be printed, depending on whether the key had already been used on the door or not.
Else if statements solve the problem of having a series of if statements in a row, where more than one of them can resolve at the same time, and you want one thing OR another thing but never both or all.
Right! So I started to use else if statements instead. But else if what? I needed some kind of way of telling the game that the stick had been wiggled 1, 2 or 3 times. Again some husbandly help was useful here as he asked if there was an object counter function.
I found that and added it, so now I could base my else if statement on whether the stick has been wiggled 1, 2 or 3 times.
Basically -
if the door is locked and I use the key then unlock the door and print "The door is unlocked"
if the door is unlocked and I use the key then open the door and print "The door is opened"
If I ran this statement then both sets of text would print because as soon as the door is unlocked it would read the second line and carry out the command. This isn't what I want, because I wanted it to take two turns of the key to open the door.
So in this case an else if statement would be just the ticket, because then it would only carry out one of the two options.
1. if the door is locked and I use the key then unlock the door and print "The door is unlocked"
else
2. if the door is unlocked and I use the key then open the door and print "The door is opened"
This would result in either the first or the second statement to be printed, depending on whether the key had already been used on the door or not.
Else if statements solve the problem of having a series of if statements in a row, where more than one of them can resolve at the same time, and you want one thing OR another thing but never both or all.
Right! So I started to use else if statements instead. But else if what? I needed some kind of way of telling the game that the stick had been wiggled 1, 2 or 3 times. Again some husbandly help was useful here as he asked if there was an object counter function.
I found that and added it, so now I could base my else if statement on whether the stick has been wiggled 1, 2 or 3 times.
Basically -
If stick wiggled =0 then print text 1
elseif stick wiggled =1 then print text 2 and make cats visible
elseif stick wiggled =2 then print text 3 and make cats pet-able
elseif stick wiggled ≥3 then print text 3
Rather than what I had before which was-
So the beauty of else if is that it checks each statement starting at the top and working its way thorough until it finds one that matches the number of times wiggled, carries out the instruction, and then waits for further player input before it checks them all again. This avoids the issue I had where the game would resolve each instruction because the if statements were both true.
The last thing I had to implement was the object counter to increase after each pass, otherwise without it the game would still not know if the stick had been wiggled, 1, 2, 3 or 1,000000000 times.
In Number Wizard, my else if statement was actually a lot simpler, but nonetheless as necessary. You may remember that I was at the point where the game prompted the player to press the up arrow or down arrow to state whether the number they had thought of was higher or lower than 500. As it was written, you could accidentally press both up and down at the same time and it would resolve both. The else if statement here was used to make sure that only the very first key pressed would be resolved, and it would not log the second key unless it was pressed at the start of a new frame.
I realise that maybe this would all be a lot easier to explain if I had more screen shots to show the dodgy code as it was. I didn't think to screenshot them at the time, and there is no way I'm going to change it back, and then back again just for a screengrab! So I promise I will screen grab as I go along in future!
I hope your brain is intact after all that.
Bye for now!
if player wiggles the stick for the first time print text 1
if it is not the first time the player has wiggled the stick then print text 2 and make the cats visible
if the cats are visible then print statement 3 and make them pet-able straightaway
So the beauty of else if is that it checks each statement starting at the top and working its way thorough until it finds one that matches the number of times wiggled, carries out the instruction, and then waits for further player input before it checks them all again. This avoids the issue I had where the game would resolve each instruction because the if statements were both true.
The last thing I had to implement was the object counter to increase after each pass, otherwise without it the game would still not know if the stick had been wiggled, 1, 2, 3 or 1,000000000 times.
Here it is! |
In Number Wizard, my else if statement was actually a lot simpler, but nonetheless as necessary. You may remember that I was at the point where the game prompted the player to press the up arrow or down arrow to state whether the number they had thought of was higher or lower than 500. As it was written, you could accidentally press both up and down at the same time and it would resolve both. The else if statement here was used to make sure that only the very first key pressed would be resolved, and it would not log the second key unless it was pressed at the start of a new frame.
if, else if |
I realise that maybe this would all be a lot easier to explain if I had more screen shots to show the dodgy code as it was. I didn't think to screenshot them at the time, and there is no way I'm going to change it back, and then back again just for a screengrab! So I promise I will screen grab as I go along in future!
I hope your brain is intact after all that.
Bye for now!
Sunday 21 August 2016
Pet Me!
Pet Me!
I wanted to introduce you to a project that I started a little while ago, called Pet Me!
It’s a text based adventure game where you are trapped in a house, and you have to pet enough cats to escape. But the cats are not that easy to catch! You have to solve puzzles before they will come to you.
The beginning! This is what the game looks like when you play it. |
I am using a website called textadventures.co.uk and a program hosted there called Quest to write this. The website does the complicated work, so you don’t strictly write code while using it, but you do have to understand which commands to use to create the effect you want. I chose this because I wanted to start with something simpler, where I can practise the art of creating puzzles and a little bit of the logic behind coding.
Are you crazy?!? |
But I’m kind of pleased to say that it is actually a little more complex than I thought. In doing this I am devising the puzzles, writing the text, programming the game, sourcing assets, bug testing and fixing and project managing myself. One thing I am definitely learning here is that making a game on your own is a very difficult task, and it is clear why the majority of games are made by specialists in teams. Even for my very small and rough game, I am having to develop a huge range of skills
My creativity is being used in many different ways. Sometimes I'm feeling literary, so I will do some writing, sometimes I feel impatient and want to make progress so I do some of the programming, and sometimes I am feeling particularly focused and so I do some of the bug fixing. This is probably the hardest part. It is very east to just plough on when you get stuck and move on to some new part that hasn't become infuriating yet.
Under the hood...how to make a cat purr. |
Sometimes I find Quest to be a little rigid in what it can do, the functions that are provided within it will almost do exactly what I want, but not quite. This is probably because of my inexperience. I often find that when I encounter a tricky problem that I need to step right back and start again, because the solution I have gone with is not the right one, and never will be! It is like pushing a square peg into a round hole and thinking that it you rotate it it will make a difference.
So another thing I am learning is that you have to be very patient and not to give up.
I am about 7-10 hours away from making the first version playable, with the win condition being that you have to pet 12 cats. Unfortunately at the moment I can't get the win condition to actually trigger 'winning', so about 5 of those hours will be spent on stepping back from that, and then stepping back in again.
At the moment I have this...but it doesn't work. Maybe you guys have some ideas!
Why. won't. you. just. work.??? |
Friday 19 August 2016
Unity - the beginnings
I started an online course in Unity a while back, but as most of the first 10 lectures were about opening the program and saving folders into the right place I got a bit bored and didn't really make much progress.
This is exactly what my students would be like when we would have to start any lessons learning to video edit by painfully explaining what format and resolution the project would need to be, plus where exactly to save footage and where to save the project. Now I realise how dull it was, but to an editing geek it was the the foundations of a zen-like pathway to editing enlightenment and DEATHLY VITAL!!! There is nothing worse than a student losing their work, except for the constipated face of their teacher who had told them EXACTLY what to do at the very start of the project, was inevitably ignored and is currently holding in Vesuvius behind fake 'it's OK we can TRY to fix it' eyes.
But that is all behind me now and those memories only wake me maybe once a week.
Anyway this constant cycle of vital instruction, failure to follow said instruction, and scramble to pick up the pieces has probably left me in good stead for meticulously following the course instructions and actually remembering to do everything right by myself in the future.
So I have learnt that you mustn't move files/folders around unless you have exited Unity (and it's IDE, Monodevelop) first. Good. I won't.
Once all that was out of the way I actually began to use Unity, and on looks alone, it looks a lot like Premiere or Final Cut (the good ones, before X) which I am happily familiar with. So maybe I CAN make a game.
My first game is...
In which the computer guesses the number you are thinking of through mystical means!!!! Ooooohhhh!
Well no, mystical means would be pretty hard to code, so actually it will choose half of the range and ask you if your number lies there. Then continue in the same fashion until you finally say 'yes! that is my bleeping number, how did you guess that...?'.
So far I have learned the print function and how to write a string (or technically revisited these concepts as I have learned a little coding before through Codecademy and Khan Academy - maybe I can tell you a little about this another time). I am just starting to learn how to get a key press as an input and the difference between start and update commands so currently my code looks like this:
33 lines of joy |
I hope you find that lovely too.
The course teaches you how to look up things that you don't know, rather than just telling you exactly what you have to write, so I already know how to google the exact term for something (which I know is something that some professional developers will approve of!)
And it works...so far.
Hello!
Hi there!
I want to make video games! So I'm gonna bloody do it. Oh yes I am.
And I'm gonna put snippets of my progress on here so that I can see what I have achieved, and you can too.
I want you (YES YOU) to help me out...encourage me, guide me, laugh with me, cry with me, and most of all enjoy this with me.
Mandoid. Developer.
Subscribe to:
Posts (Atom)