Thứ Tư, 15 tháng 1, 2014

Biggest LUA Script Yet

Work

Not much time to blog (or eat it seems), but I managed to finish more of the LUA script engine so it's clean underneath, no longer crashes on repeat runs, can handle health, ammo, weapons, zones and now sounds, keys and doors. Of course plenty more scripts required, but we're making fast progress. Here is the largest of the scripts right now, which controls the whole logic of a chainlink fence gate which can be locked, unlocked, opened and closed, complete with user prompts and even it's own global variable.

-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Door Prompts 'Closed' can be opened with entity collected specified by 'USE KEY' 

-- state to ensure user must release E key before can open/close again
door_pressed = 0
 
function door_main(e)
 PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
 PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
 PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
 PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
 if PlayerDist < 100 then
  if g_Entity[e]['activated'] == 0 then
   if g_Entity[e]['haskey'] == 1 then 
    Prompt("The door is locked. Press E key to unlock door");
    if g_KeyPressE == 1 then 
 g_Entity[e]['activated'] = 1;
    end
   else
    Prompt("The door is locked. Find a key to unlock door");
   end
  else
   if g_Entity[e]['activated'] == 1 then
    -- door is unlocked and closed
  Prompt("Press E to open door");
    if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then 
SetAnimation(0);
PlayAnimation(e);
g_Entity[e]['animating'] = 1;
g_Entity[e]['activated'] = 2;
     PlaySound0(e);
CollisionOff(e);
door_pressed = 1;
end
   else
    if g_Entity[e]['activated'] == 2 then
-- door is open
  if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
   SetAnimation(1);
 PlayAnimation(e);
   g_Entity[e]['animating'] = 1;
   g_Entity[e]['activated'] = 1;
      PlaySound1(e);
      CollisionOn(e);
 door_pressed = 1;
end
end
   end
  end
 end
 if g_KeyPressE == 0 then 
  door_pressed = 0;
 end
end

I am knocking up a quick internal version now and then calling it a night. Have a meeting tomorrow to show the latest development progress and decide what the tweak work should be on Friday before a release for later that night. I have added quite a bit of stuff to this one, so I would have liked to do more testing, but I am sure you want to get your hands on this one as soon as.  

There should be enough meat on the script system for you to start playing with it when you get the alpha cascade, but I will making quick additions after the 17th in response to any key areas I have missed (there will be plenty).

Play

Went for a nice walk this afternoon. Rained half way through but I was totally covered in waterproof gear so I was in 'smug mode' as the wind and rain howled around me.  Nothing else to report, it's been all work. Going to eat now and see if an early night is possible..

Thứ Ba, 14 tháng 1, 2014

STOP PRESS - RELOADED HAS LUA

Work

After a very quick prototype in DBP, I moved swiftly onto making the official integratable prototype for the main engine, which took about two hours. I then tested the module in the main engine, which worked almost immediately.


I then set about creating scripts for collecting ammo, health and weapons. Then player win zones and checkpoint trigger zones. It got to 6:45PM, my clocking off time, and I was just short of getting Checkpoints to work.

The great news is that the integration went very smoothly. Thanks to the DBP LUA plugin I could dive straight into the engine side of things and get stuff working. As you can see in the shots above, the script is very nice and readable, and you might start to pick out how you yourself might start coding some game logic.

Plenty more to do on Wednesday, with more scripts, more actions for sound effects, music, video playback (maybe) and of course clean up the source code to remove all traces of the old FPI system and entity members. I also need to build an internal test version on Wednesday as well so we have a few clear days of testing before the final release on the 17th.

The bottom line, and the grand finale of this blog post is that when you get your mittens on the ALPHA CASCADE version, you will be able to start writing LUA scripts and attaching them to your entities - hurray!

Play


No walky today, but made a small bonfire and burned some cardboard, so that was fun! Pretty much the rest of the day given over to LUA scripting as above, it was an important and very serious bit of early work. No play today!

A new wind investment in Texas

It sure is windy in Texas. So windy, in fact, that we’ve made another wind energy investment there. In late December we finalized an agreement to invest $75 million in the Panhandle 2 wind farm in Carson County, outside of Amarillo. The 182MW facility, developed by leading wind developer Pattern Energy Group LP, has the capacity to generate enough renewable energy to power 56,000 U.S. homes. We expect the facility to be operational by the end of 2014.
The future site of Pattern’s Panhandle 2 wind farm

Panhandle 2 is our 15th renewable energy investment overall, and our second in Texas—last year around this time we announced an approximately $200 million investment in the Spinning Spur wind farm. In addition to these two projects, we’re also buying Texas wind from the Happy Hereford wind farm as part of our goal of operating on 100 percent renewable energy. These efforts reflect our long-standing commitment to renewable energy as both an investor and a consumer.
Sunset at another Pattern facility, Gulf Wind

Let that Texas wind blow!

Thứ Hai, 13 tháng 1, 2014

One Task Left; LUA

Work

Some good work today, identifying the hungry nature of buildings on the instance stamp system and reverting them to use LOD instancing solved the disappearing building issue, tweaked some easy B's from the master list scheduled for the alpha which left a few hours to look at the last large task which was scripting.

To begin the implementation, I decided to use the existing LUA scripting module available for DBP called 'Unity', which offers a very simple mechanism to load and apply scripts to DBP source code.  I had the fear that this old module might not play nicely with the new version of DBP, but they were unfounded. The module performed very well and within an hour I was able to create a LUA script, call LUA functions, read LUA arrays and set LUA globals. Everything I needed to proceed to stage two.

Stage two of course is to create an integration prototype around this module and my new found knowledge. Tuesday (providing there are no bead attacks) will be all about scripting, and creating a foundation which will allow me to knock up the scripts to reproduce what is currently being hacked into the engine. Things like 'win zone' trigger zones and checkpoints, collecting weapons and ammo, but once these are in the bag, I want to quickly move onto collecting keys and opening doors. This is the level of game logic that will then allow you guys to take the scripting commands and go much further. The alpha implementation will be VERY basic, but it will be a solid start and allow you to start experimenting.  I am keeping a full dictionary of existing FPI actions and conditions for reference (as it is a VERY complete one), but I will be adding the LUA command lexicon on an 'as needed' basic and when I come across any instructions from the old FPI language that I consider outmoded, I will drop them in favor of a better solution.

Beyond the final task of scripting, there are a few minor tweaks and the necessary testing of the whole engine before the release of the alpha version later this week.  Looking back, there is quite a pile of new features to check out, and my only residual fear is that we're adding stuff faster than we can thoroughly test it.  I am hoping you can step into the breach on this point and feedback what you find, and make sure I don't leave my mark until the features added are solid and dependable. I'm all for new features, they are fun to code, but I am also well aware of the dangers of moving too fast. Reports on performance, memory usage, stability, functionality and every day feel of the software is still paramount to me, and I invite you to post in detail if you find something that upsets the apple cart.

Play

As much as I managed to get done today, I have been plagued with power-outs since 11AM. One minute I am typing, the next minute zero power. It's not the grid, it's something inside the house that's tripping the RCA board. Have tried segmenting a few pools of devices, but it's nothing obvious, which makes it my first non-reproducible power bug.  I've taken to switching off most appliances in the house in the hopes of keeping the PC alive long enough to do meaningful code, and for the most part it has worked.  It's a little edgy though and I really want a proper solution, but in the midst of TWO deadlines, there is not much you can do except type faster and pray.

Thứ Bảy, 11 tháng 1, 2014

Woodland Research

Play

It was Saturday, and I drove for over 30 minutes to get away from the PC. Found myself in a woodland somewhere with extensive walking trails. Set off at about 1:30PM and came back in the dark around 5PM. The sign said 45 minutes. Now I think about it, I think it must have the trail was 4.5 hours...


After various protests from different limbs throughout the marathon trek, I finally managed to get back to the car and get home to write this little blog.

As you know, I seldom 'switch off' and my mind constantly looks at life through the interpretation matrix of figuring out how to convert it to something I can turn into software.  I was totally struck how many little terrain and landscape details popped out at me, crying out to be digitized and made real in the virtual world.

I took lots of photos and made a few videos for the sound effects and animation effects required to reproduce the splendor of the natural world. Of course I won't have any time to do anything with them, what with game logic, AI and performance issues to deal with, but if I still have my camera phone many moons from now, I might be able to do something with the content.

The good news is that I walked 10 miles, 20,000 steps and I'm feeling buzzed. Time for food and late night FPS gaming action!

Thứ Sáu, 10 tháng 1, 2014

First Person 3D Editing Mode

Work

I got a message in my inbox this morning warning me away from the time-sucking activity of solving the mystery of the missing buildings and focus on something new and exciting; the FPS 3D Editing Mode.  It sounded like fun, and it WAS Friday, so I decided to throw caution to the wind and set about making my player fly, create terrain and paint the world WHILST in test game. Sound good?  

Well I created the feature in quick order and I can confirm, it IS cool. Spent far too much time dynamically creating floor under my feet and laying out my paths as I walked along. Freaky cool fun!

A New Feature, Coming To ALPHA CASCADE 1.0045 On The 17th

As you can see, it really adds a new dimension to the editing experience, and starts to blur the line between testing the game and continuing the edit experience.  Expect to see more toys attached to this feature in the future!

I also got to see the first drafting of the new Object Importer module, which is looking pretty sweet. It already imports X files and textures, scales and assigns attributes, and saves out a fully working FPE entity file ready for use in Reloaded. It's not integrated yet, but the prototype is looking very nice indeed.  I would show you a screenshot but I've been warned about showing 'very early' art, so you will just have to imagine what it looks like :)

Play

Went out for a meal today (very rare for me when not on business expenses) but it was a good 'congratulations for surviving the flood meal' and you guessed it, I had another of those Welsh Black Beef Fillets!  Did not walk the dog today which was naughty of me, so will be driving to a local walking spot on Saturday and doing at least 20,000 steps to make up for it.

Free Holiday

Earlier I got a cool email offering me a bus-man's holiday to talk code in Germany or Italy, all expenses paid. Excellent I thought, code, cold beer and new friends! For some crazy reason however, Rick felt my 7 remaining work days in Feb was not enough time to do anything with Reloaded ;) It also clashed with a launch so the fates were against me this time. Pity though, I do like Bavarian beer!

I'm Finished

It's now 3 AM. I had planned to clock off at 7 PM, watch Time Team, grab an early night and enjoy a fresh start on Saturday. What with integrating the new 3D Edit Mode into the main engine, building an interim version, testing it and creating a blog video I have had to clock another eight hours to get it all done. Technically, I have now done all my man hours for Monday so I'll see you all Tuesday ;)

Thứ Năm, 9 tháng 1, 2014

A Day Of A's

Work

A list has been compiled of all the bits and bobs that need to be in the engine for next week, and given A, B and C priorities. My mission is to blitz through them as efficiently as possible, not to hack them in but make sure they are rounded enough to be functional and stable.

Quest one was to quickly sort out some rendering hooks for the Rift work that a fellow coder is working on, and get that emailed away.  It went very well with some small tweaks to the Camera module and some in the new Rift module, then away for more hardware testing. Alas in practice the module keeps coming back to me for more tweaks throughout the day, such is development.

Quest two was to go through and hit all the easy A's in the list which was weapon mode change when in zoom, clean up F1 help and stop some buildings disappearing. The last one being a potential time-drainer. The first two happened to be a walk in the park, and you can now switch out of zoom mode via keys or mouse wheel, and the F1 Help Page in the editor looks much nicer. The disappearing buildings however proved more illusive...

The first job was trying to reproduce the issue, as it does not occur all the time, and then only in certain circumstances. After much ado, I managed to figure out through my earlier prototype that when you mix lots of different objects in close proximity, and more than five for sure, the instance stamp objects flicker for a second. I also notice some lag as the dynamic vertex buffers are being taxed (or new memory sought). It's the flicker which leads me to believe it is the thin end of the wedge that is causing the buildings to disappear completely in the engine.

This is the clue I will begin Friday's hunt for this mysterious and annoying little bug.   If I can crack it quickly, I can move onto the more exciting 3D Editing Mode which will allow you to stand in the test game and edit your terrains from the first perspective. Should be exciting (if I can just fix that darn disappearing bug).

Play

My bead system is working well. My magic abacus, the one that assigns 'distraction points' to individuals via the sliding of a bead, ensures that my focus is maintained through the working day.  It's good fun too!  Nothing else to report on the non-work side, no time to play games this week but should find a little time over the weekend to charge up another game, perhaps FarCry3, which still sits in it's shrink-wrap.