Thursday, November 23, 2023

My First Steps Into Godot

Video version of Post: https://youtu.be/KpXbkAAb_Bc

    Hey, ya'll, I  wanted to put together a little progress report regarding My First Steps Into Godot. For some background, I've been coding in Python for about a year; I started learning Java a couple of weeks ago and decided that it's time I stop thinking that making games is for other people. So, I've spent the past two weeks following Godot tutorials, and here are the results. Now, don't blame the tutorial makers for how bad this project looks; these are all my own tacky graphics. 

    So I started with  Godotneers' "Godot Components - how to structure a game into manageable parts (Beginner/Intermediate)". He walks you through creating the foundation for a tower defense game as a way of showing you the Components and their interactions.  You start with a tower to fire bullets, spawn some enemies for the bullets to affect, take damage from enemies that get through, so on, and into the various layers and logic that work together to make this all happen. I've got to say Godotneers an amazing tutorial writer and presenter who puts a lot of effort into his work. His details and explanations prepared me for the second tutorial that I spent a lot of time on and wanted to talk about. 

    This one is from Chris' Tutorials "Crash Course ~ How to Make a Resource Gathering Game in Godot 4!" There's so much going on in this one - you start off setting up the player character with walk and harvest animations, movement, node's spawning materials based on character interactions and timing and tile maps setups... and it goes on. I was really glad for the foundation that I got from Godotneers or I don't know that I would have been able to follow it, so those two really flowed well into each other. 

    Another way that these two tutorials complement each other, for me at least, was that the animation and movement I was learning in Chris' Tutorials I could apply immediately to the elements I had set up in the tower defense game with Godotneers. 

    In addition to those long-form Tutorials, I've also been pouring over dozens of other Godot videos and shorts. Special mention to Firebelley Games and their insights, especially "Using Composition to Make More Scalable Games in Godot" - now anytime I'm in the real world, instead of sitting down in front of my computer, I'm considering how to efficiently break objects and functionalities into different kinds composition items.

    These tutorials worked for me with my computer programming background. If you want to take this journey and you're starting from the ground up, I recommend Gogot Tutorials, "Introduction-To-Gdscript." Learning the basics can feel slow, but everything has a beginning. I've even been watching those Gdscript introductions on Highspeed to catch myself up on syntax and other language quirks. This hasn't been an easy journey, but I am so incredibly satisfied with my first couple of steps, and I'm stoked to keep going.

Links: 

Godot: https://docs.godotengine.org/en/stable/index.html

Godotneers, "Godot Components - how to structure a game into manageable parts (Beginner/Intermediate) https://www.youtube.com/watch?v=W8gYHTjDCic

Chris' Tutorials "Crash Course ~ How to Make a Resource Gathering Game in Godot 4!" https://www.youtube.com/watch?v=nQluyQ-1wSI&list=PL19FbkLnqUDiT9-aBYiauxviYSxh9FQDx

Firebelley Games, "Using Composition to Make More Scalable Games in Godot https://www.youtube.com/watch?v=rCu8vQrdDDI 

Gogot Tutorials, "Introduction-To-Gdscript" https://godottutorials.com/courses/introduction-to-gdscript/

Monday, November 6, 2023

Getting Started with Java


    This week, I started learning Java for my CPT307: Data Structures & Algorithms class. Java is well known for being an Object-Oriented Programming (OOP)  language and for running in the Java Virtual Machine. I've spent the past year and a half learning Python, so I've got a foundation with OOP, but the reading in this class is helping drive some of those concepts home. Oracle's (2015) lessons to teach OOP concepts are worth a read to familiarize yourself. A common way to begin thinking about OOP is to consider real objects around you. Every item around you has different properties or states associated with it - my dig is brown, is named Ruby, and is a mutt. The objects around you can also do things, exhibit behaviors, or have things done to it. Ruby can bark, be pet, or run around. Programming objects is just writing down those characteristics so that other programming objects can interact with them. 

Getting Ready to Code

    The great thing about learning Java in relation to a class is that the class provides starting resources; unfortunately, those resources are a bit dated, so I'm going to share the instructions that worked for me (in November of 2023). 

    First things first is getting the Java package downloaded and installed from Oracle. I'm using Windows 10, so next, I needed to set the path so Windows would know how to run Java programs. This Article from Nam Ha Minh was a lifesaver for me. I found his instructions clear with a good sprinkling of whys behind the steps. 

    Next, I needed an Integrated development environment (IDE). This is something that I had not taken seriously in my Python journey, just using whatever each tutorial recommended at the time. This ended up putting me at a disadvantage regarding managing Python environments and running scripts outside of the IDE until recently. With Java, I spoke to a trusted programmer friend, getting their input on an IDE. They recommended IntelliJ, which I was able to get with a free 1-year student license from JetBrains. Armed with my fancy IDE, I kept with Minh's and followed his instructions on "How to write, compile and run a hello world Java program for beginners" skipping to step 3 as steps 1 and 2 were just installing and setting the Windows' path. 

    One day into Java and I was already able to output into my command prompt: 

Sweet Sweet Java Output

    In preparation for using Java for more complicated things, I have read through the first half of the W3Schools Java Tutorial. I find it a good resource for basic functionality even it if lacks depth. With a little translation, much of what I learned in Python will serve me well with Java. The more I learn, the less this surprises me. As Shaffer (2013) points out:
"all modern programming languages can implement the same algorithms (stated more precisely, any function that is computable by one programming language is computable by any programming language with certain standard capabilities" (p.19).

How did I get here? 

    Far too long ago in high school, I took an HTML class. While t I do not remember any of the class itself, I have continued to use HTML throughout the years. Never to make a (successful) webpage, mind you, but I maintained little HTML pages on my local machine as text templates for years. Lately, I have used HTML in my professional work when deep-diving into online text editors with an HTML option. It seems like a trivial thing to me, but my managers are constantly impressed how my documentation is much better formatted than my peers. Little do they know it's just me abandoning the default editor's questionable GUI and manually changing font sizes and family myself. 

    But my most common usage of my HTML knowledge through the years is just a simple understanding that everything we see on the computer screen is the result of lines of code being interrupted by the computer. This code has structure and keywords that work together to make the programmer's vision a reality. While HTML is a markup language, not a programming language, I think it's a good place for beginners to start with learning the most basic concepts of coding. Most every personal computer is already going to have the tools to write and display the results. Within a few minutes, you can SEE the results of what you have created. I don't even recommend that new coders get very far into mastering HTML, unless they really want to, just seeing that connection between code and output, and hopefully getting a rush of pride, is my goal with this recommendation. 

    Last year, I finally got serious about doing actual computer programming. I got connected with a good tutorial for Python though Percipio. I messed it up a bit, but that happens. I love translating how I think into lines of code and watching the results unfold before me. I've been interested in Java for a while now - I would like to make some games and custom calculators, but have mostly focused on honing my ability to problem-solve with Python. Also, there's a lot of hype on the internet about the ease of writing Python making the jump a little intimidating. Well, CPT307 has made this decision for me. 

Here I come Java. 

Resources and Other Links

JetBrains, (n.d.). IntelliJ IDEA – the Leading Java and Kotlin IDE. JetBrains. https://www.jetbrains.com/idea/

Minh, N. H., (April 27, 2019). How to set JAVA_HOME environment variable on Windows 10. CodeJava. https://www.codejava.net/java-core/how-to-set-java-home-environment-variable-on-windows-10

Minh, N. H., (March 11, 2020). How to write, compile and run a hello world Java program for beginners. https://www.codejava.net/java-core/how-to-set-java-home-environment-variable-on-windows-10

Oracle, (n.d.). Java Downloads. Oracle https://www.oracle.com/java/technologies/downloads/

Oracle. (2015). Lesson: Object-oriented programming concepts http://docs.oracle.com/javase/tutorial/java/concepts/index.html

Shaffer, C. A. (2013). Data structures and algorithm analysis. (Edition 3.2). Retrieved from http://people.cs.vt.edu/~shaffer/Book/JAVA3elatest.pdf

W3Schools, (n.d.). Java Tutorial. W3Schools. https://www.w3schools.com/java/default.asp


Saturday, November 4, 2023

Thoughts on Operating Systems

Header image. Arrows pointing to a larger arrow. text: Operating Systems

Hi Ya'll

This is a reflection at the end of CPT304: Operating Systems Theory & Design. I will say that learning about how computers' Operating Systems work, especially I/O, has formed this understanding for me that computers aren't really the one thing I thought they were. I used to imagine computer processors as an interpretive tip that 1s and 0s would slide through, and some magical-how, usable stuff would happen on the computer screen because of it. Now I imagine it as every computer is more like 20 smaller computers in a trench coat. Okay, so what I mean by that is there are all kinds of systems and subsystems that can self-manage and share duties that come together to make it possible for me to type these words and you to read them as two detached events.

Memory Hierarchy
Basic Memory Hierarchy

I've come to understand the difference between memory and storage. The way I see it, the main memory is the farthest down the memory hierarchy the CPU can functionally "reach" and process information from. Secondary storage and beyond are for mass storage of information or program code and are in the category of I/O. The data stored here needs to be pulled into main memory to get used – to become active. One of the "computers in the trench coat" is the controller that moves data between these two memories (Silberschatz, et al., 2014). The controller managing the memory transfer allows the primary CPUs to continue processing instead of having to manage the repetitive data transfer.

Memory Hierarchy with some Processor and I/O callouts
Modified Memory Hierarchy with some Processor and I/O callouts

While I don't have any plans to write my own OS, ever, understanding these concepts does help me more effectively interact with systems when writing code. Personally, though, I feel like my base of understanding of the world has meaningfully expanded. While these exact concepts may not go used by me for some time, I know they exist now. That awareness of these features has been added to the fuel of my imagination and problem-solving capabilities. I may not literally use the knowledge about how I/O device controllers commonly have four 4-bit registers, but I now have that kind of object to consider as a programming solution.

I/O Flow

However, my expanded knowledge around the whats and whys of security protocols is going to be something I can implement right away. User authentication is a critical component of where external security and internal protection meet. All the security in the work doesn't matter if a bad actor can appear to the system as a legitimate user. With how prolific social engineering is, the targeting of the human weakness in security, it's not unreasonable to assume that authorized users in a system will be compromised. Adhering to protection principles helps to limit the damage bad actors masquerading as authorized users can wreak upon a system. The protection principles of Need-to-Know and Least-Privilege will limit the access and capabilities of a user to only those that are needed. It would not be a good security practice if a user could access all parts of all systems. Using the protection principles to minimize user access minimizes the reach a compromised profile would provide (Silberschatz, et al., 2014). So as I work on a project and have to consider what users I share these projects with, I can better secure them with the principles of Need-to-Know and Least-Privilege.

Security and Protection Working Together

Aside from securing a system against outside forces, internal protection still plays a vital role in day-to-day operations of a computer system. One of the fundamental protections is keeping processes in a multiprocess-systems from interfering with each other in unexpected and undesirable ways. Processes use logical memory addresses, which a Memory Management Unit maps to physical addresses, instead of using physical addresses directly (Silberschatz, et al., 2014). This is another example of need-to-know in action in computer protection. By forcing process addresses to go through a conversion, ideally, they can only interact with their dedicated memory spaces.

Sometimes, we can't always predict how we will our expanded knowledge will be leveraged in the future, but that's part of what makes learning so rewarding – the unexpected journeys you can look forward to the new knowledge fueling.  

        Ciao

Resources for Text

Silberschatz, A., Galvin, P. B., & Gagne, G. (2014). Operating system concepts essentials (2nd ed.). https://redshelf.com/

Additional Resources That Influenced Figures

CrashCourse. (2017, June 28). Operating Systems: Crash Course Computer Science #18 [Video]. YouTube. https://www.youtube.com/watch?v=26QPDBe-NB8

Patterson, D. A., & Hennessy, J. L. (2014). Computer organization and design: The hardware/software interface (5th ed.). zyBooks. 

TutorialsPoint. (n.d.). Operating system - Multi-threading. Retrieved from http://www.tutorialspoint.com/operating_system/os_multi_threading.htm