Thursday, March 22, 2018

GDC Day 3

I'm dead again

If I don't lose 10 pounds by the time this is done I will be shocked! Meeting lots of people. Went to an awesome marketing seminar and I'm starting to get my web presence known. Coming back to the hotel after a day of GDC-ing I am asleep as soon as I hit the pillow. I'm getting ready to go out again. I think I have the subway system figured out now.

It rains an awful lot here.  

Wednesday, March 21, 2018

GDC Day 2

I'm writing this the morning after because I literally died last night when I got back to my hotel room. Somehow I was resurrected this morning by my legs feel like noodles. It's a strange environment here. You just walk to up to interesting people and say hello. You chat for a bit, throw out your pitch and have a conversation. I have talked about game narrative, styles, publishing, business, and lots of others just in random. I even pulled an old prototype game from years ago to show to some interested Japanese and swapped cards.

There are vary famous people here. Amusingly, during the GDC 101 talk I attended we were warned to kind of stay "at our level", nothing wrong with striking up a conversation with Mr. Video Game Superstar, but there won't be much that guy can do for you.

I have a video demos of what I have for ROE done on my phone read to go at a moment's notice and people have been interested and have given me great feedback. It's also been fun looking at the reactions from C++ programmers about the thing I've had to do to pull 20 year old code kicking and screaming onto new platforms.

Today the expo proper opens so we will see what goes on there... If you are coming here from the link on my business card. Hello! My whole adventure is here for you to read. Thanks for coming!


Monday, March 19, 2018

GDC Day 1

I'm exhausted.

Flying is fun!
I kind of misjudged days and spent my first day of GDC just getting out here. I'll be getting my badge at 7:00 tomorrow and start making the rounds. I have a few missions, most having to do with the marketing side of ROE. I'm going to hunt down a few publishers just to say hello, and chat up companies that do what I do, namely port legacy programs to new platforms.

I'm flying back business class though!

Friday, March 16, 2018

Into the Breach

Broke though the sound problem and now super productive again! Go me! I was battling an issue where the game would only play two sounds and refused to play the rest. For the last two days I could not get the sound to work at all. That was two days of going though the documentation and everything. I even got in contact with the library developer and sent him sample code and he didn't see why it wasn't working either... Do you want to know what the problem was?

smpl_hits = al_load_sample("res\hits.ogg"); //<---- was not working
smpl_hits = al_load_sample("res/hits.ogg"); //<---- working

Yup I had backslashes in my path. This was even a dumber mistake because here I am trying to abstract the filesystem away, only to use relative resource paths on the filesystem. After I found that I immediately removed all folder references and used Allegro's path system instead. I am now almost done with the filesystem stuff, but came across the functions dealing with loading Breach 2 data. I now had a choice. I could disable it for now or implement it in case I have an opportunity to port Breach 2. I didn't have any samples of the files I needed, so I started to comment out the functions. I then realized this was breaking the whole reason why I'm keeping binary compatibility. I guess if I'm going to make the game feature complete for the beta, I need to  have the Breach 2 stuff functional as well.

I procured myself a copy of Breach 2.

Old School DRM
When I opened it, I was hit with a screen asking me to look up page 27, line 2, word 1 of the instruction manual. It took a bit but I was able to procure the manual too. I then went into Breach and created the files I will need for ROE to work. Added that a new TODO in Trello. Now going to see if I can't get these guys to link together.

Game is still going forward!






Sound Test Below....

Wednesday, March 14, 2018

More Prep Work

Successful repo download and compile
So today I didn't spend a lot of time in Visual Studio. I did update the repo with build instructions. Most of today was spent nursing a sick laptop to what I was hoping was better health. Also it was my first time really exorcising Git to make sure I could check in and check out thing correctly. After fixing my commits that was all smooth too.

Sadly the laptop has seen better days. The charging circuits don't work and it has a dodgy power connector. I'll probably just take the chromebook make some presentations using pictures and video from the blog here. I can always RDP from the chomebook back home if I need to get some work done. So that means was mostly marketing research. I spend time online chatting with others who are going to be going to GDC and arranging meet-ups. I'm also fleshing out a schedule of what to do while I'm there.

Other than that, nothing special. Oh, the sound mixer in Allegro has a bug in it and one of the library  developers are looking into it. I sent him example code and he confirmed that it's acting bizarre. That the thing about when you use computer systems daily for hours. Even with commercial systems, sooner or later you will find a bug.

Tuesday, March 13, 2018

Going to GDC - and other things

So on Monday I'll be in San Francisco for GDC. That's going to be fun. I spent all day today prepping for it. One of my tasks was bringing my travel laptop back from the dead. It hasn't fared well. The last time it was fired up was when I was in Japan last year. I've been spending most of my day getting things updated and moved around.

I bit the bullet and got a GitHub account and uploaded ROE to it so I could work remotely. Also, my online backup is expiring next month so it was better to get a copy of my work somewhere safe. I'll be switching backup providers as well. I worked in I.T. far too long to see what happens when you don't back up your stuff. Heck, even the provider I have now saved my skin when a HDD blew out. The provider I have now is moving to company-only solutions and exiting the home market.

 I need to still get VS2015 on this machine and get a sync going as well. This means getting Allegro set up and a copy of ROE compiled. I also think my power plug may be dodgy. I'll investigate that too. I'm hoping I don't need a new laptop. If worse comes to worst I'll set up remote desktop and use my chromebook.

Game-wise all the sound effects are complete, but the implementation is acting up. When I monkey with the sounds, I'm losing my audio subsystem all together. May be an allegro bug, but I can use another lib if push comes to shove. It would be a bummer to add a dependency after working so hard kicking lots of the legacy stuff out.

Came across a new development word today; "Darkwork". It's a term for when you code something and the result was no different visually then before. It was used by a coder who was making his own engine and was describing when he was coding up the infrastructure. Meaning he had to do a lot of Darkwork before he had anything even functional towards an engine. I've had Darkwork days too, but as I move to Ugly Beta, there will be a considerable amount of prettiness coming up. I should be thinking about what the new theme is going to look like. I have some ideas, but will need some time in Inkscape/Gimp to see what I can achieve.

Monday, March 12, 2018

Fwreep Fweep Fweep!

So I spent most of today in Audacity working with hundreds of public domain sounds. It was time to implement  the sound effects in the game and that meant getting rid of the old Star Trek effects. This required the playback of many many audio files to see if I could find anything close to what I was imagining in my head. You also have to make sure you use the right search terms. You can't just look for "Door Schloop noise" and find anything useful.The last bit is also making sure what you have is in the public domain. I would be dumb to replace a sound effect you don't have rights to with another you equally don't have rights too. I'll probably have the effects loader and player all done by tomorrow.


I also had a crack at printing TTF fonts on their side and was able to get some matrix transforms working. I can print downwards, but upwards uses the original function to make sure one of the return values are calculated correctly.

I should be getting rid of the rest of the non-Allegro filesystem commands. One requires a filepicker and I'm wondering if I should just use the OS's one via the Allegro hook. I'll see how it looks.

On a closing note, Trello is pretty rad and have been great for me to track what I'm doing and what needs to be done. I was told by some of my indie peers that it's great for small stuff, but does not scale at all. I'll see when I start to roll other people into it.


Saturday, March 10, 2018

TTF fonts work for the most part

Working the weekend. I think this is the quickest I've ever implemented something from beginning to end. The implementation on the code was pretty quick. The hardest thing was getting the TTF to exactly match the same spacing as the original bitmap font. Now that that's in place, the text routines are all super fast. This also means I can replace the font very quickly if another comes along. I'm still having issue with an aux Gprint() functions and need to write two that print sideways.

For my next trick I'll be adding the config button, but I also have been looking at using a pixel shader to replace ColorMask(). Right now I'm working with each pixel with an honest-to-goodness loop and can probably optimize it better too.

Let see... command import, sound effects, and I still to figure out a final "look" for the updated GUI.  Lots of thing to get done before I'm anywhere calling anything a beta.


Friday, March 9, 2018

Wow, It's 10:00 AM!

Back in the foundry again!
So last night after posting my blog post I decided to check to see how feasible it was to replace the fonts for ROE. I was just going to see how the letters looked and if a public domain font I had was close enough.

I just spent the last 14 hours making the new font and now it's ready to be implemented in the game.

I honestly didn't know what time it was until I looked over my shoulder and saw sunlight spill into my apartment. It just few by so fast. I took a quick screenshot of the finished font and played with it a little. The last font I made too three days, so I guess I'm getting faster at it.

I'm trying to exactly match the spacing of the font used in the game. The whole reason why switching from a bitmap to a TrueType font is because the game's text editor is horrifically slow, and this should speed it up. Also I get the added benefit of scaling if I decide to go that route. When I get back to Visual C, I'll try a replacement Gprint() and see what happens. If anything it will look nicer than that I currently got.

Also also - need to get enemies to the artist... That needs to be done too! In fact, I'll Trello that before I go to bed.

(Note: This was supposed to be posted at 10:00 this morning, but I saved it as a draft on accident)

Thursday, March 8, 2018

Now for the details.

So I was able to sleuth out where the enemy render code was for the game. Updated it and now the little dudes are colored like they are supposed to be. For fun I also decided to add the compile-time switch for a demo executable and that compiled first time through. The game is, shockingly, not crashing which is kind of worrying me :)

I spend an hour hunting down sound effects for the game that need to be implemented. Once upon a time I wrote down a table of what sounds I needed and where they were. I even posted it on this blog. Turns out, I deleted it after I was done. That was dumb.

Also today I cracked open fontforge to look at creating a font that will be replacing the bitmap font used in gprint(). I think I can have that done over the weekend. Also looking into getting that "Options" button added.  Originally the game was configured with a setup program. That is no longer needed but I will probably be looking into an installer package.

My goal is to have a Beta by the end of the month.



Wednesday, March 7, 2018

And so my Space Career Begins...

Comms work now.
I was able to (hopefully) peg down that last null pointer, and was able to play the game. For some reason, my mouse would die when I went to either the navigation or tactical screens. These are the "busiest" screens that are using my very ugly color hacks. The game was running at a blazing 2 FPS. I'm actually impressed that it was going that fast. The mouse clicks, however, were being delayed by anywhere between 10 and 45 seconds. The strange thing was the keyboard queue was fine, so there was something up with my mouse queue.

Enemies are not rendered right.
After digging a but I discovered that my mouse event queue was storing hundreds of mouse movement events, and not just the mouse clicks. The means that the game grabbing a single unneeded mouse movement event every frame and throwing it away, only to grab another the next frame. If you didn't touch the mouse It would eventually "catch up" and grab that click. I updated my event handler to simply delete all accumulated mouse movement events in the queue until it comes across a click or until the queue is empty. The game is supposed to check for a click first and then asks the OS where the mouse pointer actually is on the screen. Mouse movement is handled by the OS. This also allows for a touch interface. When you tap the screen, your finger X and Y location is read after that.

The good news is that I was able to create a new fleet commander, assign him to a mission, and then run though the whole game and win. The game, for the first time, ran end-to-end! This doesn't mean the game isn't without bugs. I still have to set up my alpha channels for transparencies right, but that's cosmetic. I'm also getting closer to changing the game font to a TrueType font to speed up rendering.  My biggest hurdle right now is figuring out how to render the enemies in game. It's not using my render routines I made for the builders. Once I have that nailed down, it will be time to start adding some functionality such as the "options" button and sound effects. I hope to have an "Ugly Beta" by the end of the month. The Ugly beta is a beta version of the game with the legacy graphics and before an art pass.  I have yet to run the game "outside" of Visual Studio stand alone.  I just added that as a Trello goal.

Oh and I have to get the builder off the the artist :)


I FINISHED A MISSION!


Tuesday, March 6, 2018

Pew Pew!

PEW! (Transparency isn't set up quite yet)
Guns work, but there are still underlying issues. Computer systems nowadays are extremely  intolerant of dereferenced null pointers. It actually threw me for a loop too. It's was another issue where DOS was very forgiving, but Windows was not having any of it. The whole issue came down to what NULL used to be, and what it is now.

In the olden days before memory protection, when you set a pointer to NULL, it was largely up to the compiler to implement what that meant. Sometimes the compiler would just set the pointer address to 0 and some would even be nice enough to dereference the value of a null pointer to 0. (A useful example given to me was when you wanted to dereference a null string.) Suffice to say, ROE makes an assumption that the compiler is "nice" and dereferenceing null will give you something. Here's is an example I'm coming acorss.

MissPtr m;           //m is a pointer to a missile object
m = Game->missiles;  //Game->missiles = NULL at this point in the game
 
//Memory is allocated for a new Missile object
Game->missiles = (MissPtr)malloc((int)sizeof(struct MissStru));
 
//The old Missile object is linked back (In this case NULL) 
Game->missiles->link = m;
 
m->prev = Game->missiles;  //CRASH! m is NULL and member is invalid.
 
I can see how that can be valid on old systems. The compiler is assuming that if the object is NULL then all the other members of that object are also NULL. On newer systems, the act of asking for m->prev is the same as asking "Hey can you look at this obviously invalid address and and give me a data value that in that area?"

The OS will take away your program counter, kill the program, and tell you to think about what you just did. You are not getting data from unknown parts of memory. That's the whole point of protected mode.

I have a feeling there are lots of these in the main code. I ran into one just running the game for fifteen minutes. I have a Trello card now for this so I'll be looking for it.



Monday, March 5, 2018

It Runs as Long as You Don't Pick Up the Phone.

Matching loading/saving of each member
What a fun day. I can consistently load saved games and start the few missions I can throw at it. I tooled around a solar system for a bit and then went back into Visual Studio to write the code to save the game. (I was using saves I generated in DOSBox from the original version.) This required me to go though about 600 lines and make sure all the data members I was loading was being saved in the same order with the same type. Once again again I was hit by off-by-one errors. I have to match the bit width of the read, write, and the original struct data member. I'm sure I have a few misalignments still.

Loading the first mission. HD Stars!
I was able to make a new fleet commander, add him to a mission and then start the mission. This means almost all the functionality on the "101" main screen is done and I have to start working the bugs in the game proper. The big one is when I try and send a communication to another ship and ask for an acknowledgment, the game bombs out with a null pointer. Same thing happens when I fire my weapons. This is happening with the saves from the both the DOS version, and ones I make myself. Also new games do it too so it doesn't seem to be a data load issue. I'm guessing that computers deal with null pointers differently nowadays and causing issues. In the 90s, nulling a pointer just set it to top of memory. I think in newer systems it's simply invalidated because moving a pointer outside protected memory will cause an exception fault.

Once I get things stable I will be making that enemy builder for the artist. I'm still eyeballing the new TTF system font too. Some of the lag is coming from rendering text. I want to move off of the legacy color stuff but I would like to have a stable platform first before I rip out another core Nermal function.

Shields up, and target acquired.
I can see ships now. This means I'll have to fire up Blender and remodel them in HD like I did the puzzle pieces. The good news is there are graphics that show the ships in different angles so I'll be using that as a template.  There are also a few icons that look a little USS Enterprise-ish I have to change too.

There is a lot of commented out and #ifdef'd debug code for comms, looks like it was a pain to implement when it was being developed. I've left the debug flags in the game, but been too scared to turn them on I'll chase down the null pointers first and if people still refuse to chat with each other I may have to get that old cranky code working too.




Saturday, March 3, 2018

It Loads!

Tactical
I pulled and all-nighter. I do not recommended to do this on a Friday night. It's going to botch up my Sunday schedule, but I'll take that as a fair punishment. The game loaded it's first save file and I was able to get int the game proper. The loader is way broken and was hard-coded in parts to load a particular file. I do have the data blocks properly delineated so I just have to correct about 10 off-by-one errors. There are still curious number of sections I'm skipping, but most appear to be linked list pointers that were saved when the whole struct blob was written to disk. This data is really not needed because when the game loads the data, it rebuilds the linked lists anyway. I've been using these "blank" spots to check for hard drive errors during load. The good news is I can actually shim in data in these areas and keep things compatible.

So, now I'm in the game, How does it run?

Ship Status
Like pure unoptimized garbage. I expected this though. I'm using debug libs and I have nowhere near touched surface locking. To give you an idea of how things are, I'm running an 3.4Ghz i7-6700 with 16GB of ram. ROE is taking up 31% of my CPU resources when running. I'm pretty sure two of my 8 cores were at 100%. I could actually hear the cooling fans spin up. when it starts to run. The game is crutching on my gross and hacky legacy color management routines. This makes some of the screens take upwardly of 15 seconds to render.

Comms
The good news is I'm in, and I was able to tool around. I can't save the game quite yet, the clock is broken, and commands hang, but it didn't crash. Truth be told I didn't really push it too much. It was more a quick turn of the key to make sure everything at least functions.

I'm going to go to bed now, Later on this afternoon when I get up, I'm going to break up the game loader into different parts to better separate the data sections. The game already does this with solar system entities. With it all broken up I can then optimize and map each section properly. I would like to identify what I'm skipping over. I'm almost sure what they are so I'm not missing anything scary.

When the load map is complete, it will be easy to map that to the save function. I do have a tiny degree of leeway as, as I said above, I don't have to save pointers. I'll probably stuff in some data as a place holder so I can see it's nothing. ...maybe "DEC0DE" in hex. I feel so much better being productive again. I'm about 80% done with the filesystem purge now.



Fleets are loading! Timer's busted though.


Friday, March 2, 2018

So I'm Geordi La Forge apparently.


 I have learned a few things today :)

First thing... FwfStru and FwgStu are two different structures that have similar, but different members and are considerably different lengths. One holds fleet data as it pertains to the ships, and and the other holds fleet data as it pertains to the game. This wouldn't be bad, but the first 21 or so members have the same name and similar arrangement. One is declared as FwfPtr and the other FwsPtr.

When you are manually loading data from disk in byte order, make sure you are stuffing the data into the right object. least your data goes all over the place. I wasn't.

Well, at least it aligns now :)
I have gotten  to load lots of data now and I'm in the process of backing out and writing the loader with the proper object. I had to switch to a 9k save as opposed to a 6K one, but I can now see/mark out the data boundaries much better. I still have 39 bytes unaccounted for, but I can bump the read pointer up to the next block of known data. I was also missing some data members that I am filling in. (I didn't copy from the struct right). I was also originally using the "fleet load" code from mission builder. Turns out, that used a similar, but different stuct for fleets. The solar system data was fine, but I missed the letter change for the fleet data.

When using a function from another part of your code to do the same thing, it might behoove you to think why that code was sequestered off to another part of the application in the first place.

While working the the ship data, I honestly felt like Geordi La Forge on a task from Captain Picard.

"Geordi, why don't we have telemery data?"
"Sorry Captain, it seem to be corrupted due to isometric misalignment. I have temporally bypassed telemetry, and can get some of tactical, minus the photon torpedo inventory. The Misalignment is occurring again at personnel"
"Ok, keep me informed Geordi"

 I kid you not that is where I am right now. I'm back up to 100% and I'll be working though the weekend to make up for lost time.

My online backup provider went offline today. I had to get that fixed up too. I should be pushing my code off to an external git server, but the free ones are only for open source. I'll be shopping for that too.

Thursday, March 1, 2018

Digging through the game

I don't think that's the captain's real name :/ (I'm off by about 190 bytes)
So yesterday I went MIA to help retrieve family members for an airport. While coming back my motivation was hampered because I can't seem to get a block of data loaded correctly. The problem I'm coming across is I have a struct with member that points to the struct. (Meaning it's circular). It's not a linked list. It appears to be just a pointer, but I'm getting all kinds of byte alignment issues manually unrolling it. It's getting super frustrating to see the wrong data being read from the wrong part of the file It wouldn't be so bad, but this file is 6K and some of the data inside has variable lengths, such as the planet data or the captain's dossiers. After my airport jaunt I didn't feel like pushing bytes around and today I got up late and felt like it even less. I gave it a shot, made my structs even worse,  I basically spend the day reorganizing my Japanese Magic: The Gathering collection from 1994.

Today was a bad day. I feel terrible I haven't been making any progress and it's creating a feedback loop of motivation. However after leaving my blog for two days, I had an uptick of people looking in on it. I guess looking for a post that didn't come.

I'm here. It's going.

This is a thing that needs to get fixed. I'm solving two problems at once. I feel the is really the final hurdle of core functionality before I go on to making things pretty and stable. (Not necessarily in that order)

I'm also thinking of extending the demo system to add commentary bubbles to give it a tutorial feel. Maybe. For now I'll concentrate more on trying not to load names from the missile inventory data.
Counting bytes and aligning them to the structs. I have 6K of this...