Tuesday, February 26, 2019

Tree billboards

In gaming graphics, a billboard is a type of 2D image that always faces the camera. I found some high-quality free images of trees at CGBookcase.com, and created several billboards of trees to fill in the edge of the world map. They are only visible looking out of the 3rd floor windows of the school, so it is hardly noticeable that they are rendered at a low resolution, or are rotating to face the camera. There is also enough variety that, from a distance, it is not apparent that there are only 4 types of trees. 


Oh Hi, 2D sprites!
I also used a set of textures (https://cgbookcase.com/textures/polished-concrete-01) from the same website to replace the basement floor material. It now looks more like how it should. 





Wednesday, February 20, 2019

Blackboard and bicycle props, and stair details


I spent some time making props that will be seen in the next version of the flythrough. First was a free-standing blackboard based off a blackboard I saw at a local church.

Reference photo of a blackboard in the basement of the Wesley Foundation
Same blackboard modeled in Blender and imported into UE4
Bicycles for the bike rack, using Epic's Automotive Materials pack:



Finally, I completed the tedious task of adding marble trim, green paint (decals), and treads to the stairs (this took most of President's Day). The tedium came from my use of BSP brushes, which are old fashioned and very slow, but allowed more flexibility with sizing and textures. Because the level is so big, each time a BSP brush is moved even slightly, the editor stalls for several seconds. 






Monday, February 11, 2019

MIDI keyboard animation demo

I've been playing around with UE4's possibilities for triggering events using MIDI (a language for communication between electronic musical instruments). At first, I thought there might be a Blender plugin for this, but the Python script I found online doesn't seem to work correctly in the latest version of Blender. 
Instead, I'm using the "Procedural MIDI" plugin by Scott Bishel available on the Unreal Marketplace, and a piano model I purchased several months ago. The keyboard that came with that piano had the keys fused together, so I had to separate them first in Blender, then import them into UE4, each with unique names for each key. The Procedural MIDI plugin allows the data from the MIDI file to be accessed by Blueprints, which in this case changes the position of one of the 88 keys. Several hours later, and after coding an extremely laborious Blueprint, I have this video:


Here is the basic Blueprint to run the key movements:


The first half essentially opens the MIDI file, and plays it. The second half siphons off the MIDI data as it is played, and assigns the note data to a single variable. A function in the middle (see below) translates that number to a specific key on the keyboard, then whenever the MIDI file triggers a "note on" event, the key referenced by the Receive Note Name function is rotated by -3°; a subsequent "note off" event returns it to 0°. Here is that function (the "Are we there yet?" function), which goes through every note on the keyboard, and confirms if it is the one that should be moved or not:


And this is as much as could fit on the screen at once:


Believe it or not, this works because MIDI data is sequential, meaning no two notes actually play at the same time. The human ear perceives separate MIDI events as chords because it happens very fast!

Tuesday, February 5, 2019

Classroom props and game coding

Working on the to-do list this past week meant creating some props in classrooms and re-doing some earlier models. Also, I tried to fix some bugs in my coding, which was only partially successful. 

Classroom desks, modeled after photos from the Rosemary and a vintage desk online:

A classroom full of desks, modeled by me in Blender
 
Classroom desks as seen in the Rosemary

Similar model of a vintage desk from an online auction site
The vents on the face of the stage apron: 
This photo from the 1923 Rosemary is the one I used to reference the wood wainscot, and more recently the vents
Finally, I spent many hours pouring over my code for two items: Gamepad functionality and the guided tour that unlocks when the player puts out the fire in the coal bunkers. While the guided tour will need additional work, I finally got the instructions for a Gamepad to appear on screen appropriately: 


I noticed in numerous games that if the mouse is used, on-screen instructions and icons show keyboard/mouse icons, but if the Gamepad is used, the same instructions switch to Xbox 360 icons. Unreal has limited Gamepad support, so all the coding has to be done manually to support a Gamepad throughout the engine, especially on menus. I finally made it so that the correct icons display at the beginning of the game, and in several of the menus. This may seem like a small victory, but it was very exciting when it actually worked! 

Additionally, I allowed both the left Gamepad trigger or the mouse wheel to zoom the field of view from 90 degrees to 30 degrees. This, of course, resulted in lots of fun zooming in on things!