Fall fotonix for your eyes!
Fall fotonix for your eyes!
Summer classes and work in IT have kept me busy the past few months, but I've found time here and there to tweak my setups and work on the hyperkaos engine. Name of the game has been functional minimalism.
I've been using loksh as my shell on all my machines for the past couple months, and I'm really loving it. At 1/5 the size of bash, and with the "keep the cursor-area centered on the screen for very long command lines" feature, it's been a refreshing experience. At first I missed my prompt colors, but I don't really anymore. Otherwise, I'm supplementing coreutils with plan9port/9base, and you can see in the screenshot my little shell function to give "list-directories-first" functionality to the plan9 ls. Considering the "cat -v considered harmful" attitude, I am a bit suprised that plan9port cat is actually bigger than the GNU cat, but every other plan9port utility I commonly use is significantly smaller and faster than the GNU alternative. Pretty nice.
Scripting-wise, I've been porting my tiny scripts to posix-compliant versions calling /bin/sh. Nothing terribly exciting, but good practice.
My xfce4-panel setup as of late has become a bit more traditional, although systray on the left might seem alien to most. I see the systray + window buttons as a contiguous region, with the desktop switcher and clock (and battery percentage indicator on the laptop) all hugging the right edge.
I had been planning to convert the hyperkaos engine to pure C for a while, but after an incident in my Data Structures class this summer I was completely done with C++ for any personal projects. It goes like this:
Shared and weak pointers are supposed to alleviate the pain of manual memory management, right? Our instructor heavily suggested we use them. So, we (my partner and I for this specific project) were using them. The project was a simple networking project. Given a long list of pairs of names, put together group structures with the correct members and then list a minimum list of new connections to unite all the groups into one. So we had a simple hash table where a name lookup could give you a node containing the name string and the group ID, which was a weak pointer that eventually led to the root node of the group. We used shared pointers for everything else (ie the buckets and next-pointers for our collision handling, and the pointer-objects for our entry entities themselves).
Everything was going well, until we had to test our program's speed with a very large dataset. It was 10x slower than we wanted... So after setting up a gprof on the program, guess what I found...
The weak and shared pointers were slowing everything down, causing that 10x drop in performance! Reference counts, locking, etc, was taking 85% of the runtime of the program! So I did a quick edit and converted all the pointers to raw pointers, did manual cleanup in the destructors, and our speed improved to within nominal levels.
So that was it. With the exception of generics, there's no reason to use C++ for anything as far as I'm concerned. I've converted the hyperkaos engine to C from C++ with no ill-effects, and with cleaner architecture and smaller binary size to boot. New features since the last blog post include some new Kaos types, a basic config.h, sound, and a rudimentary cutscene engine.
Stay frosty, my nerds!
Since the spring I've been working on a game engine with SDL1. I wanted to do an adventure game with an emphasis on puzzles, and the map systems of classic Legend of Zelda games inspired me a lot.
The basic building block of this engine is the Room. Behold above, the first room in the test map. It has two floating computer-chip thingies that spin with a cool animation and cannot be walked on. It also has warps to three other rooms.
This header file for the room class shows that it's composed of a few simple things:
- a background spritesheet (composed of four frames for ambient animation)
- a vector of obstacles (invisible rectangles you can't walk on)
- a vector of fg objects (spritesheets with animation loops)
- a vector of warps to other rooms
- a vector of pointers to people
- a vector of pointers to event threads known as HyperKaos
Everything else in the room is about keeping track of and manipulating these things.
You may note that the vector of pointers to people points to "Players." Right now, they just have a default constructor used by the special Player "hero", but shortly I will add a more in-depth constructor to build NPCs with.
In addition to the data stored in rooms, we have some global data generated in chunks by the function bufferData() on demand, and stored in arrays for use on the map. These include rooms, textboxes, and event snippets. bufferData() and unloadData() both take arguments for the chunk of data to buffer/delete. After you have warped to the room in the buffered chunk (automatically buffered because warps have to know what chunk they are warping to), the old mapData array is deleted, and the buffer is pushed to mapData. The savestate is a product of unique prime numbers. When a special event happens, its kaosID is multiplied onto the savestate. By checking if the savestate is divisible by a certain prime nubmer or product of primes, we can dynamically change the game depending on if certain conditions are fulfilled by the player.
Setting up a map is elementary, if not a bit tedious because of all the numerical values. unloadData() has to delete the rooms, the dialogueData, and the kaosData. Destructors keep track of all the other stuff when we delete the rooms.
The HyperKaos system is extremely flexible and allows you to declare a whole bunch of Kaos elements, or little events, and chain them together in a HyperKaos. The HyperKaos has an associated rectangle in the room. They come in two types: passive and active. A passive HyperKaos will activate when you step on it. An active HyperKaos requires you to press the action button while standing on it to activate it. Right now I only have a few types of Kaos as proof of concept, but many more will be added as I continue to work on the engine. The possibilities are near endless for what can be done with this, and I plan to use a special data segment of HyperKaos chains as magic spells for solving puzzles.
The textbox system, as you can see in the above screenshots, allows us to just generate it as a static element when a chunk is loaded and store it in the global dialogueData array. It can then be added to a HyperKaos as a Conversation.
The engine supports (as of yet) a single save file, which works as you would expect, and stores the player's exact location along with the current savestate number.
We'll see where it goes from here. I still have to add sound effects, music, and lots more Kaos types to the engine, not the least of them magic spells. I've been slowly fleshing out the game world in my head, too, and will be excited when I can shift my focus from coding the engine to producing content for the game.
Spring break trip to Marin County and SF with Katie.
Ovnimoon & Zyce - Stereo Space (Erotic Dream remix)
Bjorn Akesson - Shadows (Radio edit)
Techyon vs Dusters - Dustech
Cypher 0 - Alternet (Deedrah remix)
D-Addiction - Royal Addiction
Sono - Keep Control
D-Addiction - Royal Addiction (reprive)
Ticon - Super Model Girlfriend
Simon Baker - Grey Area (Burnski & Robert James remix)
Orjan Nilsen - Lovers Lane
Man With No Name - Teleport
S.U.N. Project - At The Edge of Time
Dali - Hectic
Rex Nillith - Hyper-Beam!
Dali - Hectic (reprive)
Vibrasphere - Erosion (Glenn Morison & Bruce Aisher remix)
Some favorites off the camera reel from the past few months
I am pleased to announce v4.0 of nilFM! I have built a simple CMS framework Ayanami and redesigned the site around it.
Although the site has been rebooted, all the old mixes and digital art is still here in the archives.
This reboot is roughly concurrent with the launch of the Thought Experiment shop on etsy. My girlfriend and I have been working on a line of graphic tees, 3 of which are currently available in various sizes, fits, and color options. More on the way soon, and we hope to diversify the shop before too long.
And now . . . I want to mix :3