Ryan Lodter    Projects    Posts    About    Search

Making Mario 1-1 in MonoGame

What I Made

I remember playing the original Super Mario Brothers after I found my parents’ old NES in our garage one summer. I put many many hours playing the iconic game but I never beat it. I became obsessed once again many years later.

When I was in my 3rd year of college, I was tasked of working with a team of other students I’ve never met before to make Mario level 1 world 1 from scratch in a language (C#) and game engine (MonoGame) none of us had ever used before.

Why I Made it

As part of my Computer Science degree at Ohio State I had to take a “project” class. I could choose from three options and I went with the game design project since I had never done something like that before. I learned a lot more than I could have imagined.

What I learned

First, we had to learn C# and all of it’s oddities. The language proved to be easy to pick up but switching between languages between my other classes caused a lot of dumb errors and non-standard code. I grew to really like C# since the documentation was thorough and the object-oriented tools were really intuitive to me.

Next we learned project management. Five busy students with other classes and jobs is a great environment to learn how to collaborate. We used Microsoft tools to manage everything and we had in-class meetings with our teacher to guide us.

The biggest thing I learned was that each member of the team needs to document what they are working on to an extent that if they disappear, someone else can pick it up without much effort. This became relevant to me when one of our group members suddenly dropped the class without any warning. Our group fell way behind in our sprint since 20% of the work was suddenly unaccounted for. After that, we all were very specific in our assigned tasks and talked frequently to make sure at least one other person understood what we were working on.

The last and most time consuming aspect of this project was actually using MonoGame to make Mario. I focused on the game physics and level creation. These ended up being very intertwined because there were many bugs related to the collision in the game that caused me major headaches. Once we reached the last sprint, I finally ironed out the, sometimes hilarious, collision and physics bugs. I was only able to work these things out once I sat down with my team members and talked through what they had worked on in order to understand how my contributions interacted with the rest of the game. This taught me that sometimes over-abstraction is counterproductive.

In the end the remaining four members of our team because close friends. We had a great time hanging out late at night working together in a Discord call.


Blacklist It!: Filtering Extension for r/Popular on Reddit

What I Made

Blacklist It! is my Chrome extension that allows you to build a list of subreddits you don’t want to see on the r/popular page of Reddit.

Why I Made it

I was sick of seeing a lot of the subreddits that were consistently at the top of Reddit. Specifically, ones like r/trashy and others that are often offensive or just gross. I decided to apply my next few weeks learning how to build a Chrome extension and I created exactly what I needed. Although there are other tools that accomplish what I made, most of them are too broad or complex for my needs. After using this extension of a few months I found Reddit useable again. If only I could use it on the Reddit iOS app…

What I learned

I was already familiar with JavaScript from my Latin translate tool project so I felt confident I could figure out how to make this work. The solution I implemented works by going through the elements of the page and recursively looking for strings matching the list of blacklisted subreddits. Then I delete the entire element which results in the post from the subreddit completely disappearing before the user even realizes.

I had a simple, working, version of the project within a day’s work but every time I closed Chrome, all my inputted subreddits disappeared. I then spent the next week trying to get the storage of the data to work the way I wanted. I lost a lot of time trying to implement solutions I found online without understand how they work. Once I sat down and read the documentation I was finally able to do exactly what I wanted.

The last thing I worked on was adding a dark mode. This was mostly for fun and the way I did it was swapping style sheets. I also stored the dark mode state to keep the style the same between launches.

I am still very proud of this project because I feel it was the first time I made something I would use every day to solve a problem. This project’s success was a big boost to my confidence as a developer. I never felt discouraged and I believed in my ability to solve any problems I ran into.


How to Account for Leap Years when Computing Date Differences

The Problem

I needed a Python script that takes in two days and outputs the difference between then in days. When testing my script I realized I wasn’t accounting for leap years so I was consistently off when the gap between the dates overlapped leap years.

My Solution

Setup

Declare number of days in each (non leap year) month using a dictionary.

months = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 
7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}

Get and parse the start and end dates into variables.

#get start date
date = input("Enter start date (m-d-year): ")

dash_index = date.index('-')
month_start = int(date[:dash_index])
date = date[dash_index + 1:]

dash_index = date.index('-')
day_start = int(date[:dash_index])
date = date[dash_index + 1:]

year_start = int(date)

#get end date
date = input("Enter end date (m-d-year): ")

dash_index = date.index('-')
month_end = int(date[:dash_index])
date = date[dash_index + 1:]

dash_index = date.index('-')
day_end = int(date[:dash_index])
date = date[dash_index + 1:]

year_end = int(date)

Now all I need to do is calculate the difference.

First I initialize the difference variable.

difference = 0

Now, the reason I wrote this post. Calculate the number of days that need to be added for leap years.

The first case is leap years between the two dates not including the start or end year.

num_leap_years = 0

for i in range(year_start + 1, year_end):
	if i % 4 == 0:
		num_leap_years += 1

The next case is if the start date is in a leap year and before March, we need to add a day.

if year_start % 4 == 0:
	if month_start < 3:
		num_leap_years += 1

The last case is if the end date is in a leap year and after February, we need to add a day.

if year_end % 4 == 0:
	if month_end > 2:
		num_leap_years += 1

Next I calculate the number of days between the dates including the leap years correction.

#find number of years between the two dates	
year_difference = year_end - year_start

#add the number of days between the years including the leap days
if year_difference > 0:
	difference += (365 * year_difference) + num_leap_years

#add number of days for the ending months
for i in range(month_start, month_end + 1):
	difference += months[i]
#subtract the number of days for the starting months
difference = difference - day_start
difference = difference - (months[month_end] - day_end)

Finally I print out the difference in days.

print(str(difference) + " days")

Latin Translate Tool Project

What I Made

Why I Made it

This summer I had a friend come to me talking about his struggles with translating Virgil from Latin. After having him explain to me the repetitive nature of looking up any unknown root on Wiktionary, I realized I could help. Thinking back to the LeapPads I played with in early schooling, I wanted to make a website that allows clickable words that link to the appropriate Wiktionary page and section to help translators find what they needed quicker much like the pen on the LeapPad.

What I learned

blah blah blah blah