As part of the development team at 360, I spent my time working full-stack on the numerous client sites. This was almost entirely using a Laravel stack, with Bootstrap, Jquery, and vanilla CSS.
As part of the development team at 360, I spent my time working full-stack on the numerous client sites. This was almost entirely using a Laravel stack, with Bootstrap, Jquery, and vanilla CSS.
+
As part of the development team at 360, I spend my time working full-stack on the numerous client sites. This is almost entirely using a Laravel stack, with Bootstrap, Jquery, and vanilla CSS.
Skills: PHPLaravelJqueryBootstrapSQL
diff --git a/guides/guide-to-server-hosting.html b/guides/guide-to-server-hosting.html
index 447293a..48f377a 100644
--- a/guides/guide-to-server-hosting.html
+++ b/guides/guide-to-server-hosting.html
@@ -16,7 +16,7 @@
Jump directly to main content
-
I'm Aney, a developer, and self-hoster that enjoys art/design, automation, Unix, and those pesky Japanese cartoons. Yes, that's a straight up rip from the homepage, why re-invent the wheel right?
-
-
I set this website up as a means to share information to educate, and help people, as well as to easily point people to my answers for common questions.
+
A developer, and self-hoster that enjoys art/design, automation, Unix, and intentional living.
What do you do?
-
I'm currently taking some time away from work, but looking for places I believe I'd be a good fit. I love solving problems, optimising sites, and creating designs/experiences, so I'm kind of a developer at heart.
-
Outside of work I practise minimalism, frugalism (to an extent), and work towards Financial Independance (FI/RE). I also love the idea of OneBagging, self-sufficiency, and travelling, so these are things I'm trying to work towards.
+
I'm a web developer. Currently working for 360. For more details, and previous employement check my CV.
-
What else do you do?
-
Ok sure, I'm (extremely) slowly working on the basic infrastructure, and website for aNetwork, a gaming community, and public game server host. I'm also working on writing guides on server hosting, and web development.
-
If there's ever anything else, you can find out more on my projects page, or on my blog.
I keep a little Blog, work on other Projects, and often play video games with friends, read, or watch video media. I try to walk a few times each day, and do some very minor exercise.
What do you own?
-
Following up on the minimalism, it seem you've almost got to do an "everything I own" to prove you only have 6 items in your possession. I'm not that bad, yet, but I honestly feel like that's like my little hidden goal.
-
I've got a few pages about this on the site, so if you do want to know, check out:
+
+
Maybe this seems a little odd, but as I also practise minimalism, frugalism, and work towards OneBagging, Financial Independance (FI/RE), no-waste, and intentional living. I thought I'd add this, so I can have some public facing 'accountability' as such.
Red, a custom built machine sporting an R5 2600X, 16GB RAM, a 500GB EVO 970 NVME, and a Vega 64. This is my only device running Windows.
-
I currently still have this to play Windows exclusive games/games without Linux Anti-Cheat enabled (Smite namely) with friends. Once HiRez sort their shit, it's gone.
-
Steam Deck
-
I also have a Steamdeck, which will 100% be my gaming PC once games I need Windows for get sorted.
+
+
Gaming
+
+
Acer Nitro AN515-57
+
Nitro 5, with an i5-11400H, 16GB RAM, RTX 3050, 512GB+250GB NVME
+
+
Steam Deck
+
I also have a 256GB Steam Deck (Original), with a 512GB SD card, for couch, and chill games. This is often accompied (for couch gaming) with a PS4 controller, and a Dock.
Media Consumption
-
-
TV
-
A basic non-smart TV from the good ol' days. I got it for my 16th Birthday, around 10 years ago.
-
Fire TV Stick 4K
-
Since my TV is useless alone, and I don't watch traditional television, this is plugged in to give me access to Netflix, Amazon Video, and Jellyfin.
-
-
-
-
Amazon Echo 4
-
I don't use this for anything other than playing music. It stays next to the TV waiting for me to say "Alexa, play We like to party, by the Vengaboys."
-
-
Amazon Echo 3
-
Same as above, but this one's upstairs so the music plays uninterupted through the house
-
+
For shows, I use an old TV I got from my 16th birthday, that fuzzes when it's on paired with an Amazon Fire Stick 4K.
+
Youtube, and other 'non-regular' media is watched straight from my laptop, or phone.
+
As for music I use my phone connected to my Soundcore Mini 3, or just listen from my laptop.
An HP 290 G1 MT, with an i5-7500, and 32GB RAM. This was my primary server, acting as my virtualisation host, NAS, adBlock, and media server. It also runs git, my game servers, and anything else I feel like hosting at the time. A consideration is upgrading to a 7700/7700K, but UK energy issues had me switching to RPIs for a while.
I've written this website with the intention to keep it minimal, quick, small, and easily self-hosted. I decided that there was little reason to bloat the pages with images, that add little value, as all they will do is prevent people with poor internet from visiting.
-
-
Wow! You're so cool, how can I support you?
-
Thanks, although I disagree.
-
You can support me by sharing any posts, and/or pages you enjoy to your friends, or by donating to me via my Support page.
+
If you've found my site useful, you can support me by sharing any posts, and/or pages you enjoy to your friends, or by donating to me via my Support page.
diff --git a/bedroom.html b/bedroom.html
new file mode 100644
index 0000000..d8205cf
--- /dev/null
+++ b/bedroom.html
@@ -0,0 +1,216 @@
+
+
+
+
+
+
+
+
+
+
+
+ My Bedroom Belonging
+
+
+
+
+ Jump directly to main content
+
Aney's Bedroom
+
+
+
+
+
+
+
+
+
+
My Bedroom Belongings
+
+
The items that typically live in my bedroom, assuming I'm currently staying in the house.
+
+
+
Bed
+
My bed, made up of a base, memory foam topped mattress, a duvet, two pillows, and a headboard.
+
+
Atop the bed:
+
+
Buc-ee's throw
+
Pyjama bottoms
+
Croca (my teddy crocodile)
+
+
+
On/around the headboard:
+
+
Reading lamp/torch
+
Sleeping mask
+
+
+
+
+
Bedside Cabinet
+
A generic 3 tiered bedside cabinet my Grandad gave me.
+
+
Atop the cabinet:
+
+
Lamp
+
Current book I'm reading
+
Croca (my teddy crocodile)
+
+
+
First drawer:
+
+
Pocket notebook(s)
+
Travel Toiletry bag (with any toiletries not currently in use)
+
Hayfever/wet wipes
+
Tablets, vitamins, beard cream, chewing gum
+
Grip strengthener
+
+
+
Second drawer:
+
+
1x pair of jeans
+
2x t-shirts
+
1x pyjama bottoms
+
+
+
Third drawer:
+
+
2x bamboo socks
+
2x bombas socks
+
2x bamboo underwear
+
Merino wool gloves
+
Merino wool buff
+
Wooly hat
+
+
+
Beneath:
+
+
Rpi5 8GB **
+
240GB SSD (with USB to Sata adapter) **
+
Router **
+
+
+
+
+
Hanger
+
This is a small 4 knobbed hanger attached to the boiler door.
+
+
2x Jumpers
+
Sling/Bumbag *
+
+
+
+
+
Cabinet
+
A medium sized four tiered plastic cabinet, it cost ~£10.
+
+
Atop:
+
+
Pencil case *
+
+
+
First drawer:
+
+
SAD Lamp
+
Small sewing kit
+
+
+
Second drawer:
+
+
7.5m auto locking tape
+
+
+
Third drawer:
+
+
Skipping rope
+
Second monitor, and stand
+
+
+
Fourth drawer:
+
+
Jigsaw (puzzle)
+
Rubicks Cube
+
Light ankle weights
+
3x medium packing cubes
+
+
+
+
+
Makeshift Table
+
Next to the plastic draw, a 'table' constisting of two stools with a 1U server chassic atop.
+
+
Atop:
+
+
Pencil holder
+
+
+
Beneath:
+
+
Small rubbish bin
+
+
+
+
+
Workspace
+
This sits near the window, where I can get sunlight while staring at a screen.
+
+
+
Foldable desk
+
Foldable chair
+
+
+
When these are not in use, they're folded up and put behind the 'table', and plastic cabinet.
+
+
+
+
Other/Misc.
+
+
+
Dip bar
+
TP-Link Powerline Adapter
+
Scales (No battery)
+
Backpack
+
Soundcore Mini 3 **
+
Kovebble Bluetooth Headphones **
+
+
+
When these are not in use, they're folded up and put behind the 'table', and plastic cabinet.
+
+
+
+
+
+
Stuff that moves around
+
I have a few things that don't have a 'home', but follow me where I am spending my time, whether at my desk(s), in bed, or in my pocket if I'm not in the room.
+
+
Water bottle
+
Phone, and phone stand
+
Bullet Journal (and pen)
+
Inhaler(s)
+
Allergy tablets
+
Toilet roll
+
+
+
+
+
(*) Has more detail, but I'll likely add that to my 'OneBag' page when I get around to writing that.
diff --git a/guides/linux-file-permissions.html b/guides/linux-file-permissions.html
new file mode 100644
index 0000000..e861d54
--- /dev/null
+++ b/guides/linux-file-permissions.html
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Linux File Permissions
+
+
+
+
+ Jump directly to main content
+
Linux File Permissions
+
+
+
+
+
+
+
+
+
+
Having multiple users and groups with access to the same linux PC/server is great, but not everyone should have access to everything, eh.
+
+
For this, we'll use an example file, and switch ownership between root, and our user. So run the following snippet if your're using this as a tutorial, otherwise just read on.
+
mkdir ~/permsExample && cd ~/permsExample && sudo touch FILENAME
+
+
Basic File Permisssion Breakdown
+
For certain things, such as computers with only a few users/groups this works splendid.
+
If we run a ls -l FILENAME, we'll see something along the lines of the below.
+
-rw-r--r-- 1 root root 0 Sep 14 13:02 FILENAME
+
-rw-r--r-- being the permissions for User, Group, and Others which can be rwx for read, write, and executable permissions. Set in groups of 3s for User/Group/Others respectively.
+
root root refers to the owner user and owner group.
+
+
+
Set User/Group Ownership
+
Each file, and directory within UNIX has an owner user, and owner group.
+ By default when you create a file your user will be the owner, and your usergroup will be the owner group.
+
+
This can be changed with a simple command (that may need to be run with sudo).
+
chown USER FILENAME
+chown :GROUP FILENAME
+chown USER:GROUP FILENAME
+
+
The above snippet has the chown command run three different times with different purposes.
+ The first is to change just the owner user, second to change just the owner group,
+ and third to change both at the same time.
+
+
So to change the owner user for FILENAME to our own user, we'd run sudo chown $USER FILENAME, then verify the change by running ls -l FILENAME.
+
+
Set Permissions for User/Group/Others
+
Now we'll take a look at the file permissions that will affect the owners, and all other users.
+
If we look back at the ls -l FILENAME mentioned earlier you'll recall the brief -rw-r--r-- mention.
+
+
Intro to the rw-r--r-- meaning
+
There are 10 dashes (-) that can be set, ignoring the first for now leaves us with 9, seperated by 3s.
+
The first group of three rw- in this example shows that the owner user has read/write permissons, but no executable permissions.
+ The second group r--, shows the owner group only has read permissions, not write/executable permissions.
+ And the third group r--, shows that other users have read permissions, but cannot write/execute the files.
+
+
Set permissions
+
+
The below commands will set read, write, and execute permissions for the user, and group and give all other users read permissions for filename.file.
+
chmod ug+rwx FILENAME
+chmod o+r FILENAME
+
+
First thing after the chmod command (and a space) can be any combination of ugoa. Referring to user, group, other, and all.
+
Second, immediately after the letters can be one of +,-,= which are used to add, remove, or set (exact) permissions.
+
Third, any combination of rwx for read, write, executable permissions.
+
Follow this up with a space and the file/directory name and poof, permissions are set. If you'd like to set permissions for all files within a directory (and not just new ones created), also add a -R at the end of the command.
+
+
Set permissions by number
+
Many guides, examples, snippets, and such do not give their demonstration of setting permissions in the same manner as above, instead they'll use numbers, such as the below.
+
chmod 755 FILENAME
+
+
This chmod command will give rwx permissions to the owner user, and rx to the owner group, and other.
+
+
The numbers are much simpler to understand than you'd think:
+ 4 = Read
+ 2 = Write
+ 1 = Execute/executable
+
+
These numbers get added up and grant those permissions to the users. So 7 = rwx, 6 = rw, 5 = rx, 3 = wx, 0 = no permissions, etc.
+
You'll also spot that there are 3 numbers, 7,5,5. These are for user, group, and other respectively. So each rwx number up to 7 sets the permissions for different users.
+
+
+
Chmod directories
+
The chmod command can also be used on directories. The following example will give all permissions to all users for that directory, and all its child files/directories.
This will download add the required keyring, download the correct docker version for your PCs arhitecture, and the sources, and download the required packages.
+
With this docker is now installed and ready to go!
+
+
Installing your first container, Portainer
+
Portainer is a web-GUI for managing docker containers, so I figure it's a good place to start.
My preferred way of setting up, and running containers. It makes it more managable, and easier to follow.
+ There are a few more 'steps' here, but that's more-so for managing the containers than a requirement.
+
+
First off we'll create a 'docker' directory, with a 'portainer' directory within it in our home directory.
+
mkdir -p ~/docker/portainer && cd ~/docker/portainer && touch docker-compose.yml
+
+
Next from within the portainer directory, open up/create docker-compose.yml.
+ Use your preferred text editor here, I like vim, so I'll be using it in the snippet.
Next we'll run docker compose, which will do as the run command did, pulling the container (if not already done so), and running it.
+
+
sudo docker compose up -d
+
+
Accessing Portainer
+
Once this has been run successfully you should be able to access portainer using the IP of the docker host, or localhost (if running docker on the same PC).
diff --git a/guides/linux-acl.html b/guides/linux-acl.html
new file mode 100644
index 0000000..0b7dca4
--- /dev/null
+++ b/guides/linux-acl.html
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Linux Access Control Lists (ACL)
+
+
+
+
+ Jump directly to main content
+
Linux Access Control Lists (ACL)
+
+
+
+
+
+
+
+
+
+
Sometime linux filesystem permissions and ownership can only get you so far, for more complicated, or fine-tuned permissions we'll to use need another method, ACLs.
+
If you don't know much about linux file permissions I recommend you check my first guide on Linux File Permissions first, as this guide will only be covering the how-to, and not the why.
+
+
What are ACLs?
+
Access Control Lists, ACL for short are essentially a filter that can be set for files and directories to allow/disallow permissions for multiple users and groups without the need to change ownerships.
+
+
Install ACL
+
sudo apt install acl
+
+
Create ACL Entries/Permissions
+
+
Directory ACL
+
Like default linux permissions, the same deal applies for u,g,o/rwx.
+ The main difference being that alternate users/groups can be defined by name such as u:username:rw, and g:groupname:x.
The above will change the permissions for the directory, and any new children created within it to be rwx for the user "user". The second part of the above will then change all existing child files/directories of the directory to those same ACL permissions.
+
+
File ACL
+
Much like directory ACL, except for files. Any standalone files, or those within directories with an ACL set.
+
setfacl -m "u:user:rwx" FILENAME
+
+
+
View ACL Entries
+
Sometimes you need to check the permissions, and a ls -l will no longer cut it with ACL in use, so getfacl should be used.
The owner, group, user::, group::, and other::, are self-explanitory as they're basic Linux File Permission bits 'n' bobs.
+
mask::rwx sets the maximum permissions that can be used for the other user/groups that aren't the owners. So having rwx allows different user/groups to be able to have all permissions.
+
user:user:rwx shows that the user "user" has rwx permissions for the file.
+
+
Remove ACL Entries
+
+
If you're don't want the ACLs anymore, you can always remove them for a file/directory. Adding -R to the command will recursively remove ACL from any children too.
The chmod command can also be used on directories. The following example will give all permissions to all users for that directory, and all its child files/directories.
diff --git a/blog/return-of-the-me.html b/blog/return-of-the-me.html
new file mode 100644
index 0000000..02973dc
--- /dev/null
+++ b/blog/return-of-the-me.html
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+ Return of the Me
+
+
+
+
+ Jump directly to main content
+
Return of the Me
+
+
+
+
+
+
+
+
+
It's been a little while, but I've returned, at least for a while.
+
+
Where did you go?
+
I just got pre-occupied with life, namely work and the general stresses of it all.
+ The website, my projects, and personal development took a large hit, and I sort of just, fell off.
+ I had a bunch of cool things planned, which I'm going to ignore until I can get back into the swing of writing
+ for the site, but once I can get back to it I'll be doing some fancy bits.
+
+
+
What's the plan?
+
The focus for now will be to add new content to the site in the form of guides, recipes, and articles.
+ I'll be trying to get two 'posts' of those varieties out a week, on mondays and fridays (hey look, this is one of them). And I have done this for a little while already, however I'm already starting to struggle with this.
+
When I get comfortable making the weekly posts, I'll be going back through the 'existing' articles that I've left unfinished, or just there with no content, and finish those up.
+ Then I'll be making improvements to the site such as adding some new content, and also re-focussing on my projects, especially those not currently listed.
+
+
+
Sellout!
+
There are now affiliate links around the site to attempt to get a little cash.
+ I'm not expecting a lot, or really anything from them, and I'm not intending to make them obstrusive at all,
+ but if I reference a service, item, etc. I will throw a link to it, and if I can I will use an affiliate code within the link.
+
+
+
I'm also going to be adding some Javascript too, only a tiny bit to improve the user experience, things such as code snippet copying and basic filter searching on articles, et cetera.
+
+
Why are you back?
+
This website is something I wanted to do, and I still do. My lack of energy for it doesn't mean I want to stop working on it.
+
If all goes well, I'd love to prioritise the site, and ideally start my own web-dev pursuit instead of working for someone else, so we'll see.
+
If you're reading this, and visit my site at all, thank you.
Scheduling a cronjob is great, but sometimes you only want it to run once. You could add, then remove the job, or write a script that executes once, but there is a better way.
+
+
Install at
+
sudo apt install at
+
+
Schedule a script with at
+
The below examples show two different ways to run a script with at.
+
echo /script/to/run | at 20:30
+
at 20:30 -f ./script/to/run
+
For this, the script needs to exist, and needs executable permissions for your user, sudo chmod +x /script/to/run, if you need a lil' hint.
+
+
The time/date passed 20:30 in this example, can then be passed in a few assorted ways.
+
+
+
at now +5 minutes
+
at 11:00 today
+
at 11:00 tomorrow
+
at 20:30
+
at 20:30 093024
+
at 08:30PM Sep 30
+
at 08:30PM Sep 30 2024
+
at 08:30PM Sep 30 24
+
+
+
Batch a script
+
Similar to the regular means of scheduling, except the batch will wait for the system load drops to a set point.
+
echo /script/to/run | at -b 20:30
+
You can also run batch, as follows.
+
echo /script/to/run | batch 20:30
+
+
Check Queue
+
atq
+
Running the command above, will show you something akin to...
+
10 Sun Sep 29 14:14:00 2024 a user
+
Which broken down shows the ID 10, the date/time the item will run Sun Sep 29 14:14:00 2024,
+ the queue the item is in a, and the user executing the item user
+
+
+
Remove from Queue
+
You can remove an item from the queue, with the atrm command, passing just the ID.
+
atrm 3
+
+
Mail the user
+
Like cron, at also allows the ability to mail the user about the task once executed. By default, if the command produces an output, at will mail the user, you can override this with:
+
at -M
+
This will prevent mail being sent to the user. You can also force a mail sent even if there is no output with:
Now for the automation part. Using cron we can set this script to run at many time variations. I recommend crontab guru to learn more about the expressions used for cron.
Edit the cron table (crontab)
crontab -e
@@ -104,6 +104,8 @@ fi
This script can easily be used for many different directories, on each server without needing to change the script itself. All that's needed is to change the cronjob, and/or add another cronjob changing the values it takes.
+
One off scheduling
+
If you only want something to happen once at a specific date/time, you should look into using at, for one off scheduling rather than cron.
diff --git a/blog/prioritising-my-project.html b/blog/prioritising-my-project.html
new file mode 100644
index 0000000..98ff5c2
--- /dev/null
+++ b/blog/prioritising-my-project.html
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+ Prioritising my project
+
+
+
+
+ Jump directly to main content
+
Prioritising my project
+
+
+
+
+
+
+
+
+
It's Friday, so according to my last article, I should have something posted for you.
+
+
Ok, and?
+
Well, I do have something, this post. This however is more-so, a last second realisation that
+ I should post something.
+
Today, I've been working on a project of mine. It's a secret for now, until I have something to show,
+ otherwise I won't complete it, or have it anywhere near. I know this because I originally started it 1-2 years ago.
+
+
+
Why are you back on it?
+
It's a project I wanted to work on for a while. I am not however "back on it", I started from scratch, as I couldn't
+ remember where I was, or what was what. Thankfully (kind of), I didn't get far on before.
+
+
I may keep y'all updated on this, on my blog, or elsewhere on my site once I get somewhere. I was thinking,
+ perhaps I could do updates every week or so, but of something I did a few weeks prior to then.
+
+
What about other content?
+
That's why I opted to write this. Just a quick bit to let you know what's occuring, as I may not post articles for a while, or
+ may seem to be 'ignoring' my site again. I kind of will be, but there is reason, and I hope it goes somewhere, or leads to
+ other projects/tasks getting done!
+
+
+
Thanks for reading, and understanding. Apologies if this is a terribly written article, I have written in in 5-10 minutes in the midst
+ of working on the project I mentioned.
+
diff --git a/blog/p1-the-stack-and-rooms.html b/blog/p1-the-stack-and-rooms.html
new file mode 100644
index 0000000..829e3a6
--- /dev/null
+++ b/blog/p1-the-stack-and-rooms.html
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+ Project 1: The Stack, and Rooms
+
+
+
+
+ Jump directly to main content
+
Project 1: The Stack, and Rooms
+
+
+
+
+
+
+
+
+
The plan is to make a multiplayer PvP game, with defined turns, and per-player customisable elements.
+ I'm being a little vague, but I'm sure you can figure it out from that.
+
+
The Stack
+
First I needed to select a stack I could use for this, with decent documentation to starting off an async multiplayer experience.
+
After looking about I landed on a JS stack consisting of JS, and HTML Canvas for the front-end, and JS, NodeJS, SocketIO, and MySQL for the back-end. This stack should allow me to work on the game itself, rather than look into TCP interfacing (which may be simple, but I have enough stuff on at current to not want to look into this, at least for the time being).
+
+
Rooms
+
To get the swing of the multiplayer aspect, I opted to start with rooms.
+ Well that, and the Socket.IO guide I used to start this off with had basic room functionality (add player to room, start the game, etc).
+
+
What is a Room?
+
+ A room/instance (in my project at least), is a means to have multiple game instances running on the same server. Since there will be XvX players during a game, but there can be more than 2X players on the server, the servers resources can be better utilised by running many smaller instances, that manage themselves on the host.
+
+
+
Current Room Functionality
+
+ Each room will eventually manage the state of the game being played in said room. For the time, I currently have a room in the most basic form, it has a count of the players in said room, a specific (non-unique) identifier, and name. As I mentioned, very basic, but it sets the field for what will be needed in the future.
+
+
+ Along with the room itself, I have a number of helper functions that are triggered in the client with socket emits, and return data to the client from the server with socket.to, and socket.on.
+
+
These helper functions include:
+
+
+
Requesting all existing rooms
+
Creating a new room (if there is space to do so)
+
Joining an existing room via ID (again if there is space to do so)
+
+
+
+ The first two are near-final I assume, but joining a room currently just uses a numeric counter to log the players already connected, so it allows the same player to join the same, and multiple different rooms at the same time. This will be changed later down the line, but for now there's a decent proof-of-concept to show me that what I want it feasible without too much difficulty.
+
diff --git a/blog/p1-basic-drawing-and-interaction.html b/blog/p1-basic-drawing-and-interaction.html
new file mode 100644
index 0000000..d90c945
--- /dev/null
+++ b/blog/p1-basic-drawing-and-interaction.html
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+ Project 1: Basic Drawing and Interaction
+
+
+
+
+ Jump directly to main content
+
Project 1: Basic Drawing and Interaction
+
+
+
+
+
+
+
+
+
Switching away from the server-side stuff after getting the stack setup, I've opted to the basic game 'drawn', and 'playable', if you can call it those.
+
+
Drawing
+
Since I'm using JS and HTML canvas I need to draw each shape onto the canvas setting each individual shapes co-ordinates and size. This sounds simple, but the more shapes you draw, and the more you don't want them to overlap, or to add zoomed in/out shapes it gets much more complicated than you'd think. This is a prime example of why a solid grasp on basic mathematics is good for developers.
+
+
Shape class
+
Repeating the setting of context data, and the drawing of each shape became tedious and took a big chunk of my code-base after not long, so I decided to simplify by creating a Path2D extended class.
Pretty simple, I pass the shape I want to draw, x,y co-ordinates, width and height, and the fill. Not included above, but the class also accepts, and draws the shape stroke.
+
I then call the draw method of the new Shape, and it sorts everything for me.
+
+
Interaction with Event Handlers
+
Next up, for the game to be a game and not just some visual media, we need to be able to interact with it.
+
Basic interaction is simple enough, I threw in a 'click' EventListener, then take the event/click's X/Y position and subtract the canvas's offset from the HTML body (to have 0,0 set to the top-left of the canvas, and not the HTML page).
+
This new X/Y, which I will just call X/Y is then compared to the X/Y locations of each shape. If the event X/Y occurs in a location greater (or equal) than the shape X/Y, and less than (or equal) Shape X/Y plus the shape Width/Height I then do whatever action I require.
+
This is another thing I've simplified by creating a function:
+
function clickableCheck(x,y,shape){
+ if(
+ y > shape.y && y < shape.y + shape.height
+ && x > shape.x && x < shape.x + shape.width)
+ {
+ return true;
+ }
+ return false;
+}
+
The function above is even simpler too, as all you need to do to check for a click, is pass a Shape object, created by the Shape class earlier in this post!
+
Fun Fact! Shape here, is actually called clickable in my code-base, but I've changed it to make more sense without context.
The first two are near-final I assume, but joining a room currently just uses a numeric counter to log the players already connected, so it allows the same player to join the same, and multiple different rooms at the same time. This will be changed later down the line, but for now there's a decent proof-of-concept to show me that what I want it feasible without too much difficulty.