NES Adventures - Part 1 Posted on August 16, 2014 at 14:47
I've been dreaming of assembly for the last two nights...
In his blog, Cyrus non-seriously challenged me to create a raycaster for the NES.
I'm not 100% sure whether I'll be able to pull that off or not, but I did start tinkering with some of the tools again, and decided to challenge myself incrementally. There's still a lot I have to learn about the NES hardware, and the tricks I can pull off with it.
So what I'm going to do is post blogs like this each time I complete a challenge I've set. The first one was to create a "text writer", something like the printf() function, for the NES.
I'm using pure assembly code, and a simple bitmap font. Strings are written to the nametable at runtime (A considerable amount of my time was spent last night trying to safely modify the nametables without glitching).
The result is this:
It's also scrolling, but you can't see that.
If you have an NES emulator, you can take a look at the ROM: CH01.NES
And here's the assembly listing for those of you who can read it :P
;; Non-Maskable Interrupt
;; Do any DMA stuff here.
.db "HELLO SIXTY FOUR DIGITS"
;; BANK 1 SETUP
There are a couple of problems with this code that I'm already aware of. Firstly, the nametable modification is inefficient. I only need to write to the nametable once, and leave it until I need to change it again.
At the moment, I'm doing it every frame.
The write_nt_str macro doesn't work, because I can't figure out how to pass a label's address to a macro with this damned assembler (I've nearly convinced myself to write my own assembler for 6502 code).
There are a bunch of inefficient comparisons/branches. I remembered afterwards that the lda/ldx/ldy ops also affect the C/Z flags, so...
Anyway, I took a trip recently to the city of Cape Town. Was a rainy weekend, but I had a good time. And of course I had to visit the game shops and bankrupt myself.
Because that's how I do things.
I managed to get hold of Street Fighter IV, Bionic Commando and Red Faction 2 as part of a "3 games for R129" bargain (That's about $10). Was thinking of getting Dark Souls 2, but the retail price was far higher than Steam's price, so I decided to hold off on it for a while longer.
And then, while wondering around aimlessly in the local mall, I went into an electronics and audio shop for the fun of it. And I found something I had been looking for: An R4 clone.
An R4 is a flashcard system for the Nintendo DS series (You can use the DS ones on a 3DS too, to play NDS games and run homebrew roms).
And these guys were selling one of the units I was thinking of ordering from a local importer for about $30 less than the importer was selling it for.
So of course I snapped it up. And now I have what amounts to most of the good NES games on my DS, a bunch of homebrew apps, a DOS emulator, an SNES emulator that works really well (Can play Megaman X1, Super Mario All Stars + Mario World, FFIV, but not games like MMX2, X3, etc. Emulator isn't fully complete/compatible... I might just have to write my own :P)
But the real reason I got an R4 was so I could do silly things like port some of my games to it. For no real reason other than that it's something I've wanted to do for a while: Make something I can run on actual hardware.
And if I make something good enough, I can always pull a Battle Kid and make back what I spent on the unit :P
My GBJam game is coming along... slowly. I've done more engine work than any game-related work, but that's fine by me. I'm actually looking forward more to the 7DFPS jam coming up directly after GBJam.
No, I'm not going to try make an FPS for the DS in seven days... ... Oh damn it all. I just thought of what Exile would look like on the DS...
Maybe if I can learn DevKitPro's setup and the basics of libnds in time, I'll take a crack at it. :P
I can implement a software renderer pretty quickly if I have access to a good framebuffer. Give me a way of drawing pixels quickly and I'll pull it off.
Comment about how screwed up/odd my programming style is below.
And yes, I'm fully aware that I'm still using OpenGL 1.2 functionality. I'm just keeping things simple for now; the rendering code is pretty much plug-in/out as far as I'm concerned; a black box from an outside perspective. So switching it over to a shader based system should be a piece of cake.
Well, that's enough from me. Go blog some more guys, you're being boring. =3
Final Boss confirmed (Progress Update) Posted on July 08, 2014 at 09:06
Completition update, I guess. Spent the last few days... doing something completely unrelated to the Hunter reboot I was working on.
That is to say, I ended up back in the midst of Exile's code again. Must be something I ate.
So progress report... I spent the last two days adding in a feature that was in that one version of Exile that had the 3D Mana pickups: the model loader.
As seen in Steven's blog, here is the final boss of Project Phoenix, with its texture this time.
Final boss confirmed. Pay $5 for the "Phoenix Stone" DLC package and you'll get a free spaceship to tackle this monster with!
Actually... it turns out that I'm not going to be using models very much; this project is just to 'fix' the original Exile up a bit, decorate a little, and generally get it back to the point it was at before I lost all the work I had done (That reminds me... I should copy my current working code to Dropbox while I'm thinking about it)...
So in other words... I've wasted time working on a feature I'm not going to be using yet. But that's nothing new.
Technically, I could've done a lot more over the last week, but I was having a bit of an issue with my eyesight. My right eye is a lot weaker than my left, and it's been getting worse over time; partially due to the amount of time I spend in front of a computer monitor, and partially due to these glasses I have. They're too weak to correct my vision properly now.
Just to demonstrate how blind I am, I can't see 12pt text on my monitor at a distance of around 40cm without squinting really hard. But that's only if my right-eye is open. The second I close it I can see with much greater clarity. The glasses help to a degree, but are causing strain themselves (I need a thicker lens at this point).
So I spent a bit of time away from the computer... and changed the system font size settings up to 125% when I got back to it. If that eye gives too much trouble, I'm going to buy a bunch of eye-patches and keep on doing what I do at a hit to my depth-perception.
Another detriment to my productivity has been the addition by my brother of several hundred gigabytes of anime to my HDD. This is including the entire Naruto Shippuden series, the entire One Piece series... Yu-Gi-Oh, Gundam SEED (And Destiny), Hack.//Sign... I stopped them at the Bleach series.
There are a couple of newer ones I've been taking a look at too. Zero no Tsukaima (Familiar of Zero), No Game No Life, Black Butler...
And these are all a huge waste of time. So I started an attempt at multitasking yesterday: Play the anime on left-hand monitor, do work on the right hand monitor. Worked well enough (Coded the model loader, for instance).
Well that's enough of that. I'm going to go get some more work done, ponder career choices, and figure out how I'm going to afford new glasses.
Progress, I guess... Posted on June 19, 2014 at 08:20
So I kinda did something with my engine for the Completition... but it's not something easily visible: Just structural changes and a slight tweak to lighting.
Yes, I've been lazy as heck. Haven't done any major programming in the last three weeks.
I've got a plan though. Probably not going to end up with a major game by the end of this, but I'll have something. Something more than I had before, anyway :P
Exile Engine Plans (Mostly Technical, skip if easily bored) (Show)
Most of my work has involved rebasing the engine to make full use of the modern OpenGL system. At the moment, everything is an unholy mess of fixed-function and shader programming. Things like the HUD and HWEPS are all being drawn with the fixed-function pipeline, while all level geometry is using the shaders I wrote.
Speaking of shaders...
During the last comp, where I was starting to work on Exile 2.0, I created an interesting shader I call a "color limiter". Basically, I clamp the input RGBA values at intervals of whatever I want. So I can simulate a 256 color palette quite easily.
Why bother? Well originally I wanted my game to have the look of Hexen, or Duke3D, without having to artificially limit my artwork, or keep my textures at 16x16/32x32.
There was an unintended side-effect as well, that makes the textures look like they have depth: As you move around, the shadows play over the features of the texture, making it appear to be more three-dimensional than they are.
The best demonstration I have of this effect is one of my first screenshots with the shader enabled:
Take a close look at the wall (Floor lighting was derped in that version of the shader. Wasn't calculating Y distance, so it was flat-looking).
Here's the same texture used in an older (And far darker) version of the engine:
Anyway, back to the limiter shader... here's a comparison. No limiter:
And the same shot but with the limiter enabled, clamping each texture to a simple 256-color palette:
So... back to the to-do list. I have a ton of stuff I want to add to the engine. Mostly scripting related.
Currently, I'm using LUA and SLB for some basic scripting, but I'm finding it to be overkill for my purposes. In place of this, I've designed a simple and effective Low Level Language that gets translated into a simple bytecode, can fully utilize the engine's tasking system, and can easily communicate with other sections of bytecode.
The way I'm dealing with this is by linking all scripts in memory during game load, and providing a global symbol table to them all, as well as API symbols.
Game objects can utilize the Script class to execute scripts; multiple scripts at once if necessary. I'm not using traditional multi-threading for this; as per usual, I'm utilizing what I learned of OS task management to create a self-managed system.
This way, I don't have to worry about resource locks for scripts, and can save a bit of development time.
On a completely different side of the code, I have a prototype in place for my netcode. What I'm trying (And it may not work), is to use a channel based system. So there are, say, 65535 channels available. Each time the game receives a network message, it stores it in the channel it's intended for; GameObjects can interface with the channels and update based on information received on their own channel.
And then finally, models. I'm adding in basic model support to the game again. I'm aiming to specifically support both a static model format and an animated model format; I'm leaning toward OBJ models for the first, and MD3 models for the latter.
Well, I've run out of stuff to talk about for now.
So what have I been doing, besides not programming?
Gaming. A lot of gaming.
To be specific, I've started practicing with speedruns of a few of my favorite games. That happened after I watched a lot of these videos:
And then I got my hands on LiveSplit. My current time for Megaman X is 56:37, Megaman 7 is 1:10:21, and a bunch of unfinished runs that I'm working on.
And then there's Dark Souls. The multiplayer has been busy. Messages everywhere, bloodstains everywhere, a veritable army of summons available, invasions galore... It's been a load of fun :P
On a new character the other day, I saw a summon sign at the entrance to Lower Undead Burg. I've been having a really good time with summoning/invading; no connection issues whatsoever, for some reason.
So I decided to summon this guy. Let me tell you this: I didn't even get a chance to wave. He just sprinted down the stairs and the next thing I'm hearing the sounds of carnage. Literally took us all of three minutes to get from the entrance to solidly beating Capra Demon on the first try.
I also stuck around a bit and left my summon sign in front of Capra's fog gate; I'm part of the Warriors of Sunlight covenant, so I tend to get summoned pretty quickly.
I've never enjoyed a game so much, for so long :P
'cept maybe some of the classic NES games I keep on going back to. And Minecraft.
Well, my hands are freezing over. Time to grab a hot cup of tea/coffee and do something with my time...
Minecraft Shenanigans Posted on May 25, 2014 at 15:05
I've been playing around with the Minecraft 1.8 pre-releases for a few weeks now, and have started messing around with an adventure map. Using a redstone clock, some command blocks, and a few commands, I came up with this:
Sound derped up, but it's not the point. :P
This works using the /scoreboard, /testfor and /title commands. It displays the title card only to the player entering the zone, doesn't display it again until you switch to another zone, and is really simple to set up.
There are two command blocks attached to the RS clock. They both contain a variant of the following command:
/scoreboard players set @a[<zone coordinates>]
/title @a[<zone coordinates>] title "Title"
/title @a[<zone coordinates>] subtitle "Subtitle"
Quite a bit of setup work involved (You have to manually enter zone coordinates. ~ doesn't seem to work with @ selectors), but it's an interesting effect. And with a few mods, it could become very easy to do.
Oh, and some Dark Souls shenanigans...
I'm occasionally doing PVP in Anor Londo. Mostly baiting invasions (There are a ton of Blue Phantoms recently), and earning a ton of souls doing it.
I'm using DSCFix, so if anybody with the game wants to add me to their GFWL friends list so they have a much higher chance of bumping into me, my name is Megaura. For now, anyway. GFWL is dying soon :P
Speaking of that, From Software and Namco Bandai have confirmed that they aren't going to let Dark Soul's multiplayer side die.
Oh, and the game is currently 66% off, at $6.79. So get it if you haven't got it, so we can engage in jolly cooperation! :P
Post-comp burnout and some plans Posted on May 09, 2014 at 13:38
Burnout is something I suffer from very often after competing in a competition of any sort. The whole of last month is just a jumble of memories in my mind, centered around the three games I was working on, late nights spent hunting silly bugs, and later nights spent working on artwork.
I'm glad with what I eventually made; it's the first time I've worked with 3D in this way, and also the first game I've created with Unity. It was an interesting process of learning, and relearning a few things I forgot about C#.
Originally, I was planning on silently dropping out; I was feeling pretty down with the work I had to do to pull either Exile 2 or the other game I had into the 'playable demo' phase, so I opted to just do "whatever I felt like" until something happened.
And a few nights after that thought, I sat down in a bored manner and decided to model a spaceship. It turned out far better than I anticipated, and I naturally decided to run with what I managed to make. And I'd say it turned out fairly well.
I will say that I'm still deciding whether or not to continue working on Project Phoenix in Unity. For starters, it relies heavily on image effects that I can't use in the free version, so if I don't manage to win/loot/buy a copy of the Pro license, the game will look very different.
In that case, I'd probably see to porting it to a custom C++ engine; writing a Bloom and Motion Blur shader is elementary. The hardest part of the 'port' would be choosing a good model format and writing a loader for it.
Either way, at this juncture I am creating a new from-scratch engine. Or at least, designing one. That's always been a fascinating process to me, and I've been spending a few days studying the Doom, Doom 3 and Vanilla Doom source; Carmack's code is particularly interesting.
And a more detailed view of the internals (This guy has reviewed most of the source id has produced, as well as the Build engine, and picks apart how these engines got around to doing what they did. Fascinating reads if that's your kinda thing). http://fabiensanglard.net/doom3/
Anyway, I'm going to be looking into a more data driven model for my new engine. I want all game logic to be handled in an external manner. Either by runtime scripts, precompiled scripts, or just by 'hooking' the game engine into the game logic via a DLL (Which is what the idTech4 does).
I'm not actually designing this with a specific game in mind; I'm just making this because I enjoy programming tasks like this immensely.
Well, I'll leave you with that. Now to kill time until the competition winners are announced!
Mega's Competition Dev Log #6 Posted on April 24, 2014 at 17:07
We're now into the last quarter of the competition. 6 days left; this is officially crunch time.
Did quite a few things during the past four days, as I showed in the comments of my last blog. What I didn't do was talk about it much. So here we go.
First off, a screenshot or two:
Me dicking around with Sun Shafts:
And dicking around with Bloom settings:
Going to make things like Bloom optional. Motion blur was going to be optional, but due to some changes, it's not really effective any more.
Switch from Level orientated to Player orientated
My original concept that I threw together had two 'segments' of the level, or 'road', as I'm calling it. These were pretty long (Stretching well beyond the 'back' of the view frustum). When the player hit the join between the two segments, he would be flung back to the starting point , seamlessly (More or less).
This 'works', but was shortsighted of me. Figured this out when I added projectiles. Now I had to either make every moving object jump back if it hit the boundary, or figure out a new way of doing things.
I decided on the latter; generally if you're doing too much work you're doing things wrong.
The system I decided to use is very common in 'endless' games. In this system, the player doesn't move. The level does.
So in my game, the level segments are moving towards the camera at the the same velocity the player should be moving. When it's out of the camera bounds completely, it jumps up to behind the segment behind it.
This is, in fact, a much more seamless transition, and is also going to make handling my AI code a lot easier down the line.
Modeling an Enemy
Spent some time today working on an enemy model. I've been getting far more comfortable with Blender, and the creation of exactly what I have envisioned in my mind. Mechanical and inorganic objects are easier to work with; add a couple of hours overhead to anything vaguely humanoid. :P
I posted a timelapse video on my last blog, but I'll repost it here:
Had a bit of trouble with my normals; I think I accidentally hit Laplacian Smooth at some point during my tweaking of the model, and that did something to the faces I had selected.
I still have a few more enemies to model (Though I'm only aiming to complete one more before the comp deadline), and a huge boss that I have planned.
Anyway, that's enough out of me. Have a GIF/Video of the progress so far:
Mega's Competition Dev Log #5 Posted on April 20, 2014 at 14:15
Yesterday, I was looking at the other dev logs. Some really high quality work you're doing guys. Really high quality.
Made me feel a bit down, actually.
So I stopped giving a damn; I'm not aiming to place well, or finish a game. At this point, I'm just aiming to make something and have fun doing it; so I'm doing whatever I feel like. At this point, I feel like remaking something of mine into a high-speed 3D game.
At this rate I'll either have a small demo of my platformer, or a demo of this out by the end of the month, but it's fine by me; I don't have that much time on my hands anyway.
Anyway... Screenshots. Lots of them.
The game has the probably temporary name of "Project Phoenix", based on my old game Tunnel Space. In that game, the player controlled a ship that was moving along an endless stage with various obstacles moving down the top of the screen; you had to dodge these, and the game got progressively faster.
My original vision for it was that the game was about a 'space bridge', essentially a huge tower with magnetic rails that specially designed ships could use as a launch guide.
I'm having this take place on the ground at first. I want a huge tower to be looming in the distance, and once you reach it you'll ramp up onto its surface and progress to the next part of the game. Eventually, you reach space. From here, I have a plan for a boss battle.
On the way, enemies and obstacles will spawn, and you can dodge/shoot them.
I'm working in Unity, and so far the process has been easy. The modeling has, likewise, been easy; I've had enough practice with Blender that I can get around pretty quickly.
Made the ship model in about an hour, drew the texture in a couple of minutes, generated a normal map from that and used Projection Painting to map the texture to the geometry. All told, about 2 hours total work, perhaps, for what is basically the highest level model I need to create (Especially considering that you'll be staring at the back of the ship for some time).
Also, it just suddenly hit me how easy this all is. I already have a ship racing at breakneck speeds through a canyon.
Dark Souls stuff
This, basically. Was having a bit of trouble with Ornstein and Smough; reached them on my offline profile first, and had no humanity. So I couldn't summon Solaire. Nor could I defeat that prick Lautrec at first.
So I ran back to Firelink Shrine and started exploring areas I was having trouble with before.
In summary, I destroyed the Hydra, and then Havel. Likewise with the Dragon on the bridge in Undead Burg.
Went back to Anor Londo and basically ran up to Lautrec and introduced his back to a Crystal Halberd a couple of times.
Then, I summoned Solaire and fought Ornstein and Smough again. Solaire actually survived until about halfway through the second phase of the fight, which is a far cry from the battle with the Gaping Dragon (He lasted all of ten seconds there).
Took out Ornstein first, then danced with Smough for about ten minutes (I was being extra careful).
So yeah, I did it. That was the most satisfying victory I've had so far.