It kind of took me by surprise. It has been about a decade (from what I remember) since it last snowed well in Wales – long enough to forget what snow even feels like. So, when I woke up to see that my street is now completely blanketed after a day or so of snowing, I couldn’t contain the urge to just walk and have some fun in it!
The result: one of the best days I have had in a while! I have previously talked about my love of the simple pleasure of being outside and walking, but combine that with this soft and pretty snow and I just didn’t want to not be in it! Throughout the day, I made four different voyages into the snow equalled a combined 20,500 steps (as per Google Fit). My legs are pretty tired to say the least, as fighting the fairly strong wind and the resistance of large piles of snow did take a little bit of a toll but every moment was worth it!
There are a few notable examples of fun or interesting things I did in the day – including spots of photography, banter with friends etc. But the one that left the biggest and most personal impression was this moment when I was walking alone past World of Groggs on my last trip of the day at around 2050 hours. Imagine a setting of this usually busy street now blanketed in vibrant-white snow and silent of human contamination. Where the force of the gentle wind becomes audible and snow creaks as you tread. For some random reason, I looked back when I was walking in this setting and realised how much devoid of human life this street now was. At first, the I got this deep feeling that I was truly alone for a second – like if I were to scream, no one would hear me. But when I turned back around, I realised how beautiful and calm my surrounds were. I could now enjoy this surrounding to the point where all scares and cares went straight out of me and walked home with a smile!
I think that moment will stick with me for a while. I hope to be out early tomorrow for a spot of photography. Hopefully my main camera’s battery won’t die early in the day again!
January has probably been the busiest month in my entire life. No kidding! Constant work, personal projects, assignments, and very little free time to myself. But I am happy to say I have enjoyed all of it!
Since my last life update last month, I have had two coursework results back from my Computer Graphics and Tool Development for Computer Games modules. The former was a 2D OpenGL scene demonstration where we had to sample OpenGL objects and techniques and demonstrate them – from Vector Array Objects to hierarchical modelling. The demo at the time went well, and I got 88% in the end! The latter was building a Python missile command game clone with the Pygame engine and developing a small physics simulator called “Marble Madness” with a lecturer-developed engine (PGE). I had 90% on that one. So I’m happy with my performance last term to say the least!
For the second term, this module now focuses on 3D rendering in OpenGL and 3D modelling with Autodesk 3DS Max. Things have continued to go well this term, and 3D modelling is actually more fun than I imagined! It has been useful for my group project in another module as well! The programming side is obviously interesting, but we are still in the opening weeks and have not done a lot of programming for OpenGL 3D yet.
Tool Development for Computer Games
Whilst I don’t have anything against Python, the module is a lot more interesting for me this term now that we are starting to do C# GUI programming with XAML. Whilst I have done a few WinForms projects before, WPF is something I have never touched before! The coursework looks like a nice challenge too, which is to build a game level designer for a tile-based game. We are given the game and its source code and have to build the designer based on the code ourselves!
Data Structures & Algorithms With Object Oriented Programming This module recently had a coursework due on the 12th, which was the process scheduler assignment I talked about in a post back around late-December. Basically, we were given a public API to conform to and told to fill in the blanks in C++. My scheduler ended up being a multi-level queue with a custom algorithm that creates a cycle to prevent blocking (the act of higher priority items stopping lower priority items from being processed completely). The scheduler creates a cycle in which each level of priority (from 1 to 10) gets a certain amount of attention. Higher priorities get more attention than lower ones in the cycle, but the lowers still gets *some* attention rather than none.
Other than the coursework, this term has also taken up a slightly different theme. We are now covering different design and strategy patterns to OO programming. Whilst they certainly require a bit more thought to understand, one of the two we have learnt so far has already came in handy with my web work! The observer pattern, which states the relationship between a subject (essentially some hub) and its observers (dependencies like clients), is basically the same principle of the way I’m developing this small social network in PHP for my portfolio.
Professionalism: “Project FallingStar” Once again, the largest and most impressive thing I am involved with at University. My team has made significant progress and whilst we are far from having a complete game, the game is looking rather beautiful already! Besides defacto leadership and physics programming, I have also undertaken tasks for 3D modelling and special effects for the game. Like the last time I wrote about this, I have some little peaks for you:
I have also made a fair bit of progress with personal things as well. My Star Trek fan site, Path to 2265, remains a top priority for me and many improvements in the back-office have been made. The website’s search engine programming has transformed into a mature, secure and robust platform that allows the website to provide intelligent and weighted search results, whilst also providing internal benefits by allowing pages to be more dynamic and use the website’s database more. I’ve also been working on actual front-end content as well with Chapter 2 being released within a month or so and several more ships added; Polaris has a completed database entry, DY-732 has its specs mostly ironed out, and an upcoming design is due for completion soon:
I have also resumed limited work on my old GeckoFX-based C# browser KAubersnek. I’ve been adding a few features over the weeks and will likely continue full development when I have some time.
In my last update for Path to 2265, I briefly described the major improvements made to the searching capabilities of the website. Today, I’m going into detail about these changes and why they are important for security and code quality. Examples included!
How it was The decision to add a search to the website was made fairly early on, during a time where other aspects of the website like the visual layout design were more important to me. This resulted in a crude but working search solution that you can read about here. It is a very linear search in that it just finds and returns the results sequentially in the order they were found by the SQL query. And that was fine back then, but something better is needed now!
I should mention that in November, the search feature got a little attention with the conversion from raw MySQL calls to PHP Data Objects (PDOs) with prepared statements. Whilst this was a major plus for security, the implementation was still ugly and quick.
The new concept A search that is to be deployed on the WWW needs to be functional AND secure. It is not hard to find reports about SQL injections and other malicious acts against site searches that can be a pain in the butt to deal with. With that in mind, I decided to rebuild the search engine from the ground up with security (and good code quality) in mind. The new concept calls for class encapsulation as well as PDOs – the usage of object orientation allows for controlled access to the code querying the database by only providing a set amount of methods and required arguments to interact with said code.
How does this all benefit security? Well, PDOs alone do not help much in terms of security. But the usage of prepared statements does by separating the variable part (in our case, the search term) of an SQL query into a method that can safely bind the variable and exclude any nasty code. Here’s a good page about SQL injections and prepared statements!
Class encapsulation also does not actually affect the SQL’s ‘secureness’ directly. But if it is used right, it can provide a reduced interface that could be used for code security purposes (as well the usual benefits of using object-orientated code). If the core code is not in a class, the code will be executed in a procedural manner where there are no barriers to what you can supply that code. But if that core code is in a class, you can then write a select few methods inside that class that can access that encapsulated code with a parameter set that can be as wide or as tight as you want. In my case, I want to tighten how the code is accessed, hence “reduced interface”. All methods that can be called only take in data that I believe is needed for operation and nothing more.
Example – class specification This is a listing of the class members for an example I will be using to show off these concepts at the basic level. The class structure is based on Path to 2265’s engine – the major difference is the exclusion of the experimental ordered tag search (more about that in a later update) that I am still working on.
stores instance of PDO object with database connection details
stores prepared statements
stores last-processed query string
removes special characters from any input string
$string – input string to ‘clean’
breaks down an input string into an array of characters for tag searching
$input – input string to break down
public createStandardSearch($class, $col, $term)
executes a linear search
$class – table in the database to search from
$col – column in the table to match from
$term – input string
public createTagSearch($class, $string)
executes a basic unordered tag-based search
$class – table in the database to search from
$string – input string
returns a count of results matched
returns result for when a single result is expected
returns result for when an array of results is expected
Example – implementation I have uploaded an implementation of that class specification that works almost out of the box (you’ll need to enter your database’s details etc). As I said earlier, it is based on Path to 2265’s code for the same functionality.
Disclaimer: if there are any errors in that code, I am not liable for any damage they may cause – the code is provided for demonstrative purposes only.
Other possible applications this example can do The great thing about this implementation is the fact that it can be used for things other than just ‘normal’ searching. By using the standard search feature and retrieving a single result, you effectively have the main thing you need for making a dynamic website!
So if your website has something like a database-style section (many in the case of Path to 2265), you can get rid of those countless HTML pages and have a single page instead that calls upon the SearchEngine to find and retrieve the desired page data (indicated with a unique ID through a variable in the URL) in your MySQL database and display the information accordingly.
The best example of this on Path to 2265 is the Database section: clicking on any of the ships (take http://pathto2265.com/resources/apps/ship?ID=2095_ECS_J as an example) takes you to the same page for all of them, expect they all have a different IDs in the URL. A provided ID on that page is fed into the search engine via a standard search call and the single result is fetched and echoed into their destined positions in the markup for you viewing pleasure. It’s great, isn’t it?
Anyway, I think that’s it for today! I hope this has been an interesting read!
This is a fairly quick and fun (for me, at least) blogpost about something I have to consider for a university assignment.
The assignment revolves around developing a scheduler in C++ that could theoretically be applied as a process scheduling algorithm for an operating system. We were given a code spec to conform to, which consists of class and functions definitions for a integer Stack, Queue and Scheduler. The assignment mandates that we make all three paradigms operational (no surprise). Implementing the first two things was easy, but building a scheduler requires a lot of thinking. Thanks to the specification and the assignment briefing, we are shown that the scheduler operates with 10 priority levels (0 – lowest, 10 – highest) and it bares some relation (inheritance) to the Queue functionality.
You might be thinking: “Woah there Khalid, lot more thinking? Processing tasks based on priority levels is easy ’cause you just select the highest priority items first and go from there…”. Well in theory, that is an easy concept to understand. BUT with that specific approach, you could experience one of the most breaking problems in scheduling.
Blocking (which is the phenomenon where low priority tasks are ‘blocked’ from being processed by high priority tasks) could effectively break the integrity of a system that is supposed to take on more and more tasks whilst operating (like our process scheduler). Whilst those low priority tasks are supposed to be… well… low priority, they are not irrelevant and will need processing eventually. Even in scenarios where tasks are not added during operation (schedulers that have a predefined task list to complete), sequentially processing items from highest to lowest could result in the lower ones never being touched (at least until after an unreasonable amount of time) since there could be a huge amount of set items!
Imagine we have a system that has a million high priority tasks but just one low priority task. If the scheduler is processing sequentially, it will take a huge amount of time to reach that one low priority task. Surely, there has to be a better way?
With the use of some more processing power, there is. But you’re gonna have to wait to find out! I’m currently having an interesting time trying to select an appropriate method. I’ll likely report my findings after the assessment is submitted (because I do not want to give the answer away).
So I’m gonna be shaking up how I do updates for Path to 2265 from now on. Firstly, these updates are going to be more structured because I want to make them easier to read. Secondly, I want to make it so people can either briefly look at the change list or read details depending on what they want to find out. Also I am removing any set times for posting updates since I’ve missed almost all the targets for posting them these last few months. So with out further ado, here’s we go!
Sitename simplication I have decided to drop the “Starfleet” part of the website’s name. I believe “Path to 2265” is a more clean site name and it matches the domain name now! Plus, both sides of the “to” are ‘balanced’ with four characters each now (as long as you’re not counting spaces)!
Reimagined search engine capabilities For a long time, the searching capability and ship report part of the website have continued to rely on the fairly crude MySQL calls demonstrated all the way back in September. By early November, I upgraded to using PHP Data Objects (PDO) for enhanced security and code quality. Now, I have moved to class encapsulation as I become more and more proficient with coding in PHP! So with this object orientated approach, the code required to connect and query the database can be contained and interacting with the “SearchEngine” object can be securely controlled by only allowing certain methods with certain argument sets to be called. The search is also now (FINALLY) a tag-based search and I am currently developing an algorithm that can weight the results of one or more SQL queries and display the most relevant results to the user! I’m thinking about making a separate post to describe the process of doing this and its benefits in more detail, so stay tuned for that! But for now, I’ll leave you with this screenshot:
Sitemap Thanks to the new search engine capabilities, I have been able to reuse the SearchEngine class for other new features such as the website’s sitemap. Essentially, constructing the sitemap is done by querying a database for a result containing all the pages belonging to the same category. The SQL code is the same as a user searching (for now though, more about that later), so a SearchEngine object can be used without any problems.
SS Polaris progress There is finally some progress on my second design project! I have taken a u-turn on the nacelle placement, and I have stripped some details that I thought made the design too advanced. In return, I tried to pepper in some details that make the design both more unique, polished and maybe industrial. Instead of having that weird dual deflector system mounted on top, the nose of the ship has been cut away to reveal one large deflector/communication array that I hope adds emphasis that the design relies on communication (since it is a diplomatic vessel). The new dish is also surrounded by some missile bays. The design will not have any energy weapons.
It’s quite funny, this design was developed without specs and was required to be developed in a week! Yet, it’s taken like two months or so to get to this stage… xD. Hopefully lesson learnt – ALWAYS iron out design specs ’cause it will just cause headaches later on.
EXP-type Warp Reactor I have added a new early UESPA reactor to the database. It is an attempt to explain how and why Earth had a matter/antimatter reactor (on deep space probe Friendship 1) so early on.
Progress gallery & milestones article I’ve added these fun articles to show the progress and effort that was put into Path to 2265. Progress gallery is already up to do (mostly), but milestones still needs it content.
Chapter 1 proofreading After discovering some grammatical errors on this chapter of the History report, I am currently in the process of thoroughly proofreading it!
Discontinuation of the “Todo” page
In all honestly, the page was only created for myself as a temporary tracker whilst I worked on the website. It was a place where I could list issues when I found them for later solving. Now that I use GitHub for issue tracking and source control, it has become redundant and will be removed from the website soon.
What’s the come! My main focus is developing the search capabilities further right now. I soon hope to have an intelligent tag search with proper result ordering and sorting.
SS Polaris is nearly completion. So I might roll that out soon. The design documentation for both SS Voyager and SS Polaris need proper attention and revamping.
Chapter 2 (“Space Boomers”) should be completed in the next few weeks too!
As of last Friday, I’m now off university for a few weeks. I thought it might be neat if I make a post about what I have done these last few weeks for university, so here goes!
“Project FallingStar” …is the single biggest thing I have been involved with this term. For the Professionalism module, we were put into groups (four, five (as it is for ours) or six people) and tasked with planning and building a 3D game from scratch whilst still learning the engine we have to use (Unity). I am pleased to say I have thoroughly enjoyed the project so far! The idea for our game is that the player builds modular space probes to send out on exploration and defence missions in the solar system. Despite initial doubts that our idea was too ambitious for a bunch of UNI students, our team (designated Team 1) is working well and our recent demo was well-received! My main contributions to the team have been physics programming (producing the gravity model) and leadership (defacto, since it was something that I naturally slipped into rather than being designated).
OpenGL coursework This coursework was also fun. In the Computer Graphics module, we have been learning the basics of OpenGL and the assessment was to compile a 2D OpenGL scene that makes use of advanced OpenGL features (compared to just using immediate mode rendering) such as Vector Buffer Objects (and Vertex Array Objects), hierarchical modelling, and transformations. Whilst I have to wait for my grade, the demonstration I have to my lecturer was well-received!
Python + Pygame This coursework was interesting ’cause I both did and did not enjoy it. The coursework was split into two tasks; building a missile command game clone with Pygame and then developing a small physics sim “Marble Madness” with a lecturer-created engine. Both tasks had their merits, which for me was mainly the fun of programming. What I did not like was that we could only develop the second part on Linux since the engine (PGE) is Linux-only. Whilst I have Linux at home nor is Linux THE problem, there is really only one computer lab in the university (where I work better at than home) that has Linux. This meant I could not always be guaranteed a computer since the lab was in high demand. I was even asked to leave for another class on two occassions, with can really be inconveniencing!
So yeah, that’s what I have been up to academically! In my spare time, I am continuing the development of Path to 2265 as another personal priority. I’ve recently made some huge underlying changes that I’ll be posting about this week!
It has been quite a while since I did one of these summary update posts (at least half a year now), so let’s get into this!
Kicking this post off; for this year of studies, I decided that it was time for me to take a more active role with responsibility at my university. Since Wednesday 22nd November 2017, I am now functioning as one of three course representatives for Year 2 Computer Games Development. Basically, I’m here as the first layer of the “student academic representation network” (there are then student voice reps (SVRs) and full-time student officers above me). I am here to represent all students in my year group – they can come to me with feedback that I can then bring up at meetings with other course reps and the course leaders to improve the quality of the course. Since getting into the role, I have taken part in an initial training event thingy, a course rep assembly (involving course reps across the University), and a course rep meeting (just Game Dev and Computer Science course reps and leaders). So far, it feels great to be part of this and I hope I can be an effective and contributing course rep!
This Saturday, I went to St Fagans with my parents! They went mainly for the bread, Bara Birth, since it is literally the best bread ever! I took some photos in the subsequent walk and tried to play around with them when I got home, doing the best I can with just a mid-range smartphone camera. Some came out pretty nice, although a lot of the finer details were somewhat ruined by JPEG compression. I did some post-processing on a few of them in Photoshop to improve them as much as I can. One thing notable about this trip was that the place has changed quite a bit since the last time I went. The front museum part has been modernised and expanded, and it looks great! And they also added this cafe/workshop (pictured below) building outside too!
Copyright Khalid Ali
Copyright Khalid Ali
Copyright Khalid Ali
Copyright Khalid Ali
Finally, my personal website is online! See it here at http://khalidali.co.uk. It will serve as my online portfolio and general hub. It’s source code is essentially a fork of Starfleet’s Path to 2265.