Yousaf Zahir Computer Scientist 🕹️ The University of Calgary
Welcome to my website, here are links to some recordings of my personal projects.
These links are intended to be used in conjunction with my resume.
THE PROJECTS ARE ORDERED CHRONOLOGICALLY FROM MOST RECENT TO OLDEST.
Kingdom of Predators 2024
The paper can be requested via email.
An agent-based emergence simulation of a predator-prey ecosystem made in Unreal Engine 5 with C++ as my final project for CPSC 565: Emergent Computing class. This project was completely planned, designed, and implemented by me. Notably, the creatures' decisions are solely composed of information they can collect. In other words, there is no external data being transferred into the creatures; rather, the creatures are looking and listening to collect their own data. Here’s where the emergence comes in: all the creatures are relatively simple, but as a consequence of many of them acting together, more complex behaviors emerge.
This project aimed to see whether agent-based simulation could be used to create believable actors and assess the viability of using such a system in games and other simulations. The hope was that emergence-based behavior would prove to be a viable solution for making virtual worlds feel alive and not mechanical. The project was largely a success; however, further exploration needs to be done to assess the viability of such agents in virtual worlds beyond simulation.
The project was made using Unreal Engine 5 and C++, and no blueprints were used. The StateTrees plugin was used to implement the creature AI.
// This is sample code from a animal/creature actor in a simulation made in Unreal Engine 5. Comments have been added to provide additional context regarding some objects.
// This code was entirely written by me, without the help of AI. It was written under significant time constraints as it was a small piece of a final project I worked on, I have decided to leave
// many parts of the code unchanged (except for the addition of comments), so that it is a more realisitic depiction of how I write code under tight time constraints. That having been said,
// looking back I would quite a few changes, which I would be happy to discuss.
void UData::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) {
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
FVector OwnerLocation = Owner->GetActorLocation();
FRotator OwnerRotation = Owner->GetActorRotation().Clamp();
// directionArr is a small array corresponding to the direction that character is facing, whereas memory is a 360 sized array corresponding to all the directions the creature can face.
int arrOffSet = OwnerRotation.Yaw;
directionalArr = &memory[arrOffSet];
// below code decays lastHit and energy variables over time.
if(lastHit > 0) lastHit -= DeltaTime;
if (energy > 0) {
energy -= DeltaTime;
if (energy <= 0) ProcessHit(attr_health);
}
UpdateHealth();
// Raycast parameters
FCollisionQueryParams TraceParams;
TraceParams.AddIgnoredActor(Owner);
FHitResult HitResult;
// the creature shoots raycasts in a conal shape in the direction it is facing. Each i corresponds to a degree.
for (int32 i = 0; i < directionalArrSize; i++) {
TArray Hits;
// this is used to know the direction of the raycast relative to the owner
FVector Direction = OwnerRotation.RotateVector(std::get<1>(directionTuple[i]));
// Perform the raycast
if (GetWorld()->LineTraceMultiByObjectType(Hits, OwnerLocation, OwnerLocation + Direction * 1000.0f, PawnsAndCorpses, TraceParams)) {
int sumOfHits = 0;
for (auto Hit : Hits) {
// check to see if a character was hit, if it was then we check cached information to see if we've computed owner creatures attraction to hit creature. If it's the first time hitting the creature, then we compute
// attraction and store the value.
if (Hit.GetActor()->GetName().Mid(0, 12) == "BP_Character") {
if (!IDMap.Contains(Hit.GetActor()->FindComponentByClass()->ID)) {
IDMap.Add(Hit.GetActor()->FindComponentByClass()->ID, CalcAttraction(Hit.GetActor()));
}
if (!(Hit.GetActor()->FindComponentByClass()->IDMap.Contains(ID))) {
Hit.GetActor()->FindComponentByClass()->IDMap.Add(ID, CalcAttraction(Owner));
}
}
sumOfHits += gameObjectToAffinity(Hit.GetActor());
}
// this assigns an attraction value to a direction that the creature can move. The creatue will move in the direction of the highest attraction value.
memory[(arrOffSet + i) % 360] = sumOfHits;
// update highest if necessary
if (sumOfHits > highestHit) {
highestHit = sumOfHits;
highestHitI = (arrOffSet + i) % 360;
}
// if we are debugging, if we hit something draw the raycast red, otherwise green
if (seeDebugLines)DrawDebugLine(GetWorld(), OwnerLocation, OwnerLocation + Direction * 1000.0f, FColor::Red, false, 0.1f, 0, 1.0f);
} else {
if (seeDebugLines)DrawDebugLine(GetWorld(), OwnerLocation, OwnerLocation + Direction * 1000.0f, FColor::Green, false, 0.1f, 0, 1.0f);
}
}
DecayMemory();
}
❮
❯
This is the caption for the video.
Pathfinder 2022
This is Pathfinder, a project I made over the summer of 2022 to learn and implement pathfinding algorithms, specifically BFS and DFS. I had learned them for the first time a
a year ago or so and had forgotten them over time. So, I came up with a project to work on which would help me practice and understand the algorithms.
The project was made using Unity 3D and C#, and I relearned the algorithms using MIT OCW.
KorEscape 2022
The GDD can be requested via email.
This is KorEscape, a game my group and I made for Art 503 during the Winter semester of 2022. It was made using the Unity Engine and C#.
To get a proper breakdown of all the features in the game you can download the game design document from above. All of the programming and
implementation (setting up animations, setting up the map layout, etc.) were exclusively my responsibility.
Untitled Unity 3D Game 2021
This is a game made for the GDN 2021 Game Jam over the course of 4-days that was actively worked on
by myself and one other person in Europe who I met online for the purpose of the game jam. We both worked on it
remotely using Unity 3D, C# and GitHub. This was my first time working with another person on a game jam as well
as working with Unity 3D.
Fallball 2021
This is a game I made for the Innovators' Jam 2021, a solo game jam with the theme of "can't stop moving". I designed
and developed this game over the course of 48 hours using Unity 2D and C#. This was also my first ever game jam.