Saturday, December 12, 2015

HT: Adding Dash movement

I was thinking if the dash feature should be a new script or just add it to the PlayerMover script. I thought, "dash is simply a speed boost for a limited time". There's no need to create a new move script, all I need to do is change the speed while dash is in effect.

There were two ways to specify this. Either I express it in terms of distance and duration, or I express it in terms of speed and duration. I almost always start things this way, thinking of what variables I need to implement the functionality.

Both methods should give the same end result, but my way of thinking differs depending on which I start with, and that tends to take the development in different directions.

I went with distance and duration (speed is derived by distance divided by duration).

My first attempts were crude. I simply created a boolean to signify if the character is dashing or not. It's set to true when the player presses the dash button (A on the Xbox controller). When I do, current speed is set to an incredibly high value. I record the time the dash should end (current time plus dash duration). This "end time" I check for continually, and if we've passed that time, the dash is set to false and speed is back to normal.

Pretty simple, but I noticed a lot of things that go wrong:

  1. The camera follows the character smoothly (it kind of lags behind the player when you start moving). This is normally fine, but since dash has high speed, it makes the character go off-screen for a few moments, enough to make me feel like it was an annoyance. There needed to be different cam follow behaviour while the character is in dash.
  2. The stopping of the dash was too abrupt. Imagine how The Road Runner (Looney Tunes) stops. Nothing bad there but the thing is, the camera is following the player, so the whole world feels like it's suddenly stopping. This makes it feel rather motion-sickness inducing. There needs to be some sort of easing out to make it smooth.
  3. The character's cape was flailing wildly when subject to the high speed of the dash.
  4. The character's turn speed is too slow for this high speed dash. The dash had already finished, and only after a second or so does the character finish facing the direction where it went to. I needed a different turn speed while in dash.
  5. I haven't made the character play the dash animation yet, so it looks kinda weird.
First thing I did was change my cam follow script to stop the smoothening behaviour when following the character. This is only done during a dash (my PlayerMover script now has a public bool IsInDash property). Later on I'll realize this was the wrong way to go. Just as bad as when the dash stops abruptly, gluing the camera to the player was making the whole thing feel abrupt. It made it look like the dash was moving in stutters. I thought my framerate was just bad. I will not realize my stupidity until at the end when I was polishing the dash movement.

So I moved on. To fix the abrupt stopping, at first I thought I'd be clever and create an AnimationCurve and use that for the easing out. Then I remembered why I hate using Unity's curve editor controls.

In Photoshop, the curve controls allow you to move the handles as far away as you want. This is important. The distance of the handles can influence the shape of the curve. And the farther the handles are, the finer control you have at rotating them.


In Unity, you can't move the handles farther or nearer. You can only rotate them. This was frustrating for me:


In Photoshop, it's so easy to make this kind of easing out curve:


You just needed to move the handles on both ends.

With Unity on the other hand, you can't move the handles away. So you need to compensate by adding more handles to achieve the same curve more or less, and it's not easy to get it right:


I highly doubt the things I like about Photoshop's curve controls is proprietary stuff. Blender (an open-source program) does it too.

So I thought to myself, "why am I being a masochist?". So I stopped using Unity's curve editor and just moved on. I'll polish that later.

Adjusting the turn speed was easy. I simply have a new turn speed variable meant to be used during dash, and use that instead whenever the dash boolean was true.

What took up the most time was making some appropriate dash animations. I had one prepared, but it was just a single frame pose. I thought that would be enough. I was wrong. It looked horribly amateurish.

I thought maybe if I went ahead and added that dash recovery animation that I wanted to make, it'll look better! You see, the dash animation I had in mind was inspired by Alice's dash in Alice: Madness Returns. When she dashes, she zips by fast, and we only get to see her already in a sort of semi-crouched position, slowly going back to her idle pose. It's like she was throwing her body momentum downwards to stop the dash. And it actually made sense visually. In my sheer poetic genius, I ended up calling it, simply, dash recovery.

So I created something to that effect in Blender, and added it in the Mecanim state machine.

I figured that, the player isn't allowed to move while in the dash recovery period, but he can still do another dash (provided he still has enough energy to do so, once I implement energy usage).

At first I had a separate state for the dash loop, and for the dash recovery animation. The more I tested it, the more I saw that the dash animation and dash movement were out of sync. Sometimes the animation played just in time, sometimes there was this weird delay, and the animation would play well after the dash movement finished. Turns out it's because the dash animation isn't getting played if the state machine is in the middle of a transition. So if the character was transitioning from idle to move, dash doesn't activate yet.


I Googled and checked the docs, and the way to fix it is to set the "Interruption Source" to something other than "None" (the default value). It helped, but it still didn't work quite well. I thought, maybe I should start using that new StateMachineBehaviour script I read about. And as I was skimming through the template file Unity gave me, I thought, no, I think I'm just making things harder than it should be.

Then I thought of what exactly I want Mecanim to do. So I Googled "mecanim state transition to itself and replay animation at beginning". Then I saw this page in Unity Answers: Restart same animation in Mecanim. As I was looking through it, I thought it looked familiar. I actually answered this question with "use Animator.ForceStateNormalizedTime" That doesn't exist in Unity 5 anymore though. Someone answered you could just use "Animator.Play". So this actually means we can bypass the transition rules in the state machine and force it to jump to a state, all of a sudden.

For a scant few moments I pondered on the meaninglessness of creating lots of nice state machine features, when you are provided with the means to undermine it.

Anyway, Animator.Play worked perfectly and fixed the problem.

I also simplified the state machine by removing the dash loop state and instead use the dash recovery animation itself as the dash animation. I don't have a dash recovery state anymore.

I also removed the Move.Forward state and just kept the Move.Forward.Loop state. The Move.Forward was actually an animation to play to transition from idle to move, but there was little need for it as Unity already handles fading of one animation to another.


For the dash easing curve, I settled for using the easeOutQuint function (see http://easings.net/) to make a nice, perfect quintuple curve. For the camera follow script, instead of gluing the camera to the character, I simply gave the camera a speed boost when dash is occurring so it can catch up easily.

I ended up expressing the variables in terms of speed and duration.


Sunday, December 6, 2015

HT: Adding lean left/right to the mecanim animation



It took a while to figure this out. To do this, I needed to create new animations, a steer left, and steer right animation, and play them when the player is turning left or right.

Technically, they weren't animations. They were just single frame poses.
Preparing the Mecanim state machine for this is easy: the move animation state just needs to be converted to a blend tree, then I'd add the steer left and right animations to it:


I made a new parameter called "Steer". It's a float. The "moving straight forward" animation is set to use 0, the "lean left" is in -1, and the "lean right" is in +1.

The preview shows how it will end up looking like:


Now, how to properly play those in runtime? What I want to do is detect when the player is rotating the thumbsticks, and use that to play the lean left and lean right animations correspondingly.


This same thumbstick is the one used for movement. So it's when I'm rotating the thumbstick I should transition from lean left to right and vice-versa.

Turns out it's not so easy.

I'm using CharacterController which doesn't calcualte angular velocity. I could've just used that to detect when the character is rotating (equivalent to when the player is rotating the thumbstick).

My first thought was to use dot product on the character's current forward direction, and the direction where he needs to go to. You see, I make the character smoothly rotate towards where the thumbsticks are pointing. When you want to do a smooth rotation, you'd need to store where they currently are facing, and where they need to face to, and slowly interpolate to where they need to face to. So I thought of using those existing variables already.

The red dot here is where the thumbstick is pointing to, and the yellow dot is where the character is currently facing.

The dot product tells me how far apart the two direction values are. But it doesn't tell me if the direction where the character should go to is to their left or to their right. That's important since I need to know if I should play the lean left or lean right animation.

This is the video that taught me dot products:



So I needed an additional way to determine as to what direction the thumbsticks are rotating to. I thought of deriving the angles (in degrees) that the direction values are creating. Then subtract the two to tell if we're rotating to the right or to the left.

It almost worked well.

I noticed "bumps" when I rotate my character to the left.



I realized it was because angle values I calculate always get clamped to 360 degrees. When the target angle is over the 360 degree mark but the current angle isn't over that yet, the resulting value is too big, causing the "bump".

I recorded the angle values to a graph, so I could see what exact values I'm getting.


I figured the only way I could get around this was to get the proper angle value when it crosses over the 360 degrees mark. With a little bit of trial and error, I found the code that best suited the situation. It looks like this:

if (_angleDelta > 270) _angleDelta = -(360 -  _angleDelta);
if (_angleDelta < -270) _angleDelta = 360 + _angleDelta;


The only thing left was that I still noticed spikes in the graph of my "Steer" getting function. Depending on how bad your framerate is, it made the whole animation look like it was stuttering. I guess there was noise in the input data.

This graph looked a lot worse before.


So I just added a sort of average filter on the last 4 values recorded in the graph and use that instead:



It all seems rather straightforward now that I've put all this in a blog post, but before this, I forgot what "dot product" is and what values it returns, I didn't know what code to use to clamp angle values, and I didn't know what an "average filter" was. There was lots of looking through the Unity manual, and I wasn't even sure if this "Steer" factor idea was the right way to go about it.

It's all exploratory when solving a problem like this and trying out clever solutions.

I was a little against posting a blog post about this because it did take up the entire day, making all those screenshots and videos, and it's making me feel that people would think I'm obsessing over the little insignificant details. At least the time it took to make and fix the whole steer feature took only about a day of work.

Wednesday, February 18, 2015

Visa Application

I gave myself a mental note to not get distracted while a self-satisfied woman looked like she was letting her boobs bounce on purpose as she walked eagerly to the exit.

Guess someone's visa got approved.

I looked up again. The dot-matrix screen reminded us whose stub number was ready for interview. Above the shuffling of feet and the confused whispers, the usherette kept on reminding us that the stub numbers come up in random order.

"Ah, raandoom!" I heard someone say beside me.

What that really meant was, simply that some applicants finish their talk with the consul faster than others.

...

Honestly, in my head I thought the interview consisted of sitting down in some posh office. Some nice plants, a portrait, certificates hanging on the wall, maybe a golf club leaning somewhere.

And then I'd come in, nervously stammering and showing my papers to a stern old man who'd look like he never has enough time.

Of course, as with most of what I imagine, it was nothing like that.

The embassy probably gets a hundred or so applicants per day, judging from the long lines and the amount of seats.

So it all worked like a production line. Apart from the guards and the usherettes, all the personnel you talk to are behind windows, including the consuls. There's a chute at the bottom of the window where you pass down your passport.

The whole thing reminded me of computers and how they pass data around.

...

It was a long wait before my number lit up, so I had a lot of time on my hands.

Rummaged through my old passports. I went to Hong Kong when I was a kid? Oh wait, I did. I remember riding that World's Longest Escalator ride.

I didn't think much of it back then. But it turned out it really was the World's Longest Escalator.

Someone, at some point in time, thought it was a good idea to put SeaWorld Hong Kong on top of a mountain.

I looked at all those ink stamps on the pages. Departure. Arrival. They had different shapes, bright colors. I heard myself make a wistful laugh. They made my old passports look like stamp collections.

I saw my DS-160 form had the words CAPTURED stamped on it.

For a moment, the nervousness was replaced with disgust. Middle-aged guys ogling X-ray body scans of passengers behind the security doors of an airport. Videos of police brutality on Facebook. Why would anyone want to live there?

It makes me think getting into the US isn't as rosy and important as these hopefuls are making it out to be. Wearing smug faces, trying to display they know more than the guy next to them. Maybe it's just to cope with the nervousness? Validating all the hardships they went through?

In a place like this, you could tell who were the people who had actual character.

...

The guy beside me started saying out loud the subtitles on the instructional video playing in front of us.

Jeez... Practicing English just now huh?

More time passed.

I couldn't help yawning over and over. Well, I did take the 7:15 AM. I needed the earliest slot I could find. Russ had been bugging me already, and I've put this off for a long time.

Man... I found myself slouching in my seat as I thought, I just want to get back in front of a computer.

The instructional video even managed to be funny at one point:

Myth: Only cute people get their visa applications approved.

Fact: Non-models get their visas approved every day.

Hah.

The next slide came up:

Myth: Single people get their visa applications denied.

Fact: Your honesty is more important than your marital status.

Ok, not laughing so much now.

...

When my number came up, I kept looking at it to make sure it really was mine. 2126. Probably took too long, cause the guy beside me caught my attention and told me my turn is up.

Looking back, the interview ended faster than I thought.

I just ended up talking about being chief technology officer, us having a booth in Game Developer's Conference, the game we're marketing.

"Games?", he asked.

"Yeah, video games.", I nodded back.

"Oh, cool.", he said.

"Our game looks like this...", I held up a printout of one of the screenshots of our game.

"So are you guys gonna put this out on... games..."

"Sorry?" I asked.

"I mean, are you guys like, will you put this out on the Xbox?"

"Oh," I shook my head, "Getting into consoles is a lot more difficult, so we're targeting... only Windows for now."

"Ah", he made a face as if he'd scratched a card that said 'Try again next time'.

"So how long do you plan to stay?"

"Oh about... 2 weeks maybe. My partner has a relative in Las Vegas so that's probably where we're staying--"

"Ok, visa approved. Thank you."

I saw him place my passport on a pile. Presumably, the pile of passports that would get visas.

"Oh, thank you.", I managed to reply, before leaving. I haven't even showed any of the documents yet, I thought as I left.

I didn't look into his eyes the whole time. I was told that it gave the impression of shifty-eyed liars to Americans.

I wonder if he didn't like that.

...

As I walked out, there was only one thing that crossed my mind.

I took out the cheap black ballpen I stuck in my left pocket a few hours ago, and stared at it.

Fuck, I got duped into buying this stupid ballpen! The old lady in front of the embassy was hawking ballpens, making them sound important. Turns out I didn't even need to write anything the whole time.

Wednesday, September 24, 2014

Ingress Day 4

I decided to explore the southern part of my nearby vicinity. There were two portals there: the Ateneo Blue Eagle Gym, and the now erased graffiti on some doors of an abandoned building by the roadside.


Blue Eagle Gym

This portal looked like no one was reclaiming it. So I went here to try to get it.


The gym is inside the Ateneo University campus. Since I'm not a student there, I could not get in. However, I thought I could reach it by standing outside the school grounds, by the fence. I can almost reach it, but couldn't. So I had to abandon this one.



Marked Doorway Murals

This graffiti portal, which I remember being there before but had been removed some time ago, seemed like no one was touching it, so I investigated it.

Turns out it was nearby a lot of telephone wires, and some power line posts with transformers. Seems like that disrupted my 3G connection to the game, so I couldn't interact with this portal at all. I logged out to try to "refresh" the game, but I couldn't even log-in again while I was in that spot.





So all in all, I couldn't expand my options here.

Meanwhile there's a place nearer my "safehouse" that I thought would work as a new portal and I was thinking of submitting it. I'll try it one time.

Ingress Day 3

Finally reached level 3!



And got something pretty powerful:



An Enlightened captured that portal I was using. I still haven't reclaimed it. I realize I should have used Power Cubes when my XM reserves run out when attacking, so I could keep at it.



Monday, September 22, 2014

Ingress Day 2


I accidentally broke my toenail while running. Had to limp my way back to the apartment.



Not to worry, it's all patched up.





My portals got attacked. Looks like this won't be boring too soon.

That green one used to be mine.

Somewhere out there, some frog's fucking up my portals.



Ingress Day 1

So I just found out I have hypertension. Part of it means I need to do cardio exercise.

I thought, "Well, I could use one of those fitness tracking apps, or I could start playing that Ingress game I saw long ago."

So I started playing Ingress.

Seems like some people nearby already started putting up some portals, but looks like they were abandoned. So I took them.

I'm only starting out


Looks like someone's been busy. Those aren't mine, obviously.






Thursday, May 15, 2014

Productivity tools for those with problematic Internet connection

3.6 Mbps here is the average for premium subscriptions that the well-off can afford.
Please take note that that is the theoretical maximum.
There is pretty much nil in the way of guaranteed minimum speeds.
We have 2 Mbps in the office. I have 0.46 Mbps in my house.

Where I live, I can't rely on the Internet connection speed to be reliable in my everyday work.

So here's some tools I compiled to help mitigate or workaround these issues. I err more on the free programs, and ones that work in Windows and Android. I provide links to alternative software for each.

Hopefully, you'll have use for them as much as I do.


Evernote

A note taking program that can also save web page snippets.



Pros:
  1. Can work offline, will sync to cloud when Internet connection is available
  2. Has a mobile app version
  3. Allows sharing to other people, with settings for permissions
Cons:
  1. The Evernote window can hang occasionally as it does whatever housekeeping it does to its data.
Caveats:
  1. Bandwidth usage limit capped at 60 MB per month for free users (understandable; not really a problem, but you should be aware of it)

More than a simple note-taking program, Evernote can also save web pages. This is important as it gives me offline access to those web pages, instead of simply bookmarking them.

So why not just save the .html page on your hard drive? Evernote allows you to organize your notes/web page snippets neatly: you can organize them into "notebooks", search the text, add tags, see the original URL of the web page you saved, and most of all, they get synced in the cloud. If you get the mobile app for Evernote, all your notes also show up in your mobile device.

Found a gamedev article that you feel you're gonna need for reference later on? Clip it on Evernote. Had a sudden stroke of good ideas while on the go? Type it down on your smartphone with the Evernote app. It'll sync to your PC later on, and you can flesh out the idea more on your keyboard.



Catch: The free version allows you a limited amount of stuff to sync: 60 MB worth of data, but it resets every month.

So if you find yourself saving pages with humongous images, you're better off simply saving them the usual way. Evernote is primarily for notes anyway.





Trello

To-do list creator that's perfect for Kanban style, but also works well otherwise.




Pros:
  1. Syncs to cloud, has mobile app versions
  2. Allows sharing to-do lists/boards to other people, with settings for permissions
  3. Intuitive controls, 
  4. Can have plugins. Burndown For Trello and Scrum for Trello in particular is interesting.
Cons:
  1. For desktop, it's accessed only via your web browser; doesn't have offline access. If you went to the Trello website while having Internet connection, it will still continue to work when you lose connection. But it can't start if you do not have any Internet connection in the first place.
  2. As of yet, only the mobile app version has offline access
I don't personally use a strict Scrum style. For that, you can try Pivotal Tracker.

Running the mobile version of Trello on your desktop PC

While you can't have offline access to Trello on your PC, the mobile version can. And it's possible to run an Android virtual machine on your PC, then run the mobile version of Trello on top of that.


For an Android virtual machine that's easy to install, there's Bluestacks. But you need to pay a subscription to use it. If you don't want to pay, you'll be required to install some sponsored apps/games to continue using it (not a problem, really).

For something that's totally free and open-source, there's Genymotion. I haven't tried that yet however.


Some noteworthy alternatives to Trello:


  1. Written in .NET. Can work offline.
  2. If you set up your own redis database server somewhere, Personal Kanban can sync to it.

  1. Single .html page, written in HTML/Javascript. Can work offline.
  2. Can sync to Google cloud storage.





TiddlyWiki

Your own wiki site, all in one html page.

There's a beta version 5, which is an overhaul of TiddlyWiki, and there's the classic version.



Pros:
  1. Works offline. Upload the .html page on the web, and it also works online.
  2. If you need it to sync, just put the file in your Dropbox, Google Drive, or whichever cloud storage service you prefer.
  3. The new version 5 (currently in beta) can also be deployed as a Node.js application
  4. Numerous plugins, but take care as some of the ones found online only work in old versions.
  5. Themable skin
Cons:
  1. Easy, one-click saving of changes to your TiddlyWiki is problematic, as web browsers don't normally allow this (due to security considerations). Firefox has a plugin to bypass this restriction specifically for Tiddlywiki files. Alternatively, you can just save the .html page the usual way and overwrite the old file.
Caveats:
  1. Has no official mobile version, but there is a 3rd party program: a web browser specifically designed to work properly with TiddlyWiki files: AndTidWiki (Put your TiddlyWiki in your Dropbox, get the Dropbox app for your phone, and use AndTidWiki to edit it. You now have a wiki that syncs to and from mobile!) Here are other mobile apps for using TiddlyWikis.

Being a wiki, TiddlyWiki has some uses that overlap with Evernote.

But for me, I use my TiddlyWiki as a knowledge-base; an encyclopedia for my game's lore.

Evernote on the other hand, is for hoarding tutorials, references, and jotting down ideas quickly.





Google Docs

Create documents, spreadsheets, presentations, etc. on the cloud.



Pros:
  1. Syncs to cloud, has mobile app versions
  2. Can work offline and will simply sync when Internet connection is available
  3. Allows sharing documents to other people, with settings for permissions
  4. Allows real-time collaborative editing on documents
  5. Have plugins that allow it to create more types of documents, including a kanban board, plain text files, guitar tablatures, etc.
  6. Can import OpenOffice documents
Caveats:
  1. Works best in Google Chrome



LAN Messenger

Offline instant messenger (LAN only) and file transfer tool.


This is pretty self-explanatory. It's like Skype/Yahoo Messenger/etc., but you don't need to connect to a server on the Internet. However, you need to be connected to a LAN of course.

Anyone else in the LAN running the same program can see you, and you can send messages, set up chat rooms, and transfer files to each other.

It's best for communication between (trusted) members of a team.

LAN Messenger works on Windows, Mac, and Linux, so it's an easy way to transfer files, if your people use different operating systems.

It also has a portable version, which means it can be installed in your thumb drive.




FreeFileSync

Backup/Sync tool. It makes sure two sets of folders have the same files/subfolders inside.


Using USB thumb drives and external drives is common for us, so a tool that figures out stuff for us like "which of these again is the up-to-date version that I should copy??" is nice.

I have a bunch of concept art reference images for my projects and I like to do backups of them to my external drive. However, I do shuffle them around across many folders over time as the project matures. Having to make sure the folders in my external drive match up with how it is in my laptop by myself is a hassle, so I let a file sync program do this for me.

You can have it ensure the files/subfolders in the destination folder exactly match up the files/subfolders in the source folder, or you can let it work on a per-file basis to resolve situations.

The program basically tells you "they're the same filename, but the contents are different. which one of these do you want to keep?" and you have the option how to resolve it:

  1. Keep both and just have the other file be renamed.
  2. Make the program stop and ask you to inspect both, letting you choose which you want to keep.
  3. Simply always keep the one that had a later "date modified", and discard the old one.




NetSpeedMonitor

Bandwidth monitoring tool.


How much is your PC downloading right now anyway? With a bandwidth monitor tool, it's easy to see if your Internet connection is going through that temperamental phase again.

There are a lot of programs that can do this, but what I prefer is something that I can see even if I have a maximized window, unobtrusive, and doesn't take much space. NetSpeedMonitor does the job well. It adds a bandwidth reading right beside your system tray.





NetBalancer

Bandwidth balancer.


Taking this a step further: have you ever noticed your download speed spikes up when you browse the web? I found this usually infuriates other people in the office playing an online game or watching a streaming video.

What if you could limit your web browser to download at a set 10 kb/s? Even if it doesn't have that feature? With a bandwidth balancer you can. Any program transferring data to the Internet can be throttled.

NetBalancer is the one I've tried, and it works ok. The free version allows you to throttle only up to 3 programs at a time (you can switch which 3 programs are throttled at any time), and that's usually enough for a single person throttling his own PC. (NetBalancer has a version that can throttle for your whole network.)

The best would probably be a sophisticated software that's installed on your router (the device that connects all your PCs together, and likely also your connection to the Internet). ISP's here give you some pretty bare-bones routers that aren't of much flexibility that allows that. So a user-driven program can work pretty well in this situation.

Even without using it as a bandwidth balancer, NetBalancer is useful to check which of your programs is hogging the download bandwidth.

Catch: I've had a side-effect that my laptop's CPU usage was always about 25% even when I wasn't doing anything. It made browsing my files slow and whatnot. Seems like it was connected to the WMI Provider Host hogging the CPU problem. I'm not sure if it's related (it's also likely that it's not) but when I uninstalled NetBalancer plus tweaked a bunch of settings in my Windows, the problem went away. I use Windows 8.0 by the way, and it's also possible the issue was fixed in Windows 8.1.




Text-only mode for your browser

Text Mode for Google Chrome

Opera web browser (has this feature built-in via user mode)

Text Only, Lynx Web Browser, and Opera Mini for Android



Maybe you need to check some documentation online, maybe an interesting gamedev article came up in your Twitter feed. At that point, you're only going to care about seeing the text first. With a flaky Internet connection, it'll take longer if the images are going to be downloaded too. If there's diagrams you need to see, it can be nice to easily load them on your demand with a simple click.

I use Google Chrome and there's quite a lot of these plugins around. The one that worked ok was Text Mode, but it's a toggle that will block/unblock image downloading for all tabs in all your web browser windows. A per-tab setting at the least would have been useful.



Squid proxy server

If you're in a small office where people end up downloading the same thing over and over across different machines, you'll find yourselves eating up download bandwidth really quick.

"Hey Tim, check out this youtube vid...". who then passes it to Sally "cool, check this out", who then streams it from her laptop... and pretty soon you'd have hit your "unlimited" data cap.

A proxy server is meant to get rid of those redundant downloads.

How this works is, instead of all the PCs in the office directly downloading stuff, they now only request it from another PC, designated as the "proxy server".

The proxy server downloads whatever's requested, and saves them in the hard drive. The next time someone asks for the same thing (a video, a web page, etc.), it's not going to bother downloading it again, it will just send the already saved file to your PC.

In the case of user-sensitive data like when you access your private Facebook stuff, it's not going to cache that because it doesn't make sense to do so.

Catch: It requires you to have an additional PC running as the proxy server (likely turned on 24/7, or as long as there are people in the office).

I've had success with Squid, and it's perhaps best to run it on Linux in text-mode, to save on your electricity bill. An old Pentium computer can probably suffice for this in a small office set up. Being Linux, that's gonna require someone who knows their way around it to get it working properly. If you don't have that luxury, there's also a Windows version for Squid.

Squid is free and open-source, however, it requires some extra configuration to get it to work properly with caching Youtube videos or any streaming video.




Peer-to-peer file sharing over the Internet

infinit

BitTorrent Sync

Sync your files across many PCs or mobile devices just like the way you torrent.

Catch: This is relatively new. Even with those assurances of being secure, I would err on the side of paranoia and expect some security vulnerabilities eventually.

I'd use this only for large files that I'm willing to share to the public anyway, like demo builds of my game.



That's all. I'll add more when I think of something worth mentioning.

Feel free to suggest other apps and tools in the comments section.

Wednesday, November 6, 2013

Our Design To Prevent Savescumming in Graywalkers

Game development is chiefly exploratory in the initial phase of development, and this is mostly where we come up with ideas to overcome certain problems.

Here's a look at one design proposal I have for our ongoing project, Graywalkers: Purgatory, as an answer to the savescumming issue found in games. Graywalkers is part squad-based tactics game, and part grand strategy-esque game.




Design Proposal For Preventing Savescumming: Hostage Situations

Savescumming is a metagame technique that players do to turn otherwise unfavorable situations into their favor if the outcome is determined by random chance (i.e. dice rolls). By saving right before such "dice rolls" happen, they can keep on reloading until they get their desired roll results.

Savescumming is a thorny issue. You can stiffle the player's power to save, by say, having save checkpoints instead. But this turns into an inconvenience. What if the player suddenly needs to take a long break? You could implement a "Save & Exit". It won't deter the stubborn savescummers though. But what else can you do?

If the game is built well and the player is savescumming they're way through it, I think it's an indication that they are focusing too much on one solution to their problem when there are really several ways to deal with it.

And the problem I think, is how to let the player learn better solutions without the jarring experience of a Game Over screen.

What I'm going to propose is only one way to go about this. Certainly, better tutorials, perhaps an in-game advisor, can also help.


Dark Souls

Dark Souls is brilliant in this. Savescumming is discouraged by having a "Save and Exit" instead of just a save. It of course does not completely remove savescumming, but it makes it inconvenient for players to do so (i.e. have to close and restart the game all over again just to reload).

Also this means each character has only one save slot.

But the major thing that helps prevent savescumming is the fact that the game gives you a chance to correct your fatal mistakes:
  1. When you die, your corpse (or rather, your soul) is dropped at your point of death.
  2. All your unspent EXP points (and money) are left in that corpse.
  3. You need to get back to that corpse to get back all those EXP (and money).
  4. If you die while attempting to get back to your corpse, then those EXP (and money) are gone forever. Instead, your corpse (i.e. soul) is now in that more recent place you died. The EXP points (& money) you gained while trying to get to your old corpse is now the ones left in that new corpse.

In this way, the player is given a second chance when he dies. If he screws up a second time, well, he has only himself to blame.

It also jives with the narrative: in this game, you are an undead soul who keeps coming back.

Whenever this happens to me, I always refer to it as "my EXP points are held hostage", and that "I need to rescue them".

The idea of not giving an immediate Game Over screen on death has also been done before in other games.

In the FPS, Prey, when the player dies he is put in a mini-game where he is in some sort of spirit world, needing to shoot at corporeal monsters to collect enough health back to magically revive himself.

World of Warcraft has something similar, but their idea is more relaxed; there's always the easy way out of death where you don't lose anything, other than the time to get to your corpse.


Applying this idea to Graywalkers

So with that about hostages, I have an idea for Graywalkers about hostage situations on your own characters.

Short explanation for those unfamiliar with the game: Graywalkers is a post-apoc strategy RPG. But as far as the combat part is concerned, it's turn-based tactics, similar to XCOM, Final Fantasy Tactics, Jagged Alliance, or the old Fallout games. The player can send out multiple squads into the real-time world map.

I'll explain by example:
  1. You encounter some bandits.
  2. You fight but your squad dies or you chose to surrender with the remaining party members unharmed (or rather, not harmed further).
  3. It's not game over yet. You are brought back to the world map and a dialogue opens.
  4. The bandits open a negotiation:
    • "Hoo whee! You there boys? We got your blokes strapped up here. And hey now look, we're all seeveelized folks, so if you give us 100 pieces of canned goods we'll give them back to you the same way we found 'em. But uhh... better hurry up. 2 of them don't look like they got much time left."
  5. This is essentially a hostage situation. In fact, this is a new quest entry for you.
  6. Of note here is that they mentioned what they want (100 pieces of canned goods), and that 2 of the hostages are in critical condition. The rest of the hostages may be unconscious, or weak. They are all tied up or trapped in a prison of some sort.
  7. If you have some of their people held as prisoners of war, they may ask for those as payment instead (i.e. prisoner exchange).
  8. This negotiation can be in conventional means (a diplomat representing them is sent to your nearest remaining squad), or via a video phone if they are hi-tech.
  9. You can still choose to haggle what item/s to give them (and how many) in exchange for your fallen units. I.e. "How about 3 first-aid kits instead?"
  10. If you choose to refuse or accept the deal, or ask for more time, that's not the end of it.
  11. If you accepted, they will give you a location to go to, and you still need to send a new squad there to give the goods (assuming you're not lying) and get your people.
  12. If you refuse or openly say you can't give what they want, you can still get them by force, but they won't give a location. You can start your search from the last place of battle.
  13. But you have to hurry because they don't have unlimited patience, and the 2 of your characters in critical condition can die if you don't act soon enough.
  14. If your bandits are actually from a well-to-do faction (or serving under them), the negotiations may be allowed to take longer, and the hostages will be given minimal food and medical support.


During The Hostage Pickup

Once your rescuers are on the location, several things can happen. This can be in any order or in any combination that makes sense:

Take note that this table is relevant for hostage-takers of any sort, not just regular bandits.

Your Rescuing Squad Hostage Takers Hostages
Can be truthful to the deal and do as promised.

Take note that you need to make sure that your rescuing squad brings along the required items for trade.

For factions that you want to get on their good side, this is a good option.
May be truthful to their deal and do as promised. Can try to break free on their own (you, as the player, are still controlling these hostage characters). You can only control hostages that are not unconscious.

They won't have any items on them. In combat, they can hand-to-hand and magic only, in addition to any non-combat skill checks they can perform that don't require equipment (e.g. bashing cages open perhaps).

You can make them escape quietly, or use them to kill the hostage-takers also. Of course, they can loot any subdued enemies for temporary weapons and armor.

In fact, you may deal with the situation like this and not really have any rescuing squad at all (either lie that you agree with the hostage exchange or refuse their deal).
Can renegotiate the price at the last moment. May up their price at the last moment just to spite you or for whatever reason.
Can use intimidation to make the hostage-takers flee.

It can fail though, and the hostage-takers can get so scared they simply kill the hostages at gunpoint.
May actually just ambush your rescuers. They could openly kill the hostages in front of you to spite you.

It could also be that they are lying and the hostages are not there in the first place (e.g. there is an enclosed cage but it is empty).
Can have a secondary team infiltrate and rescue the hostages in secret while your other team is buying time by talking with the hostage takers face-to-face.

It can fail catastrophically though, if your secondary team is killed, overwhelmed, or captured.
Can fool you by giving you hostages that are not really your characters. Of course for this to work, the hostage-takers will put sacks over the heads of the "hostages".

Could also be something similar to the "hostage exchange" that Mel Gibson pulled off in The Patriot.
Can lie and just open fire on the hostage takers by surprise in the middle of talks.

Take note that you can make it seem like only 1 or 2 people are the rescuers, while the rest of your squad are waiting in ambush.

You may even find it that the hostage-takers have ambushers of their own, and your ambushers can subdue them quietly.
Can fool you by having only one out of the many hostages be present on the site. Their new demand will be that release of the other hostages require additional payments and will be picked up from other places.

Take note that this situation can be further complicated by having the hostage-takers specify the middle of a populated town as the place for the exchange to take place. So you have to worry about non-combatants in your line of fire and collateral damage.


Battle Plan

If the deal is off and you are engaged in battle with the hostage-takers, there are several things you can do:

  1. Kill/subdue all the hostage-takers. The simplest and straightforward. An offensive plan.
  2. Carry the hostages away and flee the scene without killing all the hostage-takers. A defensive plan.
  3. Attempt to break free the hostages to either evacuate them or let them help in battle. You can attempt to resuscitate (conventional means) or revive (magical means) any of your hostaged comrades on the spot if you wish. The reason is so that they can help in battle, if things are looking desperate. They won't have any items on them (i.e. in combat, they can hand-to-hand and magic only, in addition to any skill checks they can perform that don't require equipment).


Breaking Free

For hostages to break free, it will be skill checks. What type of skill check depends on the way the hostages are trapped.

Examples:

If they are in a cage, your hostaged characters can try lockpicking (lockpicking skill), or those strong enough can simply break it open (strength).

If tied up, they can try to wriggle free (agility), or simply break the rope bindings (strength).


On-purpose

You can, in fact, let all this happen on-purpose to let your hostaged characters infiltrate the enemy's base (assuming hostages are brought there, perhaps a prison of some sort). Why you want to do is that is up to you. Perhaps you need to collect information on how well defended the enemy's base is from the inside, or you need to recruit a prisoner in your team and the only way is to get into the prison, etc.


In Closing

The whole point here is not to punish the player for savescumming, but to encourage him not to in the first place.

We give the player a chance to correct his mistakes naturally within the game in ways that fit the narrative, and in fact, opens up the game to more opportunities for the player.

This is really not about completely removing the player's ability to savescum, but give him less reasons to do so.



Graywalkers: Purgatory is the PC game we are working on at the moment. You can check out our Steam Greenlight page here, and our currently ongoing Kickstarter here.

Graywalkers Purgatory Kickstarter!

Wouldn't do well to forget about posting our Kickstarter on my own personal blog. This site is like a diary of events of my job stuff too.

Well, so here it is.



Graywalkers: Purgatory
A post-apocalyptic strategy RPG in a dynamic world

Kickstarter Page: http://kck.st/1eJmrQs

And let me practice my sales pitch here:

The game plays similar to Fallout and Jagged Alliance, where you control squads of mercenaries travelling the world map in real time.

When a squad visits a town or any location, the view moves to a more close up view (i.e. like in the screenshot below), where you can move individual party members of that squad, interact with NPCs, or engage in turn-based combat.



Features

Tactical Turn-Based Combat Fights are a classic "I go, then you go" type of turn-based, set in a square grid. We use an Action Point system similar to the old Fallout and X-COM games.


Christian-heavy, supernatural setting mixed with post-apocalypse Instead of dwarves and elves, this game has demons, angels, vampires, werewolves, and faeries (apart from humans of course). Ancient magic and human technology play a heavy role in the lore.







Dynamic World When moving your mercenary bands in the real-time world map, think of it as there being an automated grand strategy game happening around you. NPCs move around, fulfilling their roles in the economics/politics simulation of the world.

Cities found in the map require constant food and resources or they will die off, and you can use that to your advantage the next time you invade an enemy city.


Factions The world has factions that war with each other, and it's up to you who to ally with. Do you side with the disreputable crime lords of Lost Vegas? Or the well-equipped but bigoted human supremacists?

All of them have their own agendas that they'll pursue, with or without your help.


Suikoden-style collecting of party members You need to gather 36 party members slowly as you play the game. There are about 50+ potential recruits so there's a lot to choose from.

Each party member has their own backstory, and personalities that affect combat (think Jagged Alliance). Some may be devoted to their faith, but prejudiced against half-breeds. One of them may be a crack shot, but has emotional baggage that would get you into trouble during a hostage situation.

No one's a complete goody-two-shoes or bad guy here, and it's up to you who to recruit.


More Screenshots







Gameplay Footage




If you have friends you think will like this, spread the word! Use the hashtag #KickstartGraywalkers and use our official short URL: http://kck.st/1eJmrQs when tweeting so we can find your tweets.

WARNING! Please take note that mass sending of tweets about the game to other Twitter users that aren't your followers is considered spamming and we could get suspended for that.

I'd also love to hear your feedback, good or bad. I'll forward them to the rest of the team. We can't improve if you don't tell us the wrong things we haven't noticed.

A few more related links:

Our Steam Greenlight Page
Our IndieDB Page
Our Facebook Page
Our Twitter Account
Our YouTube Channel

Thanks for your time!




So that's that.

As for how it's doing:


Which means it certainly could be better. I'm not the one running the show here--I'm not even the main authority with the development (I'm in as the lead engineer, doing the technical stuff only)--but I am sharing my thoughts with the rest of the team. And we got some back-and-forth going on. Certainly something to share afterwards.

Our lead has his own blog that he updates (supposedly) daily if you guys want to know more from his point of view: http://wyldekarde.kinja.com/


Sweet bonus: here's a screenshot of our Greenlight with l33t amount of YES votes: