Claymation Runner DevLog #1

Claymation Runner DevLog #1

Road collider mess.

Intro.

This is the first post in the series. So before I get into the “Needy Greedy” I’d like to let everyone know why I’m making these. As a developer I often get lost in the sauce of code and development, this can be overwhelming at times and causes me to get un-focused. In this un-focused state I’ll usually peruse the web looking for inspiration of some sort and in reality end up just wasting a ton of time watching some random video that youtube suggested me,(You know how it goes.), watching twitch, or reading countless articles. So I thought to fix this problem, I need to focus on my own development. To stay focused on my own things I should make my own videos, stream my own twitch, and write my own blogs!

We are in the Age of big data, there’s so much content in the palm of your hands it’s soo easy to get distracted or lost in the sauce for hours on end. And you know what they say “If you can’t beat em, join em.” So I might as well try and see if anyone wants to get lost in my sauce…?haha. I might as well improve my own dev skills, writing skills, and video editing skills throughout my journey through game development. That’s why I’m bringing you these DevLogs.

Also I’m making them so that I can personally track my own progress in game development and reference how I go about fixing certain problems. Sorta like my own code documentation, but in a fun medium.

So now let’s get started with this DevLog…

One of my best friends came over today and played my game.

He made it apparent to me that the colliders in the walls of my roads aren’t working as he was able to move through them fairly easily.

That had me thinking…

I messed up!

Whenever I had made these road objects I had made them with simple boxes that Unity3D provided. All of these boxes containing their own box colliders! — This many colliders is not good for performance, and this also makes collisions easy to get past since there’s little gaps in-between each collider.

Deleting the colliders :

Too many colliders slowing down our game.

As you can see above, the green outlines around the objects are all the colliders in the objects. Since there are multiple colliders on the objects, this makes it difficult for the player collider to register and keep a steady collision causing the character to do this :

Character goes through the multiple colliders.

Having all these colliders is not only prone to these bugs, but is also expensive to run! So the simplified colliders in the image below will make our game faster. This is highly beneficial since our game is supposed to run on mobile devices.

Simplified collider setup helps speed up our game and cause less bugs.

Here’s how the player reacts to our simplified collider setup.

Viola! The character gets caught by our collider.

Tried to get the post processing stack camera effects to work

I wanted to add some sort of AO(Ambient occlusion) So that shadows and objects close to each other will have small shadows on themselves. This ended up not working (maybe my graphics card isn’t good enough) doesn’t seem like there’s enough documentation on the post processing stack yet either.

Notice anything different about the shadows? (crisper looking?)

Enabling apple’s METAL

not really sure what this is going to do for users. Maybe make the game run faster on newer devices. Might make the game NOT run on older devices. We shall see once we release!

Now to do some coding

Right now in the game, after you die you get re-spawned back to where you first started on the road. Sometimes there are barricades that are really close to your character when this happens and since the character is automatically moving forward, sometimes this makes you consistently run into this barricade endlessly dying and re-spawning again and again.

Looks like we need to have some sort of larger collider around the character that detects if a coin or barricade is within it. Then re-spawn or re-arrange those objects.

Problems arise with code. I should have known this would happen…

So… After working on the code for a few hours it seems the problem is a bit more difficult than seems. Since I’d like a detail of how I’m fixing things I’m going to make another post dedicated to solving this problem specifically which you can find HERE.

I feel as that this shall conclude this DevLog and now I shall work on our new code mess problems. 😉

Let me know if there’s anything I can do to improve these DevLogs. I’ll try to keep them pretty short or at least include lots of juicy images and Gifs to make them visually appealing. As for the writing content, let me know if you like where I’m going with the format so far and if there’s any way I can improve something. Thanks for tuning in!

Using PYAUTOGUI with Colaboratory – Not possible Today, Workaround Explained

Using PYAUTOGUI with Colaboratory – Not possible Today, Workaround Explained

Did you learn PYAUTOGUI with Colaboratory isn’t working? Chances are you found a bug using pyautogui in colaboratory and because you’re using pyautogui in colaboratory, you will get a bug. I wrote this blog for you.

PyAutoGUI is a cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
source – https://pypi.org/project/PyAutoGUI/

Notice mouse and keyboard are a part of the control.

Unless you’re an employee at Google and plug your mouse or keyboard into this server, there’s a really high chance you’re not going to make this work…

Here’s your environment right now; you’re using a computer that has a browser that connects to googles jupyter notebook solution they call colaboratory, pyautogui is aiming to use your mouse and keyboard on the local machine. If you’re trying to use pyautogui on googles colaboratory, you’ll be able to install pyautogui no problem (yikes), import into the code (even thought you can’t logically use the code), and when you try to use the minimum requirements of the language you’ll fail; mouse & keyboard.

The ideal; situation is you have pyautogui running on a local machine that has access to these mice/keyboard, monitor, and then you’ll be able to use pyautogui. I like running my pyautogui in pycharm or jupter notebooks.

The wireframe below is built to illustrate the typical environment for someone accessing this solution.

My suggestion is you put jupyter on your computer instead using anaconda distribution, which packages a lot more into the implementation and will help you solve more problems faster. PLUS give you access to a massive amount of cool tools.

I’m going to suggest the next path of learning will be install anaconda distribution, which leads to jupyter notebooks being installed on your computer because this direction you’re on with colaboratory is regrettably dead end. The goal here is to show you that by installing anaconda distribution you get jupyter notebook and it’s maxed out for your usage. Also, pyautogui will work. Below I explain in more detail this drawing.

Installing anaconda distribution gives you access to a lot of tools and you will be able to use pyautogui with the same interface as googles colaboratory product.

My Google colaboratory can’t work because it doesn’t have an active display?

An active display like the monitor you’re reading this content on right now.

Without an active display you’re unable to see your mouse and your typing would be pointless right? You’d not be able to see anything happening. That’s similar to what’s going on here, if you want to think of it that way. BTW, the diagram above explains the mouse/keyboard failures.

This is why pyautogui can not work with Google colaboratory. Your monitor isn’t technically plugged into the google server. You’re rending html, css, javascript and getting website in return. Your web browser renders my blog as something fancy and not a chunk of code.

When you load colaboratory, imagine you’re loading things on their product, in the cloud, which your active monitor is not plugged into. Rather your web browser is plugged into colaboratory, a website, and if your minimum requirement is to complete this in google colaboratory then I understand why you would not want to install the anaconda distribution.

Anaconda distribution is what Colabratory is built on.

I’ve done the research and found out this information for you. Yes, jupyter notebooks is being used in colabratory. If you’re trying to use pyautogui, you’re going to need an active display, install it local and begin.

I also tried to make pyautogui work in Googles app because I too wanted to do macros, build bots, and save time automating boring stuff.

Colabratory by Google is built around and using the anaconda distribution’s solution, jupyter notebooks… and it’s intuitive to know about installing the anaconda distribution because it helps you jump into this solution without these errors generated using a cloud machine that you don’t own on the internet.

This screenshot below shows how I start jupyter notebook local, it’s easy to use and pyautogui works great on mac and both windows. The links I’m providing are links to blogs I wrote and it’s a walkthrough to help people walkthrough the anaconda distribution installation.

screenshot of anaconda distribution's juypter notebook start process

A screenshot of jupyter notebook starting. An alternative to using a workspace that’s similar to colaboratory.

FYI; Setting up anaconda distribution will allow you to use pyautogui better than colaboratory and on your local computer. Your computer local has a display which will help you avoid these errors.

Have you ever been in a forest and thought it would be okay to try something new and because no one is around it makes it easier to attempt trying something new?

Something about being in the woods is freeing and we can finally be a little cave man.

No one is filming. No cameras watching. No one to impress.

Similar to writing python on your local computer or in a code editor, ide, cloud based notebook, or whatever you choose. It’s not exactly big data sql.

Often times in the forest we are left with many options and none of them are the most optimized for success. Thus we are here with this blog.

Using Pyautogui with Colaboratory is not currently possible. The code isn’t running with an active display.

It’s okay we did this because now we know better and learned our lesson. If you think this is a little funny that we both fell on the exact same problem, please add me on twitter before you leave.

Pyautogui is going to look for an active display to do the work you’re asking and colaboratory is not built to do your task.

Colaboratory is a web based place to run python and collaborate with others via a quick share link…

At this point, you’re probably in a project or having to sell this to someone who told you to accomplish this task.

Wiki; Google Colaboratory (also known as Colab) is a free Jupyter notebook environment that runs in the cloud and stores its notebooks on Google Drive. Colab was originally an internal Google project; an attempt[29] was made to open source all the code and work more directly upstream, leading to the development of the “Open in Colab” Google Chrome extension,[30] but this eventually ended, and Colab development continued internally. As of October 2019, the Colaboratory UI only allows for the creation of notebooks with Python 2 and Python 3 kernels; however, an existing notebook whose kernelspec is IR or Swift will also work, since both R and Swift are installed in the container. Julia language can also work on Colab (with e.g. Python and GPUs; Google’s tensor processing units also work with Julia on Colab[31]).[32][33] (Updated with wiki definition as of jan3,2022, you know these things change if anyone wants to change the page.) It’s likely people like the colabratory environment because it seems like a great solution for gui automation, however if you want to do local based macros you may want to considering going down the same route of Google during the creation of this product, explained above in the wiki definition (you didn’t skip). Explaining code is a good thing, wanting to run things this way may be better in anaconda distribution, which is the same route as google.

Code explanation is a good thing, and explaining code – that’s not a bad thing when trying to explain crazu gui automation, I know because I use it to help me document local based gui automation. If you want something with a similar feel, please install anaconda distribution on your local computer and then setup your first notebook. Anaconda distribution has a lot of applications (big focus on data science engineering, visualization, and productivity applications for data gurus) and if you only want one application (notebooks), consider this path before installing anaconda distribution on your computer.

Install Alert? Get IT help if you’re at a company that has an IT department..

It’s rare an IT team doesn’t know about someone using anaconda distribution internally, externally, with fancy widgets or they use it themself.

Best to consider how they do this at your business (and if they don’t, ask for permission), they being your IT team, information tech team (maybe they call them engineering),… Please do the contacting of the appropriate people before trying to develop the app you want to build in this app I’m suggesting you install.

What you’re building may not be allowed in jupyter notebook on your machine right now, and maybe an engineer should get involved?

Follow along on my Colaboratory.

Being new at python, is where everyone will be at some point, and just discovering Colaboratory it’s easy to test a library that will pip into the environment.

The Jupyter Notebook has become a popular user interface for cloud computing, and major cloud providers have adopted the Jupyter Notebook or derivative tools as a frontend interface for cloud users.

Examples include Amazon’s SageMaker Notebooks[26] Google’s Colaboratory[27] and Microsoft’s Azure Notebook.[28]

Everything below is for people who need a little more elaboration, a screenshot, or more information to feed to someone who may be asking you questions about why you’re moving to a different solution.

Colaboratory is a nice place to add code related to pyautogui, and explain pyautogui, a lot like anaconda distribution, but it will not be a place for GUI automation when cloud/server based backend is running the python as it does not have a display, being that a server is running the code, and this server is ‘google’ and not your computer, there’s a hiccup here… you don’t have a relevant display… Literally none what-so-ever.. Just look at that bug, just freaking look at it.

A screenshot of colaboratory when trying pyautogui

PyAutoGUI in Colaboratory looking to show what’s happening when you try pyautogui and there’s no DISPLAY, something it’s expressing in line 160 sucks.

What is colaboratory?

Colaboratory is an online colaboration tool that lets you write your python code, add files, document well, and did I mention document python.

Follow along with me here for any additional support.

DM me on Twitter.com/itylergarrett for more support! Happy to share your problem with my following on twitter to help you get quick visibility into any problems you’re facing, we are a team when it comes to problem solving, and chances are there’s an easier path.

Anaconda distribution might be overkill and you may only need jupyter notebooks. However understanding anaconda distribution is great path for anyone using apps like pyautogui on colaboratory in my humble opinion (12 years enterprise data tech consulting and project/product management). Next you’ll likely be excited to start using the community edition on pycharm for when you are ready to deploy these scripts to run on your active monitor. Next will be how to automate pycharm scripts.

Best of luck automating key strokes and various things in pyautogui. I recommend keyboard for a nice alternative to pyautogui!

How to Install Node.js on MacOS for Beginners, Using the Node.js Installer

How to Install Node.js on MacOS for Beginners, Using the Node.js Installer

Here’s a quick walkthrough to help you understand how to install nodejs on your local computer, using the node.js installer provided on the nodejs.org website!

My installing node.js pain is your installing node.js gain.

Have no fear, I’ve been writing tutorials like this for a many years and excited to make this an easy way to learn how to install node.js on your macbook, macbook air, macbook pro, or whatever the hell they are calling the thing you’re using.

Our goals;

  1. Download node.js
  2. Installing node.js on your mac
  3. Making cool apps in node.js

We may not get to making cool apps today, however with some time, who knows what you can develop.

Download Nodejs from nodejs.org

Below I leave all the information for doing the node.js installation on multiple computers. I’m anticipating the blog will become my personal wiki.

Ready to download? Follow here to download node.js. If you are concerned of 32bit/64bit, more below, if not concerned, skip the next section.

Pick Mac operating system 64bit for any recent model computers.

You are aiming to download the LTS or “recommended for most users” version and it needs to relate to your computer. Consider we designed our blog for “MacOs” users.

a screenshot of nodejs.org, demonstrating what to click to download the macos installer .pkg for 64bit system

Maybe you are not sure if 64bit?

Determine what your computer needs for node.js installation

To install most things now-a-days on your little computer or big computer, requires understanding more about the computer. Crazy concept.

Take a peak, top left is an apple.

Click the apple.

top left of each monitor will be an apple to click.

Research shows if you have a computer >2007 from apple, it’s 64bit.

If the processor is an Intel Core Solo or Intel Core Duo, it’s 32-bit only. Here are the 64-bit Intel processors Apple has used in the Mac:

  • Core 2 Duo
  • Dual-core Xeon
  • Quad-core Xeon
  • 1 – Core i3
  • 2 – Core i5
  • 3 – Core i7
  • 4 – Core i9

Hopefully this helps you understand enough to make a quick next step. If not, leave a comment below and happy to offer help with your node.js install on your mac, as best as possible. By leaving a comment, I will be offer you help immediately. Offering you a chance to get past this hump quickly.

Download options for node.js

Latest LTS Version: 12.19.0 (as of oct 8,2020)

Download the Node.js source code or a pre-built installer for your platform, and start developing today.

Windows Installer (.msi)32-bit64-bit
Windows Binary (.zip)32-bit64-bit
macOS Installer (.pkg)64-bit
macOS Binary (.tar.gz)64-bit
Linux Binaries (x64)64-bit
Linux Binaries (ARM)ARMv7ARMv8
Source Codenode-v12.19.0.tar.gz
(relevant as of oct 8,2020)

Additional Platforms for node.js to be implemented

SmartOS Binaries64-bit
Docker ImageOfficial Node.js Docker Image
Linux on Power LE Systems64-bit
Linux on System z64-bit
AIX on Power Systems64-bit
(relevant as of oct 8,2020)

Screenshots of node.js installation!

I’ve found screenshots really help me see something at a glance and offer a medium of information that isn’t a big commitment.

For some reason, some days I don’t want to watch a video of someone doing a clickthrough. I have a good groove going and I need to keep my music on loud.

Did i mention installing node.js on macOs is easy? you got this.

You need 75.5mb of space to install node.js on your macos
i could change the directory but i wont because i have no idea where else to install node.js right now
needs your password to install node.js on your macos, no that’s not the amount of letters required to do my password, i do mores
writing files… yikes… i didn’t sign up for this… yes you did… almost done installing node.js on your computer… time to dance?
These bins look relevant and it’s suggesting that we add this to our $PATH, a good suggestion if we want to use it in the terminal I bet, unless we want to add these in front of the terminal command… here we go
okay, your node.js installation on your macos is completed, now move the installation thing in the trash, and if you need it again you can always open the blog and open it. i know ill be saving it as a favorite because chances are high i will need to reinstall my node.js, maybe keep it.

Will insert new content here, as I progress learning more about node.js.

Thanks for checking out my blog on how to install node.js on macos for beginners, using the installer from nodejs.org.

Stuck on your journey? Need advice? Add me on twitter.

How to Loop your Code | PowerShell Looping

How to Loop your Code | PowerShell Looping

Here’s one way to loop your code with PowerShell. PowerShell looping is one of the easiest ways to loop through processes in code and a good way to start learning to iterate little processes you develop.

A rather typical procedure to learn early or it won’t make much sense when down the rabbit hole. I like how this code writes and teaches you how to iterate rather quickly. Be sure to paste and hit play.

$k= New-Object -comobject "Wscript.Shell"

$a=1
$b=5
$n="`n"

Start-Sleep -seconds $b

DO
{
$k.sendkeys("1 of $a$n")
$a++
Start-Sleep -seconds $b
} While ($a -le 5)

There are lots of ways to do things in code. Maybe you loop things differently?

But PowerShell keeps it rather simple.

When you’re wanting to loop text output, you can do so easily with Powershell using a DO WHILE.

do while loop in powershell-Windows PowerShell ISE

Here’s a loop we can use to repeat stuff in PowerShell.

Found the beginning of this lesson here, meaning I found code, copy pasted it, and it was enough to help me learn every aspect of the code. The lesson @ the Microsoft website is a little more extreme and doesn’t explain the line by line code, which I feel needs an extra explanation.

Line 1
$k= New-Object -com "Wscript.Shell"

New-Object Creates an instance of a Microsoft .NET Framework or COM object.

New-Object Opens the ability to send a keystroke within PowerShell.

We call this with $k moving forward.

Like in math class, you used X to represent a value or Y to represent a value.

This makes our code easier to write and read.

$k.sendkeys, later in the script, is now easier.

-comobject or -com for short is a special ability.

The -Comobject Specifies the programmatic identifier (ProgID) of the COM object. Luckily you don’t need to understand what this means.

Line 3,4,5
$a=1
$b=5
$n="`n"

Like in math class, you have X representing a value and Y representing a value.

We will use these extra variables later in the tutorial.

Today, $a and $b represent a tiny lesson, which is.. you can leave unused code.

$n="`n"

This tells PowerShell to make a new line whenever we say $n in our code. So when we output keyboard key strokes of “something $n” — powershell essentially hits “ENTER” on the keyboard. This is a powerful next step for anyone looking to automate their UI.

Line 7
Start-Sleep -seconds $b

Ever tried living without sleeping? Writing UI automation is the same. You need breaks, waits, pauses, etc.

In powershell, it’s called Start-Sleep -seconds X…

Line 9,10,11,12,13,14
DO
{
$k.sendkeys("1 of $a$n")
$a++
Start-Sleep -seconds $b
} While ($a -le 5)

Here’s the full loop, a beautiful little tool that we can use to do very quick simple tasks, or loop massive dynamic scripts. Maybe it emails someone something every 15 minutes. Like a scheduler, you can pad a pause into this loop and expect the loop to repeat at the speed you desire.

So, not only are we saying something with our sendkeys tool, but we are also padding a pause into the tool.

If you want to learn more about the sendkeys tool, I built a blog called Make Your Computer Type For You in Powershell. Where I discuss that tool more. Let’s continue.

Line 9,10,12,14
DO
{
$a++
} While ($a -le 5)

DO this work until X equals 5.

-lt is less than, and -gt is greater than. -le seems to be another operand and I cant seem to google it today. what’s nice is this code takes a split second to run. Test and use what works best for you.

$a++ is thing that increases. Per loop.

So the first run, makes the $a=1.

The second run, makes the $a=2.

The third run, makes the $a=3

4th, $a=4

5th, $a=5. Now the condition at the end stops the loop and continues reading the rest of the code.

After it repeats the loop 5 times.

It knows it increases once because of the $a++ logic we built.

$a++ effectively increases, +1, each time. It also helps us stop our loop from running forever. If you remove $a++ the loop will keep running into you end the script. Which means this could be a bit risky when pointed at the wrong or right thing.

And the condition…

1 -le 5

2 -le 5

3 -le 5

4 -le 5

5 -le 5

END… now the rest of your code would be computed.

 

Make Your Computer Type For You in PowerShell

Make Your Computer Type For You in PowerShell

Hello, here’s a quick tutorial on how to make your computer type for you in PowerShell on Windows.

Have you ever needed to type something on a computer?

Over and over.

And maybe you did not want to repeat that task.

This script is for you.

Making your computer type for you is the usual first step to learning how to make your computer do your work.

Also, the first step into getting started with UI automation.

What is UI AUTOMATION? An entire world of easy tools, that make your life easier the more you learn.

The goal here is you want to learn how to automate something that you are doing manually.

This kind of automation should be used to put yourself out of work so that you can get your life back with your family.

You can open PowerShell ISE, it’s a code editor.

Powershell ISE is a free app to help you develop code in Powershell. AKA Posh.

Powershell ISE is a free app to help you develop code in Powershell. AKA Posh.

Or open a text file and save the following code:

$k= New-Object -com "Wscript.Shell"
$a=1
$b=2
$c="Meow moew"
Start-Sleep -seconds 5
$k.sendkeys("$c")

Save as a .ps1 file.

Hit play, or double click the file to execute.

It will take 5 seconds, then your computer will type Meow Meow.

If you kick off any automated security alerts, work with your IT department to unlock this ability. You are building a new app and that means it can do positive or negative things. Which is a risk from a commercial/enterprise business computing perspective. Also, data privacy, your manager, smart people in your company will likely want to know what the code looks like and will seek to read the code before they let it play in their environment. Or you’re at home and no big deal.

Line by line tutorial below:

Line 1
$k= New-Object -com "Wscript.Shell"

New-Object Creates an instance of a Microsoft .NET Framework or COM object.

New-Object Opens the ability to send a keystroke within PowerShell.

We call this with $k moving forward.

Like in math class, you used X to represent a value or Y to represent a value.

This makes our code easier to write and read.

$k.sendkeys, later in the script, is now easier.

-comobject or -com for short is a special ability.

The -Comobject Specifies the programmatic identifier (ProgID) of the COM object. Luckily you don’t need to understand what this means.

Line 3,4,5
$a=1
$b=2
$c="Meow moew"

Like in math class, you have X representing a value and Y representing a value.

We will use these extra variables later in the tutorial.

Today, $a and $b represent a tiny lesson, which is.. you can leave unused code.

And if you remove it, your code will be faster.

Line 7
Start-Sleep -seconds 5

Ever tried living without sleeping? Writing UI automation is the same. You need breaks, waits, pauses, etc.

In powershell, it’s called Start-Sleep -seconds X…

Optimize your code by updating the following.

$k= New-Object -com "Wscript.Shell"
$a=1
$b=5
$c="Meow moew"
Start-Sleep -seconds $b
$k.sendkeys("$c")

Swapping values visually in paint using powershell

Paint helps quickly explain where these two swap. Helping us apply another X value to a number.

explaining basic stuff with screenshots in powershell

Here’s how we use $b later in the lesson. Glad you’re not skipping ahead! Powershell isn’t half bad, right?

Line 8
$k.sendkeys("$c")

Finally, let’s make my computer say meow meow.

You’re passing the $c = “Meow meow” to whatever text field available.

explaining UI automation by automating text into my twitter handle @itylergarrett

Meow meow on twitter.. Great. 0 likes.

Interested in more?

How to Loop your Code | PowerShell Looping

Cool, I’m sure I will write about how to do this in advanced versions but without the basics, I doubt anyone will understand where this will go!

Best,

Tyler Garrett

A Very Quick Introduction to PowerShell

Powershell is a windows only computer programming language and it reads pretty easy on the eyes. You might be wondering why I’m saying it reads easy.

Some programming languages to do not read easy.

Some programming languages do read easy..

Powershell is one of those easy languages.

It’s free and comes on every windows computer.

It also usually comes with PowerShell ISE.

I’m going to add on to this more today and want a link to easily copy and paste. Come back later if you want to learn more.

How to Loop your Code | PowerShell Looping

Make Your Computer Type For You in PowerShell