Wednesday, June 24, 2020

Project Oripathy

Project Oriphaty






Project Oriphaty is a visual novel fan game of the popular mobile Game Arknights. It is developed by Andres Cheung(artwork designer, programmer) and Anthony Louie(story-manager, programmer) as part of the portfolio project in the Holberton School program.
Now you might be wondering what a visual novel is? Perhaps you have heard of such a term before? No? The let me introduce you to what is a visual novel first.


Visual Novel

A visual novel, often abbreviated as VN, is an interactive literary genre, which originated in Japan, featuring text-based story with narrative style of literature and interactivity aided by static or sprite-based visuals, most often using anime-style art or occasionally live-action stills. Our particular visual novel is quite simplistic in what a more elaborated one can be. The basics are a character in the middle of the screen, a dialog box at the bottom and a nice background image to fit for a setting.

Visual Novels are interactive games, in other words they let you the player impact some of the characters behavior. The actions you take in the game can significantly impact the outcome of the story being told. 

The purpose of this project is to entertain an audience. In this time of pandemic in particular, where nobody can go outside and with nothing to do, a visual novel game would be a good way to pass the time. I specifically worked on the artworks, a visual novel does nothing without some artworks to use for characters. Both team members are no artists but we managed to use avatar makers online in rinmarugames.com to secure some character sprites in order to create our story characters. The game story is complex and has 2 different endings depending on what path the player chooses to follow.


Project Origin

While we were deciding on what type of project we are gonna make, we joked around on making a dating simulator with a college setting. While we were at it we started looking into the new mobile game Arknights and how we enjoyed it, soon after we were planning on what type of story and what type of visual novel we were gonna make for our project proposal. That's when we decided that a fan game will be our project and started the planning phase. Also, both team members a anime fans or fans of Japanese Animation. We both played with visual novels before so we had a good idea on what features to implement in our game. By using other games features for reference we started making our own with the engine called Ren'py which is specifically made to create visual novels.


In order to make a visual novel fan game of another game, we had to do some research, we looked through the games pages in different regions, trying to take in all information we could so that we could write the story. The story so far is the most important part of the game. It is imperative that it catches the players attention first and foremost in the first few lines of dialog. The Japanese wiki about the game was most useful to get the lore going. We around two weeks writing and planning the story, this task took more time than to code the dialog and functions to the game which took 4-5 days.


Take away

This project was a good experience in how to adapt using an unknown engine and to plan ahead in order to meet the project's deadline. Also to understand the structure on how the engine works with what you give it. For example:


Ren'py uses a series of labels and flags in order to determine what object variable is gonna be displayed on the screen. The trigger events will determine the outcome of the game from the players perspective. They work as On/off flags that will show or hide an object in the screen. Keeping track of all the characters and dialogs is a difficult task but quite simple at that.

The engine provides us with script files where all the code is located, we can split the script files into multiple files and connect them using jump labels so that it is easier to debug. The engine will interpret all script files or files with the .rpy extension as a single script as long as the jump labels connect all the files.

Key Features


Player input: the player can enter arguments such as the name of the main character.


Option Menu: The player can choose certain dialog from a menu that will impact the story.

The save menu: The player can pause and save the game at any point in time and then resume.



Technical Challenge


The most difficult technical challenge is the fact that Ren'py while its written in python it was a completely new engine. By trial and error we managed to implement the features mentioned above.
We've also experimented in a way that we would use a jump label in a menu in order to jump back to the options of the menu and select other choices and hide the previously selected options. Another challenge was to put up a story for our game since there is no visual novel without story and artwork.

The following is a chart for the games story and over all structure on how the game is built.





Conclusion


This project and this curriculum has taught me to self learn. By self learning about Ren'py we managed to create our game. Such skill will be useful for further projects along the way. Working with the Ren'py has been an interesting experience between concepts I know of and the ones I had to learn and understand. I would have done this project a little differently had I had more time to work on it. But in the allowed time we managed to complete the gameplay aspect although we had to skip some features. Over all this project is one of the things I'm proud of making.






Friday, May 22, 2020

Chrome Extension for the Checker!

Chrome extension for the header


What is a Chrome extension?

A browser Extension is a small software module for customizing a web browser. These typically allow a variety of extensions such as user interface modifications, ad blocking, and cookie management. Browser plug-ins are a separate type of module. The main difference is that extensions are usually just source code, but plug-ins are always executable. In 2019, plug-ins have become deprecated by most browsers, while extensions are widely used. The most popular browser, Google Chrome, has thousands of extensions available but only one plug-in, which is the Adobe Flash Player that is disabled by default.

How do I implement a browser extension?


First thing to do is to go the browser settings.

After you select the browser settings you look for the option {more tools} and then browser extensions.


And finally you select which extension to apply to the web browser.



The Checker extension for the web browser

For this HackDay project we decided to create a web browser extension that will return a pop-up message when we run the application. For this we first must take a look on how it works. 


1. Get the Project ID. We can get the project ID from any URL of the Holberton Projects, which is this number.


2. Place it on the box below.

3. Enjoy an encouraging message or a kinda mean one depending on how many tasks you have completed successfully.



Remember to on enter valid project ids for this extension, otherwise it will return a message stating that the argument entered was not a valid project id. Also check out our youtube video tutorial on how the extension works at (https://www.youtube.com/watch?v=UPWtgr63flI&feature=youtu.be)



How does it work?

Now that you know how the extension works, lets talk about whats going on behind the scenes. First we need the access to the Holberton API. To obtain access to the Holberton API you will need its API key. This will let us access the Holberton database in order to retrieve all the elements that we need such as: Email, password, scope and authentication. The authentication on the API is done by requesting an auth_token and use it in every request.

After we get the API key we are going to look into your profile for an authentication token, this will let us access the different projects you have completed in order to use the browser extension. The application access details in your profile such as git hub username or twitter. After gathering the data it converts it to JSON format in order to use it in the next step.

The next step is to use this JSON data to find the project id. We mentioned before that we need the project id to view the project itself and its tasks. All tasks in projects contain a unique ID which is linked to information with the Checker. The Checker is a tool used by Holberton to automatically correct project tasks and assign a grade depending on the percentage of tasks completed.

So how does the above link to the extension?

Using all the compiled information from the Holberton Database, we use this information and to assign values to our own database containing different messages that will display once the project ID has been requested by the extension. The application compares the argument entered with the data gathered and will return a pop-up. The pop-up message will depend on the score assigned to the project. We have a list of messages assigned with values, these values will be chosen at random depending the score threshold. For example if you have achieved a 100% score on a project the extension will return a pop-up with the message: "You are Awesome!" but if your score is less than 100% the messages will go from positive messages to once encouraging to try to resolve the issues you may have during that project.

As of us making this blog-post the extension is not completed, there are several bugs to be fixed. We had hope to finish it as of the day this blog-post is being published but we had to pivot and made an actual website instead. You can download the files for this website at (https://github.com/nhlshstr/holberton_checker_resposnse_generator)

Thanks for Reading!

Authors:

  • Kevin Apostol
  • Christine Pang
  • Travis Bearden
  • Trevor Stevenson
  • Ariana Bibiano
  • Nehal Shastri
  • Andres Cheung

Sunday, April 12, 2020

Typing an URL into your web browser?

What happens when you type an URL in the browser?

What Is A URL (Uniform Resource Locator)?

Today you are sitting at home trying to entertain yourself in the internet. You try Youtube.com for funny videos or read the news on CNN page. Access to all these pages is almost instant, seems like magic right? but it is not. In short, you are requesting access to view a web page every time you type a URL into the web browser. But how does it work? Short answer its complicated. Long answer it consists of several processes that go behind the scenes and occur in an instant.

The DNS

DNS stands for Domain Name System it involves connecting an IP address to a human readable name. An example of a DNS would be 0.0.0.0 being the IP address and its domain name would be EXAMPLE.com. All IP addresses are a series of numbers but they are to long to remember, therefore the DNS was created to facilitate a name to all IP addresses.

When you type an URL for example: https://www.holbertonschool.com into your web browser, what you are doing is submitting a request for this specific website. Step 1.) The browser checks if this website has been accessed previously. Step 2.) The browser and the browser’s OS look for the webpage in their cached data. Step 3.) The browser asks your internet service provider to perform a DNS lookup, this only happens if the site is not found. The domain names hold records that control information in the internet.  

Types of records are: 
  • A record
  • Cname records
  • MX records
  • TXT records

TCP/IP

All devices that are connected to the internet posses a unique number that identifies them called IP Address. An IP address is a 32 (IPv4) or 128-bit(IPv6) number that is written in dotted decimal notation. They are very important for network communication and they are assigned by network authorities. TCP Stands for Translation Control Protocol. 

When the server finds the requested data when trying to access web page content, it sends it back to you. This happens through the TCP/IP protocol, that establish a connection between both devices using their IP addresses. Through this reliable connection, the requested data is broken down into packets and it reassembles as it travels through the network back to its destination point.

Firewall

This is a device that burns down any type of IPs trying to access your web server. Jokes aside, this is a very important service when you access a web page. It prevents unauthorized programs or malware from going through the active connection you have with the web page you are viewing. It also protects your connection to any web server by supervising incoming and outgoing traffic. If i were to access the URL (https://www.holbertonschool.com) through an unauthorized port the firewall will prevent me from entering and display an error in connection.


HTTPS/SSL

The actual request being made by the browser once you type the URL is called an HTTPS request. HTTPS stands for HyperText Transfer Protocol Secure, in other words, it is the secure version of the HTTP protocol. This protocol is in charge of managing how requests and messages are being transmitted and formatted through the web. Once your browser makes a HTTP request, the server receives the request and proceeds to fetch the requested data. In the end,  the server sends back an HTTP response back to the web browser.

Load-Balancer

Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool. Its main role is to efficiently redirect web traffic to multiple servers and to do this it relies on several algorithms:

  • Roundrobin: web traffic is redirected evenly between servers.
  • Least Connection: web traffic is redirected to the server with the least amount of requests.
  • IP Hash: web traffic is redirected depending on the client’s IP address.

Webserver

A web server is a software that takes care of delivering the content of web pages to clients through the HTTP/ HTTPS protocol. The incoming traffic is redirected by the load-balancer, then, the web server receives the path to the requested by the HTML files through the HTTP request. Finally,  the web server looks for those files in the server’s codebase and once it fetches those files it's ready to make the HTTP response. Nginx and Apache are some examples of webservers.

Database

It is a structured set of data held in a computer, especially one that is accessible in various ways. Information requested by a server can be held in a database.




Sunday, January 26, 2020

Machine learning



Machine Learning

Image result for machine learning stock photo

What is Machine learning?

Technology is advancing at a very high rate in today's world, we have used it to create things that can help us learn new things and to satisfy our needs. Now, let's take it to the next step by making our machines more sophisticated. Usually we have to tell a machine to perform a task, but what if we could make it execute that task on its own? 

Machine learning is the scientific study of algorithms that a computed uses to perform a specific task without requiring instructions. It relies on patterns and inference to perform. The computer in machine learning uses a mathematical model to analyze data to make predictions without having to be asked to perform such action and it is also a form of artificial Intelligence or AI for short. In other words, its a computer that works independently, like all the robots you see in movies about science fiction. 

What is AI?

In computer sciences, AI or Artificial Intelligence is intelligence demonstrated by a machine or computer and it is compared to human intelligence. It also the study of intelligent agents any device that perceives its environment and takes actions that maximize its chance of successfully achieving its goals or completing its tasks. the term artificial intelligence is often used to describe machines that mimic cognitive functions that humans associate with the human mind in things such as learning and problem solving.

We have different types of AI called strong AI and weak AI. Weak AI are the types of AI that work more like an assistant or task manager. Google assistant is an example of weak AI it works to manage your schedule, set up reminders, control the lights on the living room. It is designed to deal with the mundane tasks of our lives. Now, strong AI is something out of science fiction. Strong AI is the type of AI that can perfectly replicate how the human brain is. It is unfortunate that we have not reached these type of technology because to fully perfect it we have to understand how the brain works.

Deep Learning

Deep learning is an artificial intelligence function that imitates the works of the human brain in processing data and creating patterns for use on decision making. Deep learning is a sub-set of machine learning in artificial intelligence that has networks capable of learning unsupervised from data that is unstructured or unlabeled. It is also known as deep neural learning or deep neural network.

Deep learning has evolved hand-in-hand with the digital era and has brought an explosion of data in all forms and from every region of the world. This data, known simply as big data, is drawn from sources like social media, internet search engines, electronic commerce platforms, and online cinemas. This amount of data is accessible and can be shared through applications like cloud computing.

Labeled and Unlabeled Data

Labeled data is a group of samples that have been tagged with more than one label. Labeling typically takes a set of unlabeled data and augments each piece of unlabeled data with meaningful tags that are informative. Unlabeled data is consists of data that is either taken from nature or created by human to explore the scientific patterns in it. For example, unlabeled data can include photos, audio recordings, videos, news articles, and tweets.

Uses for machine learning

  • Image Recognition: Implementing machine learning into image recognition involves making a computer learn, through a learning model, the different key features of an image. Some examples of its uses are pattern recognition, face detection, face recognition and optical character recognition.
  • Sentiment Analysis: Implementing machine learning into Sentiment Analysis is a process of determining the opinion or attitude of a speaker or a writer in the tone they use to express themselves.
  • News Classification: Using machine learning for News Classification lets us determine what type of content a user is asking to see. It's like telling a computer to give me the sports channel without telling it to give me the sports channel.
  • Information Retrieval: It is the process of extracting structured data from the unstructured data.
  • Medical Services:  Machine learning methods, tools are used extensively in the area of the medical-related problem. For Example: As an instance to detect a disease, therapy planning, medical-related research, prediction of the disease situation. Using machine learning software in the healthcare brings a breakthrough in medical science.
  • Social Media: Using the machine learning approach, social media can create attractive features, giving recommendations, reactions, topics of interest for the users.
  • Predictions: Prediction is the process of saying something based on past history. Examples can be weather prediction, traffic prediction, stock market and more. 

Learning Algorithms

Machine learning has several learning methods, it's main methods are: Supervised Learning, Unsupervised learning, Semi-supervised learning and reinforcement. It collects input which is data collected from a source and it produces an output that is the result of the data input. Machine learning models require a lot of data in order for them to do well. In order to train a machine using a learning model, one needs to collect representative sample of data from a training set. Data from the training then can be set in varied like texts, a collection of images, and data collected from individual users of a service.

  • Supervised Learning: Algorithms are learned from data provided from humans and both the input and the output data are already known to the machine. It experiments with the input and compares its output with the expected output and is able to know whether or not it needs to modify algorithms to match that same expected output. This way of learning can be useful when a future outcome is expected based on specific patterns from the input data.
  • Unsupervised Learning: Algorithms are given raw unlabeled data where the output is unknown. With raw input being provided, the program needs to be able to come up with ways to use it and categorize it. Then, the program studies the input every time and eventually learns how to use it in order to find hidden and complex patterns. 
  • Semi-supervised learning: This method falls in between into Unsupervised and Supervised learning, using supervised learning to make better predictions and come up with better patterns. Facial recognition is a good example of Semi-supervised learning. 
  • Reinforcement: The program is exposed to many sets of data that and based on that exposure it comes with a solution. Reinforcement learning is dependent since it makes decisions sequentially so all later input data depends on the previous output. In reinforcement learning, we have components called agent and reward. The agent is the decision maker and is supposed to come up with the best way to get to the reward, that is the most desired outcome. Reinforcement is used in robotics, navigation, industrial automation, creation of training systems, and gaming.

Importance of Machine learning

Due to its global demand companies are using machine learning to increase their productivity. Task that would otherwise take most likely an hour to complete are done in seconds thanks to automation. Car factories around the world use robotics with learning modules to perform tasks that would take an entire team to complete. Another example is the email automation, massive amounts of marketing emails are sent daily to user in order to inform them about their products or services and its completely done by a computer. Self-driving cars are becoming more of a reality than science fiction but, we should also see the down side of automating jobs.

Morals of Machine Learning

One of the questions asked about automation is: Is it morally correct for a machine to take the job of a human? The field of AI was created under the assumption that human intelligence could be replicated into a machine, however, there is mixed feelings about this topic. This raises philosophical arguments about the nature of the mind and the ethics of creating artificial minds endowed with human intelligence. AI has been seen as fiction for the most part until recent days, the fact that we can trade human mistakes for efficiency will lead to a risk of mass-unemployment. In the end, Machine learning has been applied to a lot of things in our daily life.

In the end...

Machine learning involves several training techniques that a machine uses to perform tasks in a  similar or superior ways to the human brain. There are a lot of things to take into account when it comes to the performance of a learning machine. These include the type of data that’s being used The methods applied: supervised, unsupervised, semi-supervised. Also, the algorithms that follow those learning methods and the math behind it. The way we incorporate machine learning into our lives is also important and has made our way of life easier. It is as if all the things we see in science fiction are now becoming a reality. Machine learning has its ups and down but it is something that will define the future of technology.

References

Wednesday, January 15, 2020

Object Oriented Programming

Object Oriented Programming


What is Object Oriented Programming?

Object Oriented Programming or OPP for short is a programming paradigm based on the concept of objects that contain data in the form of fields. The concept utilized in python for this type of programming revolves around the concept of encapsulating data inside data and being able to treat a collection of things as one individual thing. Computer programs are designed by making them out of objects that interact with one another. The OOP languages are diverse and the most popular ones are class-based, meaning that objects are instances of classes that also determine their types.

What is id and Types?

All objects contain a unique id where the object is stored in memory, and we can compare different variable ids in order to identify what data type an object is. The "type()" function will tell us what data type an object is.
For example: 


We can also determine if an object is mutable and immutable by its id.


Immutable Objects

Immutable objects are that cannot be changed after they are created. Examples of immutable objects are: integers, floats, bool, string, unicode, tuple.


In this example we assigned a value to "animal" to the string fox and "insect" to the string spider.
What will happen if we tried to changed them? Let's find out!


We can tell it’s a different object because the id’s are different. This means that we have created a new object! By changing the value of the string fox and the string spider we ended up creating 2 new objects. We can't change the value of these types of object but it is possible to assign a new value to it.

Mutable Objects:

Mutable objects are objects who's values can be changed without altering its id in memory.
Examples of Mutable objects are: Lists, sets and dictionaries.


In this example "fox" is mutable object and we set dogs to point to fox in memory and that is why they have the same id. 

How does python handle mutable and immutable objects?

Data types are treated differently whether or not they can change their identity or their id. Mutable objects can change and add their values without altering its id in memory. On the opposite side,  immutable objects can't keep their original id if then change their values. Understanding how these objects work can be helpful on deciding what data type to assign to any object. 

Arguments and Objects

In Python, arguments take objects as parameters for reference. If we pass  a mutable object to a method, we are passing a reference to this object so we can freely modify its value. However,  if we decide to pass an immutable object as a parameter, we can’t change the value of the object. For example:


In this example we are trying to change the content of the list with types of animals by appending another value to it. We can do this because the we are passing a mutable object as an argument.


In this example, we are trying to increment the value of "number". However since we are passing an immutable object and modifying the function without returning the value. The integer is passed but when we try and print it the value stays the same.