- Details
- Category: Blog
- By Stuart Mathews
- Hits: 4533
Since Time shifting, CS algorithms and Game Architecture, I've been exploring trivial set theory to gain insights into the theory of what defines a function from a purely mathematical standpoint, which as it happens, is the product of two sets. For example, let C represents a function in terms of a set \( C \subset A \times B \) such that it produces a set where \( \{(a,b): a \in A, b \in B\}\) and which references all the possible inputs and outputs of the function where \( C = A \mapsto B \).
Usually the nomenclature of a function is usually represented as \( F = X \mapsto Y\) and alternatively \( f(x) = y : x \in X \ y \in Y \). Obviously, if you spend some time going through the theory of functions as expressed on a graph such as a linear equation, the relationship between the dependant variable \(y\) and independent variable \(x\) has a clear relationship. In programming, this is generally interpreted as the running of a function's code as opposed to the evaluation of an equation or expression to realise the dependant variable's value.
The theory of sets is pretty interesting in its own right however its particularly interesting in the context of functional programming, particularly pure functions which are programming constructs which are trying to model the mathematical ideals of functions. A pure function represents a bijective mapping (both injective and surjective) of the product of the two sets (domain \(X\) and codomain \(Y\)). This means nothing else exists that influences \(y\) other than \(x\) (it's a direct mapping). This is a key consideration of pure functions in functional programming and immutability.
The reason its key is because this makes \(f(x)=y\) absolutely reliable because if you know \(x\), then you know \(y\). These ideas have implications for real-time processing environments like games because they usually rely on highly concurrent and often parallel execution of tasks, where reasoning about functions within a threading context requires predictability. This is among some of the research I'm doing at the moment.
Parallel executing tasks usually lock critical sections of shared state and these tasks (functions really) themselves are prone to producing non-deterministic results due to the very fact that they don't exhibit a bijective nature between their domain and codomains. Executing environments that rely on I/O and other external factors make it impossible to guarantee the result of any function that relies on it - not great for a function's predictability.
Making tasks pure, arguably makes them reliable and then you don't need locking either. My argument then, is that this will make games perform better - and more reliably. Though my research looks to determine at what cost this comes at, particularly when it comes to the code itself such as readability and maintainability etc.
Interestingly if you do some reading about Memorization, this relies on this behaviour of a bijective function too ie. you never need to evaluate that function again in the future - provided of course you store its input and output.
Apart from Mathematics, I've upgraded my Investment Management project to .net core 3.1 which takes it right up to the latest supported version. It was a bit of a pain doing it, as I had to go from .net core 2.0 -> 2.1 -> 2.2 -> 3.0 separately and then finally to 3.1. It wasn't that complicated but it wasn't seamless either.
I've also done some more Canal-side runs lately, which I've enjoyed.
Although I don't use functional programming for my day-to-day work in C# anymore, I've written a prototype game in C# which I'd like to 'functionalize'. I've come to appreciate the ideas and would like to explore its applicability to game development now. I'm slowly reading through Functional Programming in C# and I'm weaving it in with the other readings I have going on. I've got through the first 2 chapters so I've yet to make real headway. I produced a tutorial about functional programming in C# (which got good feedback) and this, I guess is an extension of that.
There is scope to incorporate Scala into my future work and there are functional aspects to Ruby (see later) - so the trajectory is in the same direction, generally. So I'll not be dropping it quite yet.
I've also been playing around with latex, trying to get it working on my blog(which I've managed to do) and I think moving forward I'd like to use it to write up some of my work moving forward.
I've managed to get out my project proposal which is entitled "Evaluating and Applying Functional Programming Paradigms in Developing Computer Games using C# and MonoGame", though I had to chase up my supervisor to review the draft and by the time he'd done it, my proposal had diverged significantly and thankfully his comments were largely already covered in my revised version. I incorporated some of his comments however which was helpful. I'll need to start working on the delivery of it.
I'm slowly making it through A mind for numbers having made it through the first 3 chapters. I'm also learning more about Linear Equations and relationships between numbers, specifically the dependant and independent variables that constitute formulae (given my earlier foray into functions) such as trivial straight line equations in the form of \(y = mx +c \). I find it quite interesting going through it. I'm finding it quite useful for reinterpreting some of the fundamental algebraic ideas and others such as understanding the nature of proportional relationships (the meaning of gradients for example).
I've pretty much stalled on applying my linear algebra learning to 3D transformations (which is the stuff I need to do next and finish...DirectX math, coursework and some films) as I think I've been reading so much about it that I'm a little tired of it (I've read the first 6 chapters of 3D Game Programming Using DirectX 10 and OpenGL back-to-back as well as Frank D Luna's book - lots and lots of theory).
As a distraction, I bought a book a while ago which is old (managed DirectX 9 in C#) which I thought might be useful to obtain an alternative perspective on viewing transformations and the like, so I started to read that. I've got through the first 3 chapters and now I'm at a point where viewing transformations are being discussed. So I've got 3 books ready to get into about this! This one's obviously old and managed direct X is no longer a product, but it's exciting none-the-less. I've got to avert my eyes when I see some of the device enumeration and selection code as some of it now does not apply to later versions of Direct X with the version I'm most familiar with (DX10) being the one that did away with the compatibility checking code that features in this book. It is however nice to be back in C#.
I created a nice little C++ vehicle that shows the current frames per second and I'll use this as the basis for my next work, which should be shortly. It will probably also include some HLSL and shader programming as that's required for the vertex transformations to occur.
I've also been learning Ruby and Ruby-On-Rails recently, not in a massive way yet. I've read the basic tutorial on the main website, followed 2 video tutorials on the subjects respectively, the first 4 chapters of "Eloquent Ruby" as well as the section on ruby in one of my programming books and created my first dummy rails application. I find text-based tutorials much more effective than a video, but I guess it depends on your time and motivations. My plan so far is to integrate it into my Investment Management project, using Resque and Redis as the basis of a background job management system, which I've already partially set up.
I've got Halo Wars, Metro Last Light, Dragons dogma and Dantes Inferno currently sprawled out on my couch and I've not played any of them yet. This means I've been pretty productive. I have played Mass Effect 3 though, that is until I got to a stage where I kept on getting killed and it started to annoy me - I stopped playing... You got to make games adaptively progressive!
There is still much to do, and only 2 more weeks to do it in!
- Details
- Category: Blog
- By Stuart Mathews
- Hits: 4786
Since Convolution, Running and Finite State Machines, I've spent the last couple of days focused on reading lotsa different stuff.
I'm currently alternating between a few books: "Introduction to 3D Game Programming with DirectX10", which is by Frank D Luna. It's quite technical however, it's accurate and provides good perspective, particularly around the basic math such as vectors and Matrices.
I'm also reading Rautenbach's "3D Game programming Using DirectX10 and OpenGL", which is one of my favourites reads on the subject. I think it is primarily because it does the best coverage of 3D transformation I've ever read and its got great illustrations too.
With "Foundations and fundamentals concepts of mathematics", I'm taking a history lesson at the moment into the axiomatic, deductive method used throughout history in describing math. I've been reading about the development of the deductive method used by Euclid and Archimedes and some of the histories behind how varying degrees of assumptions including Axioms and Postulates and how they are used, how they were formed and it is pretty insightful. It's theoretical but/and pleasingly so.
On a more practical note, I'm now also reading "A programmers introduction to mathematics" where we're trying to implement a secret code sharing mechanism using polynomial theory, which is a little more practical. This book takes a little longer to read than the others but I'm quite interested in it.
Last in my round-robin of reads is "A mind for numbers", which is more inspirational than technical and sits squarely within the genre of some my previous 'popular research' reads such as "Mindset" and "Bounce" as well as "The Checklist". It reads more like a novel/story than a technical book.
Apart from physical the books, which are stacked up next to me on my coffee table, I've been wondering the passages of the internet too. I recently came across a BBC learning page about computer science fundamentals.
It introduces algorithms such as those used for searching including linear and binary search methods and sorting too using methods such as bubble sort, selection sort, merge sort etc.
Its a series largely aimed at children but it has real application (just like any math would) and I found it particularly interesting and fun, which perhaps further suggests that perhaps I've not yet grown up.
It also maybe suggests that some computer science fundamentals are a little more known to children that they have ever been before as it was surprisingly well documented and entertaining as it included videos, examples and was suitable 'gamified'. The only thing missing I found was actual code implementations...
I spent some time implementing some of them for fun as I wanted to test myself.
My first test was implementing Bubble Sort - a linear time, O(n) sorting algorithm, pretty inefficient and slow but it's got a very defined and coordinated setup which makes it easily modelled.
I used a do() iteration construct, as you'll be swapping at least once and I count the number of swaps done through each iteration or 'pass' running through the list of numbers. The process ends when there are no more swapping to be done, which forms part of my exit condition in my loop and then the list is sorted:
public static void BubbleSort(ref int[] input)
{
int swapped;
do
{
swapped = 0;
for (int i = 0; i < input.Length-1; i++)
{
if (input[i] > input[i + 1])
{
var temp = input[i];
input[i] = input[i + 1];
input[i + 1] = temp;
swapped++;
}
}
} while(swapped > 0);
}
It was actually pretty fun doing this, and can surely be improved upon - Next, I tried the insertion sort:
Insertion sort
Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
This is a little more difficult because you need to 'look' back to see if any prior elements, so it needs a nested loop. One loop for the initial pass-through of each of the elements and then for each element, scan the previous elements leading up to the element. Pretty inefficient, somthing in the region of say O(n^2) I'd imagine, but totally something that can be modelled in code:
public static void InsertionSort(ref int[] input)
{
for (int i = 0; i < input.Length; i++)
{
for (int j = 0; j < i; j++)
{
if (input[i] < input[j])
{
var save = input[j];
input[j] = input[i];
input[i] = save;
}
}
}
}
These all sorted the list in-place. I stopped there but I'm going to add a few in the future, probably the more complicated and more efficient ones as it's a pretty interesting and enlightening process, and helps me practise.
So in other news, I've finally completed my Network Security course, and I'm pretty much done with the Digital Signal Processing. Actually, the last piece of work I did on it was the course work(which ultimately replaced the exam) was where I needed to implement a Circular Buffer and then use it in creating audio effects in C++ using fmod, among other things.
One example of this was creating a delayed(or time-shifted) signal effect like a flanger...
This is what I ended up doing in C++:
One of the other things I had to do, was set up an occlusion effect whereby walking in front of an object would effectively cut off sound originating from the object.
I used FMods geometry system to construct a polygon that represented a wall and positioned that in front of my object. I then registered it with the fmod system. Pretty fun as we had to import a new mesh and render it in the OpenGL - which was the first time I'd used OpenGL.
Looking back at my DSP course, I actually enjoyed it, particularly the theory but also too the C++ and the work I did on the ringbuffer. We covered aspects including:
- Logarithms, Real and complex numbers
- Sampling and Quantization analogue continuous signals into digital
- Wave theory and properties of waves
- Signal correlation and the Fourier transform: Dot product, Autocorrelation, Cross-correlation, Cross-co-variance, the Correlation coefficient
- Frequency Analysis
- Filtering and convolution
I enjoyed learning about the Fourier transform the most, and I suspect in the future I'll be using it again...
Apart from my Network Security and DSP course, which has taken a lot of my spare time, I also managed to also complete the Game Architecture course.
As a result, I've written a game engine in C# and MonoGame and produced a representable prototype to represent it. The main concepts covered include:
- Resource Management Strategy
- Character Control and Decoupled Input
- Collision Detection
- Moving and animated game elements and frame-rate independence
- The configurable game world and data-driven approach
- Decoupled removal of game objects from collision detection
- Scoring System use of event listeners
- High score or alternative state load/save mechanism
- Start-screen with FSM
- Power-ups using event listeners and re-use of base classes for game objects
- NPC opponents demonstrating FSM
- Overall game-play and presentation
I have a bit of a demonstration of a PAC-man like game which features collision detection, primitive AI and animation. It's very basic and is really just a prototype (not a whole game) to demonstrate the underlying architectural designs and concepts in the game code:
I started with a simple concept of a GameObject which takes on a lot of the functionality and responsibility of typical game situations such as calculating bounding boxes, doing collision detection and common updating routines, drawing and initializing of components etc.
Apart from the actual coding which has taken a lot of my time, I've also spent a considerable amount of time distilling the design decisions of my game engine into a report, which really helped me take stock of all the code I'd been writing, specifically the architectural aspects.
There have been a A few runs during the stay-in phase which are notable.
Yesterday, I put in Mass Effect 3 into the XBox and played a little bit, enough to cure the Krogen of the Genofage but I died like 20 times before I was able to finish the mission. But the persistence paid off!
I also upgraded my Investment Tracker application to Angular 6 from 5.2 which wasn't that bad however I'm a bit stuck now as I can't upgrade beyond that as I've got a strong dependency on a component that won't upgrade further - which I'll need to look to remove in the future but not a big issue right now.
I'm thinking of doing another project that uses my new knowledge around signal processing to implement a sort of Strava-like application in Angular 8/9 but the jury is out on the schedule of that. I've got a few weeks break before things start going again!
- Details
- Category: Blog
- By Stuart Mathews
- Hits: 4670
Since Encryption and network protocols, I wrote about Common network attacks and the shortcomings of standard network defences.
Apart from that, I've made some good progress using the classic MonoGame/XNA game tutorial which I manually reproduced a few weekends ago (https://github.com/stumathews/WindowsShooterGame).
I spent most of the day writing it up and trying to figure it out and I think its a great learning exercise. The fundamental concepts of which are to delegate as much detail to co-operating objects and then ask them to update() their states (or modify the world state) and draw themselves().
I've been trying to put into context some of the concepts I've learnt during the Computer Games Architectures course I'm doing too:
Recently we've touched on how to separate the architectural components into layers and how the organisation of components within a typical game engine is laid out. We've put together some theory about architectural design patterns and I'm quite enthused that my reading on the subject, pertain specifically to game development was used as a reference to MVC. I wrote this a while ago before I decided to take the course: A simple game engine architecture. This tells me that I'm doing the right course. There is also some application of physics slowly coming into the course which is great.
I've also spent quite some time learning about digital sampling and the quantisation of analogue signals into digital ones and representing them mathematically.
This is part of the game development course and it goes through the physics of audio. Basic topics include investigating sampling frequencies, downsampling/aliasing, filters, Nyquist frequency, sine, triangle, triangle and sawtooth wave patterns including Envelope generators(ADSR).
I'm also finding the mathematics fascinating, particularly the representation and modelling of waves. I've enjoyed learning about the Fourier transform and as a result, an application of complex numbers - which is something new and therefore interesting.
Last weekend I spent it doing practicals for my Network Security course work. I set up various switches and routers and configuring firewalls and routes. Very interesting. Quite a time-consuming. Details of that setup are here:
I also spent time investigating the EK Angler attack and used some interesting tools that report the attack such as Snort, Sguil, Bro, Elsa and of course...Wireshark. The attack particulars of the attack are quite interesting however the details are quite well described by Palo Alto networks here.
I used the Security Onion VM to research. I've long since uninstalled Tails...
Since then, however, I've been focusing on digital signal processing and physics. I've spent most of this weekend, going through a set of lessons described as the recommended reading. If I'm going to pass the exam, I've got to study as much of it as I can within the time I have left.
I think the most useful, apparent link I've made to gaming with regards to the theory of waves, which does seem out of place - is the representation of Tones or harmonics ie, that when running through an ASDR envelope, produce a noticeable variation of the sound which is very reminiscent of game sounds (less sharp but more tapered loudnesses). This is in fact exactly what ASDR envelopes do - they modulate the loudness over the duration of the tone. In other words, it's apparent that tones in games have been run through an ADSR envelope to make them sound better.
The mathematics is dry due to its abstractness however the fun is extracted by applying it to real practical pictures and realisation of ideas and concepts like - the motion of pressure waves, compressions and rarefaction. It also makes for more enlightened appreciation.
It's clear that there is a lot of work still to do, for example, the 2-hour lectures hide many details and the various aspects that you need to spend like I did this weekend - 2 days to appreciate and fully understand! There is a good chance If I don't focus on the detail, pay attention and study now, then in a couple of weeks, I'll be far too behind to catch-up adequately.
The maths work, particularly with my tendencies to solely focus on non-physics and non-mathematics related ideas daily such as solving theoretical problems or modelling problems in code, leaves much to be practised, especially to participate adequately in the mathematical domain. This might seem daunting but I find it quite empowering as I need to learn new things which I'm not used to which adds variety to my attention.
Speaking on logical problems that I face each day, these don't have standardised rules and laws that mathematics and physics have. For example, I don't need to manipulate or model problems as known mathematics algorithms such as coding around creating sine waves. That being said, I've already seen that this will change in gaming: I was reading code recently that made level objects bounce in a sine wave pattern/form...expressed that using sine waves in the code. That is something I don't do every day!
I think my everyday non-game related problems are logical - almost implicit, theoretical reasoning-related problems, not explicit formal manipulations of discrete math. That being said, I've found that my every-day type of thinking is more akin to the kind of thinking one does in physics - more contemplative, reflective and then I suppose, applicative by the realisation of code. Though, this might be a fallacy.
I also spent this weekend writing some code to decouple the input sensing code from the action that is performed as a result of that input sensing code. This is one of the key ideas that the computer games architectures course teaches. We're using Monogame and I was using events and delegates to represent this.
There is a lot to learn, and much sleeping has not happened because of it.
In other news, my trusty reliable laptop has started to show its age, though not in ways you might think. I've used the same laptop for almost 9 years and I've not noticed a single thing that appears to me that it's getting old. Ok, it might look old: https://www.cnet.com/reviews/lenovo-thinkpad-x220-review/, and the guy next to me in my gaming class says it looks like a big calculator! And I agree it ain't pretty, though Ironically, his gaming laptop is like a spaceship...not pretty either.
Anyway, I can run many browser tabs, none of the applications is slow - no degradations at all. So how has it shown its age? Unfortunately in the unlikeliest of places: drivers.
My graphics card, while absolutely capable of OpenGL cannot be used in Windows 10 because of the driver manufacturers (intel) have not added support for OpenGL for my particular graphics card, in Windows 10. So, its a limitation of the driver implementation in Windows 10, not the machine. If I ran Windows 8.1 - it would work ok. Attempts to get MonoDevelop and MonoGame on Ununbu are thus far inconclusive. Annoying.
With regards to my physical routine, with all the work and study, late nights and constancy of focus - waking up in the morning early to go to the gym has taken a hard hit. I went to the gym for the first time in months yesterday and it was tough. One thing that has offset this has been my running into the city. I've been able to do this with more frequency.
One noticeable change is that I've switched over from Strava Premium to TrainingPeaks. I'm following my fitness level through its TSS score and associated calculations.
- Details
- Category: Blog
- By Stuart Mathews
- Hits: 4688
Since BYOD and Implications for Network Security and Protocols, Packets and Prototypes, recently I've been learning about cryptography, primarily within the computing discipline, which essentially means encryption.
Prior to this was setting up firewall ACLs to inhibit or permit traffic from certain parts of the network. Then prior to that, the focus was mostly concerned with layer 2 security such as Port Security, VLANs and Layer 2 protocols such as Spanning Tree protocol and then even further back, was network vulnerabilities and techniques that attacker use to break into networks which I'm writing a separate Common network attacks and the shortcomings of standard network defences:
However, it doesn't stop there - that would be too easy, almost sane.
I've recently surveyed a great deal of technology so far, including MD5/SHA/HMAC integrity mechanisms (and authentication in the case of HMAC), symmetric block ciphers (DES, AES, RCx), stream ciphers(RC4, A5, DES), asymmetric ciphers(Diffie-Hellman, DSS, DSA, RSA, ElGamal, Elliptical Curve) - for confidentiality, as well as public key infrastructure including digital signatures, certificates, code signing (which can service a variety of purposes) and then protocols that use them, such as SSL/TLS and IPSec.
I've also had a look into how the DES algorithm is actually implemented and it's interesting: splitting binary up and glueing it all back together through 16 rounds moving in and out of constructs called P-Boxes and S-boxes, that permeate and obfuscate while using the key and plain text as input. Interesting, however, I don't claim to fully understand it which perhaps is a side project for some other time, as that might lift the lid on it. The patent has been royalty-free since 1997.
I've recently learnt how to establish a secure link (read VPN) between two sites using IPSec from two routers/firewalls using particular SAs (Security Associations - these establish an agreed stack of technology based on the aforementioned technologies) using ISAKMP/IKE and learnt how to up an SSL VPN using Cisco ADSM. I've still got a bit more practical work to do before I'm entirely comfortable.
I've come across some interesting research into the implication of conventional computing when it comes to encryption, particularly in light unconventional methods such as using light and the potential for quantum-based encryption. I've written an article about it but its not fnished yet however my inspiration comes from the follownig sources, listed here for posterity's sake:
- Naughton, J., 2019. We’re still a long way from making a quantum leap in web code-breaking | John Naughton. The Guardian.
- Scarani, V. and Kurtsiefer, C. (2014) ‘The black paper of quantum cryptography: Real implementation problems’, Theoretical Computer Science, 560(1), pp. 27–32. doi: 10.1016/j.tcs.2014.09.015.
- Greg Vetter (2010) ‘PATENTING CRYPTOGRAPHIC TECHNOLOGY’, Chicago-Kent Law Review, 84, pp. 757–1027.
- Salimi Sartakhti, J. and Jalili, S. (2019) ‘On the computational power of the light: A plan for breaking data encryption standard’, Theoretical Computer Science. Elsevier B.V, 773, pp. 71–78. doi: 10.1016/j.tcs.2018.08.015.
- Cesare, C. (2015) ‘Encryption faces quantum foe: researchers urge readiness against attacks from future-generation computers.’, Nature. Nature Publishing Group, 525(7568), pp. 167–168.
- Kolata, G. (1983) ‘Flaws found in popular code’, Science (New York, N.Y.), 219(4583), pp. 369–370. doi: 10.1126/science.219.4583.369.
- Putra, S. D. et al. (2019) ‘Power analysis attack against encryption devices: a comprehensive analysis of AES, DES, and BC3’, TELKOMNIKA (Telecommunication Computing Electronics and Control), 17(3), pp. 1282–1289. doi: 10.12928/telkomnika.v17i3.9384.
- Calmels, B. et al. (2006) ‘Low-Cost Cryptography for Privacy in RFID Systems’, in Smart Card Research and Advanced Applications: 7th IFIP WG 8.8/11.2 International Conference, CARDIS 2006, Tarragona, Spain, April 19-21, 2006. Proceedings. Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 237–251. doi: 10.1007/11733447_17.
- Velan, P. et al. (2015) ‘A survey of methods for encrypted traffic classification and analysis’, International Journal of Network Management, 25(5), pp. 355–374. doi: 10.1002/nem.1901.
- Kapoor, B., Pandya, P. and Sherif, J. S. (2011) ‘Cryptography’, Kybernetes. Emerald Group Publishing Limited, 40(9/10), pp. 1422–1439. doi: 10.1108/03684921111169468.
- Lian, J.H. & Chen, K. 2011, "Implementation of DES Encryption Algorithm Based on FPGA and Performance Analysis", Applied Mechanics and Materials, vol. 130-134, pp. 2953-2956.
Also, part of my recent study I have been exposed to the ASA 5505 Next-Generation Firewall Gateway which is a bit more advanced than the Cisco IOS-based ISR routers I'd dealt with before, most notable is the ability to define 'objects' that can define aspects of networking which you can then use in expressions such as establishing firewall rules. Another is the first-class representation of VLANs (which, along with routing I've come to appreciate a lot more)
In other news, I watched 'The Gentleman' which is a classic Guy Ritchie film like 'Lock, Stock and Two Smoking Barrels' which I enjoyed immensely. I also saw the new Star-wars film which was better than the last one, perhaps even better than the last few and so quite enjoyable - though 'The Gentleman' was the hands-down favourite.
I recently started running recently again, I stopped because I had too much work to do which unbalances things a bit and does start to affect my Zen. That being said, I'm back at it now. Anyway, some of my most recent runs are below.
Here we're looking at about a 4.36/km pace which is about right. This was my most recent run back (And I feel like I'm saying that a lot recently because things have become a lot more haphazard recently which is affecting pretty much my 'everything' right now).
It's back at my usual pace, however, it's still quite a jaunt. I feel like I'm still working to regain my usual comport and my VO2 max has dropped to 60.
My resting heart rate has been up and down over the past couple of months which is a bit worrying(but not that worrying). This took a relative effort of 31 which shows that I'm still not quite back yet.
Prior to that, there was this one which took an effort too, clocking in at 25 on the effort scale but managing a pretty decent pace at 4'34 over 8.5km.
It's pretty much at this point that I found that there was a 'little' improvement detected at some of the stages of the route that had previously been quite tough and uncomfortable, ie it was less uncomfortable this time around.
This was a bit of a weird one. I decided to go out on the canal again but this time I'd turn left and see what that looks like. It was a disaster.
It was like running around a sunny city where the roads were made out of chocolate. The roads melted as my trainers hit the turf and it wasn't because it was sunny - it wasn't - it was because it had rained the previous night. It was a slodgy, sludgy, mucky, squidgy, squelchy - a real melted milk-chocolate mess.
So I thought better of it and part way through, decided to explore other routes - hence the 4-legged spider-like route I made.
This one's a bit fast at 4'27 which for some reason I registered no HR for, so I can't say how it compares effort-wise compared to others only that it was faster, and a bit longer - not too sure why. Maybe I was dithering at pace.
Also lost my heart here, but still a good steady pace for a dead guy at 4'35.
This was probably one of the nicest runs I've done in a long time, I ran towards Rickmansworth on the Canal and I'd never done that before around where I live - surprisingly.
This was quite special because I discovered a new route that runs past a lake where you can catch fish and a Marina which was new!
The lake is perfect and the weather was great and I ran in complete bliss without a care in the world. That doesn't happen enough, but funnily - only happens while I'm running. It's usually when I start walking that things start slowing down and you notice problems and its like rewinding like some old record.
Anyway a good run none-the-less!
I've also just made a record recovery from a cold that I caught on Friday: I slept from 19:00 on Friday(left work early...and live 1 hour away) and basically hibernated until today. And it looks like it's done the trick, and come Monday no one will know any differently.
I also took Sudafed for my blocked nose, Flu/Cold Hot drinks for my headache (I like the Blackcurrent flavour meds from Boots - I'm a cheap date) and I drank plenty of fluids - which is what every Doctor on the planet scratches into their consultation desks I'm sure.
I'm taking a new courseafter work working with Python and how to model digital signals with it. I'm also going to extend my foray into gaming by learning more about computer game Architectures, which should help my understanding of designing real-time systems - which should see me up to the point at which I perish and disintegrate entirely.
- Details
- Category: Blog
- By Stuart Mathews
- Hits: 4796
Since I finished my Digital Forensics Course (wrote the exam on the 24th Oct), I've moved on to a new course on Network Security.
So far, I've already been disassembling networking protocols using Wireshark from almost every layer within the OSI network stack. This is a similar thing I had to do when designing/debugging the networking protocol I designed in my broker a while back when sending TCP/IP packets back and forth between the client, server and broker, though this formalises the theory somewhat.
I've been always interested in the technical aspects of network routing but now, I'm able to incorporate principles of network design, routing and security into my study which is great. We're using a build of ArchLinux provided by Cisco as part of their CCNA CyberOps and CCNA Security modules, which the course is based primarily on.
I say primarily because I still have to write essays and reports alongside being graded by the CCNA exam subsystem, so there is no chance to escape being assessed on all the material.
I made great progress recently in my understanding of IP routes and routing in general, particularly with regards to layer 3 IP address and subnet calculations and Layer 2 routing is also something I've come to appreciate so far, particularly the Spanning Tree Protocol.
I've also been learning about elements of the Game Design process which is actually quite fun and more recently we've started learning about Unity a 3D C# game engine which makes things ridiculously easy to create a 3D game. It also shows how much is involved in creating a game engine. I'm only touching the surface with my own prototype which is rudimentary at best.
I've been working on my Game pitch for a game I've designed called Mazer. Designing games is a very creative process, something I've not really experienced before and while it's new and interesting, it's also quite tricky because it's not just about development/programming.
I've got to give a presentation on my design-pitch next week. I'm prepared, I've designed a pretty cool game which I think with a little blood, sweat and toil, I can pull off.
It's basically a mix between Pac-man, space invaders, a puzzle/jigsaw and a maze. Here's the presentation/pitch for far:
11/08/2019: I gave the presentation yesterday. It was a bit nerve-wracking talking up in front of the people but I did ok, which for a creative exercise like this - I'm happy with as public speaking is not usual for me.
I've now got to write up a game design spec and then produce a prototype. I've been designing Mazer in my spare time using my C++ game engine prototype but for assessment, I'll be using unity which means I'll need to port my maze generation code into C#, which should be easy. More about that below.
I'm interested now in learning more about quantitative research approaches and sampling techniques, in view of exploiting stuff I've not learnt about before. For example, basic statistics describing populations and central tendency via standard deviation, dispersion and variance might be vastly improved upon using aspects of theory testing via statistical inference which I've not got much experience with. So I'd like to learn more about that.
On Friday(my day off) and Saturday, I spend time reading about the different research strategies including Design and creation (I'll probably use this predominantly for developing my Game idea), Experiments, Case Studies, Interviews, Observation and general Questionnaires in obtaining sample research data.
On the game development front, I've had to cut back on my 3D ambitions and branch off new code base that focuses solely on 2D graphics for Mazer because mazer is basically a 2D maze-shooter-puzzle.
I've implemented a rudimentary algorithm which is not based on the well-known Prims algorithm but my own (dangerous!) 'it-makes-sense-in-my-brain' algorithm to create sub pockets of mazes.
The net effect is a maze-like construction, as Mazer is not really a traditional maze, as it requires you blow your way walls via procedurally generated pseudo-sub-mazes(pockets) in order to make your way towards a destination(see the presentation for the game idea).
So, unlike prim's algorithm and other's like it, I don't need a maze that has a solution (But I'll need two solutions paths for the enemy patrol routes), but something that the player can be trapped in and blow themselves out of!
Here is what my 'Pockets of destruction' algorithm does so far:

Granted, it doesn't look like much now but it proves that the algorithm can generate these kinds of open-closed room systems that I'm after. That little white dot in the middle, well that's the player.
I'm working on the collision detection now as my player can just go through walls like a ghost, which is not part of the game!
My "pockets of destruction" maze algorithm (for now, it basically plops a series of squares down and randomly removes walls):
auto screenWidth=800;
auto screenHeight=600;
auto roomWidth = 25;
auto maxRows = screenWidth/roomWidth;
auto maxColumns = screenHeight/roomWidth;
vector<shared_ptr<Room>> mazeGrid;
stack<shared_ptr<Room>> roomStack;
for(int y = 0; y < maxColumns; y++)
{
for(int x = 0; x < maxRows; x++)
{
auto gameObject = shared_ptr<Room>(new Room(x*roomWidth, y*roomWidth, roomWidth));
mazeGrid.push_back(gameObject);
}
}
auto totalRooms = mazeGrid.size();
for(int i = 0; i < totalRooms; i++)
{
auto currentRoom = mazeGrid[i];
auto nextIndex = i + 1;
auto prevIndex = i - 1;
if(nextIndex >= totalRooms)
break;
auto nextRoom = mazeGrid[nextIndex];
auto row = abs(i / maxColumns);
auto lastCol = (row+1 * maxColumns)-1;
auto col = maxColumns - (lastCol-i);
bool withinRowsRange = row >= 0 && i <= maxRows;
bool withinColsRange = i >= 0 && i <= maxColumns-1;
int roomAboveIndex = i - maxColumns;
int roomBelowIndex = i + maxColumns;
int roomLeftIndex = i - 1;
int roomRightIndex = i + 1;
bool canRemoveAbove = roomAboveIndex >= 0;
bool canRemoveBelow = roomBelowIndex < totalRooms;
bool canRemoveLeft = col-1 >= 1;
bool canRemoveRight = col+1 <= maxColumns;
vector<int> removableSides;
if(canRemoveAbove && currentRoom->IsWalled(TopSide) && mazeGrid[roomAboveIndex]->IsWalled(BottomSide))
removableSides.push_back(TopSide);
if(canRemoveBelow && currentRoom->IsWalled(BottomSide) && mazeGrid[roomBelowIndex]->IsWalled(TopSide))
removableSides.push_back(BottomSide);
if(canRemoveLeft && currentRoom->IsWalled(LeftSize) && mazeGrid[roomLeftIndex]->IsWalled(RightSide))
removableSides.push_back(LeftSize);
if(canRemoveRight && currentRoom->IsWalled(RightSide) && mazeGrid[roomRightIndex]->IsWalled(LeftSize))
removableSides.push_back(RightSide);
// Choose a random element wall to remove from possible choices
int randSideIndex = rand() % removableSides.size();
switch(removableSides[randSideIndex])
{
case 1:
currentRoom->removeWall(TopSide);
nextRoom->removeWall(BottomSide);
continue;
case 2:
currentRoom->removeWall(RightSide);
nextRoom->removeWall(LeftSize);
continue;
case 3:
currentRoom->removeWall(BottomSide);
nextRoom->removeWall(TopSide);
continue;
case 4:
currentRoom->removeWall(LeftSize);
auto prev = mazeGrid[prevIndex];
prev->removeWall(RightSide);
continue;
}
}
/* Queue each generated game object to be added to the current scene */
for(auto gameObject : mazeGrid)
{
std::shared_ptr<GameObject> cpe = std::dynamic_pointer_cast<Room>(gameObject);
auto event = std::shared_ptr<AddGameObjectToCurrentSceneEvent>(new AddGameObjectToCurrentSceneEvent(&cpe));
EventManager::GetInstance().RegisterEvent(event);
}
Still got a long way to go, and still needs to be ported to C# for prototyping but its a start.
Oh, and in other far better news - we won the Rugby World Cup, which really made my day :-)
So proud of them.
I even wore my Springbok rugby jersey at half time (Transported back to my 9-year old self)
- Details
- Category: Blog
- By Stuart Mathews
- Hits: 3473
Since Some more Direct X10, I noticed a few days ago that my tablet's charger stopped working, I ordered a replacement which arrived on Friday. I've grown quite attached to my little stupid tablet. It's really helpful to have two screens while computing(it has a nice dock that makes it slant like a laptop screen).
I decided to put windows 10 on it and that didn't work out - all sorts of problems with the media not being able to be read etc - I had Fedora 30 on it prior and was slightly regretting having removed it.
I ended up installed MxLinux which then it didn't want to work because it couldn't install the boot loader due to some UEFI/secure boot rubbish. I then decided to install OpenSuse Tumbleweed and now I'm quite pleased with it, particularly its performance, running KDE Neon. They've done great things here and now even my Gnome 3 experience under Fedora seemed so slow in comparison.
It was an early start to the gym this morning, up at 4:30 in at 05:00 out by 06:30 and then started the day. began with a little functional programming by adding a new project to my LanguageEXT tutorial which shows how you can change the state of an object over time. I illustrated this by using the Fold()/Aggregate() method and applying events as the source of changes.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using LanguageExt;
using LanguageExt.DataTypes.Serialisation;
namespace Tutorial37
{
// This tutorial shows how you can use the Fold() function in languageExt to change the state of an object over time
class Program
{
static void Main(string[] args)
{
List<int> years = new List<int>
{
1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019
};
List<Event<Person>> events = new List<Event<Person>>
{
new ChangeNameEvent("Stuart"),
new ChangeExpertiseEvent("Programming"),
new ChangeNameEvent("Stuart Mathews"),
new ChangeExpertiseEvent("Running"),
new ChangeAgeEvent(33),
};
Person person = new Person();
// A state (InitialResult) changes over time and it changes using results of the previous change. It uses an item from the array in changing the state each time.
// The state changes the number of elements in the IEnumerable
// For a Lst which has multiple items in it, the state will change that many times
// NB: years represent the state changes that will occur
var changedPerson = years.Fold(/*initial state*/ person, (previousResult, year) => ChangeState(year, previousResult));
// Apply some events to the person over time
changedPerson = events.Fold(person, (previousResult, evt) => evt.ApplyEventTo(previousResult));
// View the changed person
Console.WriteLine(\("{changedPerson}");
// local function
Person ChangeState(int year, Person previousResult)
{
Person updatedPerson = new Person(previousResult);
updatedPerson.History.Add(\)"\nIn {year}, this person was {updatedPerson.Age} years old");
updatedPerson.Age++;
return updatedPerson;
}
}
}
}
It's pretty interesting and the whole source can be found here under tutorial 38, where you can find the code for Person. Event(s) and run it and see the results etc
Basically its a very simple demonstration of a way that you can apply changes to an object by encoding various changes that can occur to that object into events that house a particular kind of state change of an object. There is probably a software architecture pattern there but I can't remember what its called. That whole idea is pretty much embedded into the LanguageExt Fold() method or the .net aggregate method.
I also decided to make an entry on Immutability in tutorial 39 which shows you how to design your objects with immutability in mind.
I also decided to do some light reading on performing effective investigations, filling out 5x5x5 intelligence reports and various bits and pieces about case management and labratory processes. I've got to do some practicals around Android forensics which I've put off because its all a bit laborious as this stage having performed a pretty full-on investigation over the last month or so and having had to then write up a report on it following correct invesgitation principles, procedures etc. So that can wait until next week-end I thought and after making a few notes, I decided to turn my attention to 3D Math. In particular, vector and matrix algebra and transformations. I want to be ready for when I have to be tested on it!
I started learning about 3D perspective projection (which talks about foreshortening) and orthogonal projection and went through the math of translating, rotating and scaling vectors using Matrices to represent affine transformations and then started looking at plugging these operations into the pipeline.
That last part pretty much took me most of the day. A day well spent!