For the past week I was trying to implement a simple program for a PIC24HJ128GP502 microcontroller in PIC assembly and found it hard to figure things out due to the lack of tutorials on 16bit PIC assembly (most sample code I found on Google were for the 8bit PIC16's), so I decided to write a brief tutorial so that other people won't have to figure everything out for themselves from the datasheet, like I did.
Lately, I've been working on a from-scratch game engine in C++. My main goals are ease of use (for the gameplay programmer), flexibility and performance.
To achieve these goals, I employed various tactics:I still have a lot of work to do before the engine can be used for real games, so we will have to wait and see how successful I was in achieving these goals. So far tests, benchmarks and profiling have shown positive results. More on this as the engine matures over the coming weeks.
Before I introduce the engines overall high-level architecture, I will briefly talk about the component entity system and its parts. I feel it is also important to define the terms I use when talking about my engine, since they diverge somewhat from those normally used when talking about component entity systems. I made these changes to the terms because I felt the common terms were too ambiguous and vague.
That's the engines entity system, which is the core of the engine and were the bulk of the logic lives.
Now I will briefly talk about the engines overall architecture. You can get an idea of how the engine is constructed in the high-level architecture diagram above. You can see how the majority of the engine is composed from the entity system. The other important aspects are the input events, the renderer, the physics engine and (not shown in the diagram) the resource system.
Other modules and subsystems have not yet been developed, but when the engine is complete, it will contain a few more modules: audio output, an AI planner (for high-level decision making. Low level decisions can be made inside behaviors and handlers), a force-feedback generator, an embedded scripting language, perhaps a networking later (if I decide to give the engine networking capabilities), helper and convenience classes (polygons, planes, line segments, bounding boxes, vectors, matrices etc) and SIMD vectorized versions of these, where it makes sense. All traits are already aligned to 16-byte boundaries in anticipation of future SSE code.
That's pretty much it. More details will follow as the engine becomes more and more functional. I expect to write a few posts on the internal technical details, on the gameplay programming interface and on the game I will be writing using this engine.
But first, I will leave you with some technical details of the engine (language, libraries used, size, etc):
Before I go, shameless plug:
In a previous post, I wrote about a project I once worked on: Nexus (formerly NetPad).
Well, I just came accross a Windows executable of an old and early version! I've uploaded it here, in case anybody wants to try it out. Sadly, the code seems to be lost forever :-(So, since I've documented some of the things I've worked on in the past, I figured I may as well tell the world what I'm working on now. So, here's a list:
In the interest of immortalising prehistoric projects I once worked on, I decided to post them to the wonderful world of Internet.
This is by far the projects I put the most work into, but also, sadly, the ones I can talk about the least. Such is life in the world of professional software development. I was at Cellusys for a six month internship while I was still studying, and then, a year later, I went back to work there full time for a year and 9 months. In that time I worked on a number of large projects and learned a lot of buzzwords: Java, Spring, JNI, SS7, GSM, SIGTRAN, Diameter, SMPP, ASN.1, MTP3, M3UA, SCCP, TCAP, MAP, SM-TP, SCTP, SMTP, Terracotta, Hazelcast and probably a bunch of protocols and technologies I've since forgotten about. I was involved in all aspects of the various projects, including planning, research, design, development, testing, installation and support. I attended the GSMA Mobile World Congress in Barcelona on behalf of the company and travelled to the middle-east to perform an on-site installation. Overall, a very well rounded experience.I primarily worked on three projects while at Cellusys: 1. The SMS Defence anti fraud and anti spam platform. By extension, I also worked on the flagship CSS7 platform, on which most of the products are built, and related components (SMS message codec, SNMP notification system, application logic for blacklisting, whitelisting, throttling messages, work distribution and much much more). This was a large clustered system which, to put it simply and briefly, allows mobile network operators to monitor and filter SMS messages on their network in order to prevent fraud and spam and essentially protect themselves and their customers, especially from messages originating outside of their networks. 2. Prepaid SMS billing system. This system was designed for a niche use case where certain mobile network operators are not able to provide SMS messaging services to their prepaid customers while roaming on foreign networks, due to lack of billing infrastructure. This system basically processes messages sent by the networks roaming customers and performs billing operations, if required. I was responsible for the billing aspect of this project, which consisted of communicating with the networks billing servers via the DIAMETER protocol. A lot of time and effort was spent into insuring that there is absolutely no room for failure in the billing process, that every transaction is fully audited and that all billing operations are performed correctly. 3. Parental Control system. This is the only user-facing system which I worked on. It basically provides a web interface (two actually, one for end-users and one for the networks support team) which the users could use to place blocks on their children's phones. It allows parents to blacklist and white list specific numbers, blackout messaging during certain times of certain days (eg, week days during school hours) and limit how many messages the children are allowed to send in a given time period (daily, weekly, monthly). Besides the above projects, I was involved in R&D into various technologies and components for use in the company or future products.
In the interest of immortalising prehistoric projects I once worked on, I decided to post them to the wonderful world of Internet.
I worked on a power profiling project for audio-event detection with Graham Healy as my third-year Computer Science project in Dublin City University. The project was supervised by Prof. Alan Smeaton. The Dublin City University Center for Digital Video Processing was working on wireless sensor network technology in the area of audio event detection. For this project, we worked together with one of the CDVP PHD students, who was actually implementing the audio event detection system. Our project consisted of taking his research, porting it to actually run on the wireless sensor network motes (so, to nesC and TinyOS) and then to power profile it and determine if there are any techniques or insights which the CDVP could use to retain the highest event detection accuracy with the lowest power consumption. Our work consisted of porting MATLAB code to TinyOS, simulating the event detection procedure in the Avrora TinyOS simulator and generating a power profile for the task. We then analysed both the accuracy of the event detection techniques and the power profile to find a balance between power consumption and accuracy. To do this, we built a tool in Python to visualize the audio data and event detection, so that we could determine accuracy and correlate it to the power consumption. We then repeated this for a number of different variables (event detection techniques, audio window sizes, sample rates and so on) until we found the "sweet spot" where power consumption was as low as possible without having a detrimental effect on the quality of the event detection. For this project, we used a mixture of nesC (the event detection code), Java (the Avrora simulator had to be extended by us) and Python (the analysis tools which we wrote for this project).Our approach, analysis and results is contained in the attached PDF files. The functional specification is NOT missing a page, even though the numbering seems to suggest that it is.
In the interest of immortalising prehistoric projects I once worked on, I decided to post them to the wonderful world of Internet.
I'll start with one of the more interesting projects: A Framework for Augmented Reality Applications. I worked on this project with Graham Healy as my Computer Science final year project in Dublin City University. The project was supervised by Prof. Alan Smeaton. The concept was to build an augmented reality "platform" which allows one to quickly and easily build AR applications. Since we didn't have that much time, we specifically limited it to 3D audio-based feedback (that is, no visual feedback at all, though our extensible design would have made it trivial to add visual components later). In short, we designed and built a kit which tracked you're movement, location and orientation and provided you with localised 3D audio feedback. Some of the demonstration applications which we worked on were:A navigation application, for example, to help blind people navigate. You defined a set of waypoints and it would guide you on a path through them until you reach the destination. It did this by continuously playing a sound at the location of the waypoint (that is, the 3D audio made it seem like it was coming from that location, though in reality we generated it dynamically and played it with a pair of wireless headphones). Since we had sensors to detect your position and orientation (amongst other things), we could detect when the user walks into the waypoint, at which point the sound would stop playing and the next one would start. The attached technical specification has some more details on this application. Another demo application we worked on was to simulate a band playing music. A number of synchronised virtual musical instruments were scattered around the room, allowing the user to walk around and between them, as if they were actually amongst the musicians. The final demo application I will mention is one where we detect walls using an ultrasonic sensor. When the sensor detects a wall, it repeatedly played tone. The speed of which the tone was repeated was dependent on the distance to the wall. This meant that if you shook your head form side to side, scanning the length of the wall, the sound played effectively tapered off into the distance giving you a recognisable audio representation of the shape of the wall. The kit consisted of a number of hardware and software components. The headset consisted of a pair of wireless headphones, a Ubisense location tracking tag, a digital compass, an accelerometer, an ultrasonic sensor, a PIC microcotnroller (which basically multiplexed the signals from the sensors) and an RF-transceiver (we actually used an XBee Zigbee wireless sensor network mote for this for convenience, since we had them anyway, though it would obviously be cheaper to use a normal RF-transceiver). The software consisted of a number of server applications which communicated over TCP/IP. We had a number of these to preprocess the signals from the sensors (eg, to apply calibration data), one to generate the 3D audio (we had to run this on a computer of its own because we needed a specific sound card with HRTF support, to improve the quality of the 3D sound) and an application which bound everything together to actually create the user experience desired. The software was written in a mixture of PIC assembly, C, C++ and Python.
Advance apologies for bad formatting - seems posterous isn't the greatest for formatted text!
Clojure makes a lot of things really easy. Just for fun, I implemented a simple system for constructing a component based software architecture where each component runs completely independently and asynchronously. Components communicate by sending events to each other, achieving a flat software hierarchy.
We can test this by creating and running some test components:
Comp1 contains three event handlers - :init, :print and :set-msg. Comp2 only contains two event handlers - :init and :print.
:init is called to setup the components state and trigger any initial events. :print will print the contents of the states :msg slot to the terminal and :set-msg will change the :msg slot to the value of the events message.
Ho Hello
It becomes more interesting if the components do a little more, for example:
Running this will output:
Hi Hello Ho Hello
Note how the first event gets processed before the secod one - ie, Comp1's :msg has not yet been modified.
Of course, you can set up all sorts of crazy chains of events with many event types, complex logic and so on.
What would be really nice is a DSL designed for writing these component-based programs, since calling run-components and make-components manually is a little messy. Something like the following would be nice:
Luckily, this is the kind of thing Lisp is good at and Clojure, being a Lisp dialect, has everything we need to make it happen:
These macros transform our convenient little DSL into a set of calls to run-components and make-components. Success! We can now write fun little component-based programs, arranged in a flat hierarchy, using an anonymous (sender never knows who receives the events; receiver never knows where the events come from) event-based messaging system.