Something went wrong. Try again later

DecoyOctopusX

Yo dawg, I heard you like Techno.

53 0 13 3
Forum Posts Wiki Points Following Followers

Introduction to Programming

This article will detail some of the basic concepts used in every programming language to build the applications that we all know and love. This is not intended to be a tutorial you follow to learn how to program, it is a starter document for learning some of the important concepts required to get started programming. If you know nothing or next to nothing about programming this article is for you!

Variables in programming are text characters that signify a place in your computer's memory, usually RAM(Random Access Memory). They are allocated to your program by the Operating System (i.e. Windows 10/Ubuntu) or memory controller of a program your code is running on top of. Variables are the basis of all programming because at the end of the day programming is nothing more than telling the computer what data goes into which memory. Though over the years, 1970 onwards, many people and teams have developed tools, other programming languages, and hardware to make this process easier. A graphics processing unit or GPU is one such piece of hardware. Developed specifically to make it easier to get graphics to the screen faster. Below is an example of basic variables in C:

No Caption Provided

Each of these variables takes a bit of information and stores it in memory for the program to use later. Color coded in aqua are the variable types bool for boolean, int for integer, float for floating point number, char for character, and the last one is still defined as a character but the brackets next to the variable name signify that it is a string of characters. The const keyword tells the compiler that this variable is constant and never changes. In programming a constant variable is usually useful for defining sizes of variables, but they can be used for whatever you want so long as it does not change. The compiler will throw an error at you if you try to change it. Not all programming languages use type specifiers for variables for example in Lua you could just write something like this:

No Caption Provided

You may also notice that in that example I have no semicolons after each variable definition. Not all languages require these as well. The reason programming languages have type specifiers is because each type takes up a different size of memory or the memory is read differently. By specifying the type you can be more precise in how you use your memory instead of letting the compiler pick for you and hoping it is correct. This is the primary reason a lot of games are programmed in C++ and C#(C Sharp). Those languages give you a finer degree of memory control so you can use only what you need, and do so fast. This is also a double edge sword, because under these conditions you need to make sure memory is allocated correctly otherwise it can break things in a major way. Usually resulting in the program crashing, or in the worst case the whole computer crashing.

Variables need to be changed for anything to happen though, and we do that through functions also known as methods, procedures, subroutines, and many other names. Today I will call them functions because that is basically all encompassing. Functions take a number of variables as parameters and returns another value to be used later. Below is an example of a function that adds two numbers together:

No Caption Provided

You define functions to modify or create variables or call other functions to achieve your program's goal. There are also predefined system functions in most programming languages that do a lot of the more menial tasks or complicated work for you. Below is are two examples:

No Caption Provided

The first line is a call to XWindows API(Application Programming Interface) which takes the parameters we have defined and does all the complicated work of turning that into a Window on a linux based desktop. The second line is one in programming you will see a lot of. That is the standard C function for outputting text to terminal/console. On Windows based systems that would output something similar to this:

No Caption Provided

Using variables and functions in combination with predefined functions to build an application that the end user can use. Whether it be someone at a bank, one of those rascally gamers, or someone staring at a six second video through your phone application. Programming is an incredible tool, and is quickly becoming an essential skill in modern society. I hope you have found this useful to some degree.

A quick note: I will be doing an article(s) detailing writing a full application. I am just looking for a good tool set to do so that is free and easy to use. Wouldn’t want someone to have to buy something to complete a tutorial. Anyways, have a good day!

3 Comments

Analogue Audio Setup for Streaming/Recording

Many people are looking to stream games and while it is relatively easy to get video out to stream, people constantly have audio issues. Here I will explain the audio setup I've used to get both game audio and microphone out to stream or a local recording. Below is a list of the hardware required for completing this setup.

Required Hardware

  • PC for steaming
  • Analogue Headphones (i.e. Sennheiser HD280PRO)
  • Analogue Audio Mixer (i.e. Alto ZMX 862)
  • Analogue Condenser Microphone (i.e. Sterling ST151)
  • Microphone Stand
  • (Recommended) Microphone Shock Mount
  • (Recommended) Microphone Pop Filter
  • 1-2 6.35mm(1/4inch) male to 3.5mm(1/8 inch) female adapters
  • 2-3 6.35mm(1/4 inch) dual stereo to 3.5mm(1/8 inch) stereo cables
  • XLR Male to XLR Female cable
  • (Recommended) PC Sound Card (i.e. Creative Sound Blaster)

Alright once you have these things you are good to start configuring the setup for stream use. Note that you don't have to have exact matches for anything except the cables. Any analogue mixer, microphone, or sound card will work. You can use your on-board PC sound but with some computers it will cause signal noise in the form of buzzing on the main mix. On an Alto ZMX 862 you have a number of ports for hooking various pieces of equipment up. The primary ones you need to be worried about are channels 1-8. Channels 1 and 2 are reserved for XLR ports that connect to a microphone. Ports 3 and 4 are for Left-Right(Stereo) audio in, as well as for channels 5 and 6. Then to the right of those panels you want to look at the Left-Right ports for main mix. The main mix is output channels where all the audio you have pushed into the mixer is then mixed down and pushed out. The only other port your should take note of is the phones port. This is for your headphones to go into so you can monitor the audio levels during streaming or recording. Below is a diagram showing how the cables for input and output should be setup:

No Caption Provided

You will want to insert one of the 6.35mm Dual Stereo cables into the Left and Right Channels (3 and 4). Then take the opposite end of that cable which should be a single 3.5mm stereo male jack and insert that into your PC Audio Out(Usually a green connector). Now you will want to take another of these cables and insert the dual stereo into the left and right main mix channels respectively. Take the opposite end of that cable and insert it into your PC Audio In(Usually a blue connector). Lastly you will want to insert the XLR cable into your microphone and then into the XLR port(Channel 1 or 2) of the mixer. Then take your analogue headphones use the 6.35mm to 3.5mm adapter to convert it and insert it into the phones plug. Now your audio setup is ready to be used! For the microphone to work properly you will want to make sure the Phantom Power switch on the mixer is on. This provides extra power so the microphone receives the power it needs to operate. After his point you will setup OBS/XSplit/VMix to take the audio and mute the desktop audio to avoid doubling on stream. Now you are ready to stream all by yourself. It should be noted however that with this setup if you are talking to people on Discord, Skype, etc. They will hear your game audio due to it feeding back into the same system. If you want to remedy this issue you can either use a second USB microphone just for Discord or Skype, or use a second PC for streaming/recording and split the microphone output out and feed that into the game PC. Once you start to see how the cables are routed and what is happening in the recording it should all become pretty obvious as to what is happening. I know this can be a lot to take in, and honestly I might be forgetting something, but if you have any further questions feel free to shoot me a PM on here. Always happy to help!

One last thing, the other channels can be used to hook in a second microphone or you can take one of the dual stereo cables and hook it to a phone to use as a sound board or feed Discord from there. Have a great day everyone!

1 Comments

Playstation 5 System Architecture Explained

With Sony's reveal of the hardware specifications and architecture it's easy to say at a glance, "the specs are lower than the Xbox Series X," and call it at that. Though things are not as simple as they seem. At it's core the Xbox is still basically setup like a PC, but with many things directly attached for faster speeds all around. Though the bottleneck you run into is pushing all of your data through the processor I/O controller before it even hits the RAM, GPU, or anything else it needs to. I had a hard time acquiring any AMD processor technical datasheets so here is one of an Intel i9. The construction of the chips and controllers only vary slightly in terms of actual layout.

source: intel.com
source: intel.com

So as seen here you can see that for a typical PC processor, all the data needs to be routed through one of the system controller chips to get where it needs to go. When trying to process large volumes of data for a game, this creates a bottle neck. Like trying to push too much water through a hose eventually it will back up and cause problems. In the case of a game you have to scale back assets and features until you meat the I/O Controller's bandwidth requirements. Now on to the way the PS5's SoC(System on a Chip) is setup.

source: Sony Road to Playstation 5 Video
source: Sony Road to Playstation 5 Video

In the case of the PS5 there are custom I/O controllers for each place you need to send data. This basically gives you an independent channel of bandwidth for each specific task meaning a programmer can push large amounts of data through to each area simultaneously. This is what will allow developers to eliminate load times, hitching between game sections, etc. Basically instead of one hose to push your water through you now have six hoses, and obviously that equates to a lot more water going where you want. I don't have the details of the Xbox Series X SoC, but considering they mentioned wanting to run more generalized applications and the possibility of installing Windows 10 it seems unlikely Microsoft would take this approach due to the way Memory Access works within the Windows system. If I am correct this means that though the specifications of the PS5 are slightly less, it could still potentially out-perform the Xbox Series X through sheer throughput. Take this all with a grain of salt though, this does not necessarily mean all games will utilize the technology and be able to achieve the same performance as Sony first-party studios. Not every studio has the time, or the budget to invest in the R&D necessary to fully utilize the technology. In the case of Xbox you are basically programming like you would for a Windows 10 PC which is far easier for sure. I guess everyone will eventually see how this plays out though, but PS5 from a hardware and programming perspective is certainly very tantalizing. That is my two-cents on the subject, have a good day everyone!

9 Comments