Camera Collisions – SphereCast Update 13th Aug 2018

Development Update 13th August 2018

SphereCast all the way!

I enjoyed sharing my work on the character controller recently, so much so that I wanted to share another mini-tutorial with you about the game’s third person camera and the way it collides with obstacles in the world!

This update has been a long time coming, since the camera was in an acceptable state for a long time, it never felt like it was too urgent to fix just yet. That said, it had a pretty glaring issue with the way it was detecting collisions, using RayCasting. The camera would work 80~90% of the time quite well, but the rest of the time would shake and judder at its collision point. The main technique I used to fix this issue was switching to a thing called SphereCasting.

Now just what is RayCasting and SphereCasting? RayCasting involves drawing a line (a ray) from an origin point in a specified direction. Upon intersecting with a collider, it returns a RayCastHit with information about the point of contact with the other object. SphereCasting is similar, but where as RayCasting looks at one point, SphereCasting draws a sphere out from an origin point along a specified path direction.

It might be hard to understand (certainly hard to explain!), but I found a fantastic visualization posted on Reddit from an unfortunately deleted user. Check it out here: https://www.reddit.com/r/Unity3D/comments/45oj0c/visualization_of/

So, how does this work in CyberThreat? In CyberThreat, the camera is set to orbit around a camera target object. A SphereCast of a set radius is drawn from the target to the camera, for a max distance that matches the camera’s resting distance. Any detected collisions are returned, and the distance to the collision point is used in updating the camera’s distance to the target.

A glimpse of it in action! So much smoother…

Why is this better than RayCasting? SphereCasting is able to “catch” more collision points within its radius than a Ray, which only looks at one point. This means little crevices or gaps aren’t an issue when detecting collisions anymore.

The red wire sphere represents the area to detect collisions around the camera. Collisions between the camera and the target are also caught along the SphereCast.

So the main collision detection looks something like this:

RaycastHit hit;

Vector3 start = TargetLookAt.transform.position;
Vector3 dir = this.transform.position - start;

Ray x = new Ray (start, dir);

Vector3 closestHitPoint = Vector3.zero;

if (Physics.SphereCast(x, radius, out hit, distanceMax)) {
	if(!hit.collider.isTrigger){
		pointOfContact = hit.point;
	}
}

Something that tripped me up for a while is remembering to account for colliding with Triggers! The SphereCast will catch them too, so remember to check whatever the hit point is attached too to see if it’s a collider or trigger!

And that’s pretty much it for now! Hopefully if you’re stuck in a similar situation where RayCasting just won’t cut it, that this can help. There’s a lot more that can be done using SphereCasting than just camera collisions, I look forward to experimenting more with it!

If you haven’t already, make sure to like the CyberThreat Facebook page and follow on Twitter for more updates!

Facebook: https://www.facebook.com/cyberthreatgame/

Twitter: https://www.twitter.com/cyberthreatgame/

Also join the official Discord server! https://discord.gg/AkxtGNQ

Before I go, a sneak preview for a future update…

Battle Menu Wheel! Because UI can always be improved too!

Thanks for reading!

Conor

CyberThreat’s Website – Future Updates

The last one kinda came out of nowhere, didn’t it?

If you’ve been following along with CyberThreat for a while, you’ll know there are few websites that change quite as much as this one does! Checking out old snapshots of the site using the Wayback Machine is a trip, check it out if you want: https://web.archive.org/web/*/cyberthreatgame.com

With this iteration, I tried to simplify the website by making everything available on one page for the time being, not including articles. That’s right, this website layout too is just another stepping stone towards another iteration! In this post, I just wanted to layout some of the features I’ll be implementing, and some of the reasons for them. I know, not the most exciting blog post in the world, but if I can improve the site again I hope to give you even more reason to check it out every so often!

Contact Form

Important one to have, after a lot of spam started to get through to my email I had to shut down the previous contact form. It was strange though, these spammers were dedicated enough to fill out the captcha and all the required fields just to send some pretty obvious spam through. I was a little impressed honestly.

Anyway, a new and improved contact form is on the way, taking on a lot of feedback about the UX of the last one too (some people mentioned it wasn’t at all clear if the message had been sent, all will be addressed!). I’ll still require captchas and other required fields to minimize spam and any time wasters, but hope to still make it easier to get in touch overall.

Character Pages

One of my favourite website experiences of all time was way back during the lead up to Super Smash Bros. Brawl. I remember checking the website daily for new character announcements, and getting so excited when new information was released, and that’s exactly what I hope to achieve with CyberThreat’s character pages!

Each character will have an individual page with a short description in future, to be released periodically. No spoilers of course, everything described will be told to you towards the start of meeting the characters in the game. I can’t wait to be able to share more about my favourite characters in the world with you! Until then, there may be some artwork teases along the way…

Now who could that be…?

Media Viewer

A proper way to view screens and videos without having to leave the page! Working on a nicer drop in window that’ll make it easier to see new screens and media as they come in.

And More!

More individual pages, more media to be shared, better layout of blog posts, etc. There’s a lot to be chipped away at, secondary to developing the game of course.

And that’s it for now! I wanted to write this piece since the last website update went by without me making much of a fuss of it. It’s fun to see the website grow as the game does, and as I do too as a developer and designer!

If you haven’t already, make sure to like the CyberThreat Facebook page and follow on Twitter for more updates!

Facebook: https://www.facebook.com/cyberthreatgame/

Twitter: https://www.twitter.com/cyberthreatgame/

Also join the official Discord server! https://discord.gg/AkxtGNQ

Thanks as always for reading!

Conor

That’s write, it’s a Writing update!

Just a few more pages I swear…

When it came to starting work on CyberThreat, one of the main things I neglected to take as seriously as I should have was the writing. To the average sane person, it should be priority #1 number one for a text heavy RPG, right? Especially one where the story is told in a visual novel format… Right?

I hate to admit it, but I was very arrogant about the game’s story at first. “It’s fine, I know the story in my head, I’ll write it as I go”, etc. I’m sure you can tell why this was a pretty bad idea to say the least. Throw 20+ individual side character stories in and you’ve got a stew going! Wait no… You know what I mean.

CyberThreat’s story is something special. I promise that’s not arrogance, I can feel it that there’s a special story to be told here, it just needs to be done justice. Writing can be such a daunting task, the fear that I won’t be able to communicate the story the way it deserves is crippling at times. Sometimes it’s easier to take the “easy” way out and just keep chipping away at other parts of the game.

To actually be able to approach the story at all, it needs to be done in manageable chunks. As soon as I started writing out broad summaries of what happens for each character, and for the story overall, writing became so much easier and more inviting since I could see in text exactly what I wanted to accomplish. It’s still a tough task at times, but one that’s just as important as any other aspect of the game.

So the main take away from this piece (rant? vent? I don’t know what it is anymore!) is to not make my mistakes, and to treat writing in your games and projects as importantly as any other part of it. Summarize the story you want to tell and then flesh it out.

The point I wanted to get across in this post is one of reassurance to the many people waiting for the story to actually come together. (Hello Voice Actors, Translators and Story editor, I swear good things will be coming to your inboxes soon!) The side stories are better than ever, and a lot of them are coming towards their final states at last. The main story will take a little longer, but again is in a better state than ever before.

As always, if you haven’t already, make sure to like the CyberThreat Facebook page and follow on Twitter for more updates!

Facebook: https://www.facebook.com/cyberthreatgame/

Twitter: https://www.twitter.com/cyberthreatgame/

And as a bonus, why not join the Discord channel? It’s fairly quiet right now, but I’d love to try and inject some life back into it sooner rather than later! https://discord.gg/AkxtGNQ

Thanks as always for reading my writing about my… er… writing!

Conor

Character Controller – Update 5th Aug 2018

Development Update 5th August 2018

Sooner than you thought, huh?

After yesterday’s development update, I wanted to start strong with keeping you up to date with CyberThreat’s progress from now on. I also received some pretty great advice from a friend about some tips on marketing, so I’d better follow them! I might not be able to post every day, but I’ll do my best to share what I can when I can!

I’ll try to explain things as well as I can in an understandable way so anyone can get the gist of things, but I’ll be sure to mention the more technical aspects for other game devs and programmers to hopefully follow along with too. We indie developers have to help each other out after all, right?


One of my testing scenes. Ain’t it… uh… beautiful?

Character Controller

A character controller is pretty much what it says on the tin, a way of moving a character gameobject around a scene. Uniy provides a CharacterController component for use right out of the box, with an in-built collider we can modify to wrap around our character.

Up until recently, CyberThreat’s character controller was custom made, meaning it didn’t use this component at all. Instead, it used an array of rays (invisible lines extruding from the character) to detect collisions with other objects. This was an “okay at best” approach since the character would stop quite suddenly when colliding with another object. This lead to an uncomfortable gameplay experience when navigating tighter spaces (eg: Doorways, the horror!).

So why switch to using the CharacterController component? Well it’s much nicer to work with for one! It works really well with only a little additional code to get things working properly. Collisions are handled much better and allow the character to “slide” along collisions rather than stop abruptly. The main trick is getting the movements to work relative to the camera rotation. Once I figured it out, everything else fell into place!

The key snippet of code is this:

Vector3 temp = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
Vector3 moveDirection = temp * Time.deltaTime * moveSpeed;
moveDirection = Camera.main.transform.TransformDirection (moveDirection);

_controller.Move(moveDirection);

Where _controller is the CharacterController. More can be read and understood over on the official Unity Scripting API manual here:  https://docs.unity3d.com/ScriptReference/CharacterController.Move.html

You can see that the move direction is modified to be relative to the main camera’s transform properties. Without this, movement is always in the same direction no matter what way the camera is facing.

Using this, I was able to get a much simpler, nicer character movement controller working. It was useful to have written my previous controller from scratch since I learned a lot about working with rays and collisions, but sometimes it really is better not to reinvent the wheel. And things can always be improved upon!

I hope that little bit of insight helps someone if they need it! It’s only a simple thing, but sometimes the simple things can catch you out.

As always, if you haven’t already, make sure to like the CyberThreat Facebook page and follow on Twitter for more updates!

Facebook: https://www.facebook.com/cyberthreatgame/

Twitter: https://www.twitter.com/cyberthreatgame/

Practice makes perfect, and I’ll hopefully get better at writing these in time, until then thanks for reading!

Conor

CyberThreat – State of Affairs August 2018

Back in action!

It’s good to be back…

Hi all, and welcome back to CyberThreat’s website! Apologies for the radio silence around here, a lot has gone on in recent months that has had an impact on the game’s development and my ability to talk about it. I wanted to give you all an update today about the current state of CyberThreat and its development, and to shed some light on what’s been going on over the past few months. Hold on to your keyboard because here we go!

Technical Issues

I’ll start with the big one, and it’s every developers worst nightmare to have happen, though I admit I managed to get off lightly. We recently had a bit of a heatwave here in Ireland where my computer unfortunately overheated and died on me. My version of Windows on my SSD was corrupted, trapping a lot of CyberThreat files on an unusable machine. Bear in mind, this happened after an extremely productive June without any real backups, so imagine the fear I felt when it seemed like everything may have been gone! Here’s some of what would have been lost:

  • ALL new 3D character models.
    • Including new characters that were never in the old style!
  • Character controller script and orbit camera script.
  • New free roam areas, including new 2 dungeons and a redesign of the school.

Thankfully, 90% of things have been salvaged, but some files were corrupted, and entire folders of screenshots and footage have disappeared entirely. The CyberThreat Unity file was also corrupted, but was luckily easily salvaged with some trickery. (I copied an old project file and replaced the Assets folder, cake!)

Moral of the story? Keep frequent backups!! Lesson well and truly learned!


She’s safe!

Would have been a shame to lose her without even being introduced…

I swear this is the last version… Maybe…

Personal Life

Nothing big, but I finished my masters degree earlier this summer, and I’m happy to say I did well in it. I’m even happier to say I’m finally finished with college, and can focus my free time even more on CyberThreat than on assignments!

My masters project was titled “Floating Buses: Optimizing bus routes and passenger allocations based on real-time collaboration”. As a quick overall summary, it involved creating an Android Application that allowed users to place ride requests to a bus system. The buses in the system were dynamically routed to best cater to the requests received and aimed to create a more optimal public transport system. I collected results on time taken and distance traveled, and compared them with the traditional bus system alternatives to see whether such a system had any merit.

Basically this thing. It worked…ish! Please don’t ask me to explain the code…

I ended up doing well overall, with an honourable mention in the poster presentation, and a distinction for the paper, and a first overall for the year. Fun fact, the power went out the day I was supposed to send the paper out for printing! I was lucky enough to get an extension but… Nightmare situation!!

Anyway, it’s over and done with for good, and I’m over the moon to be free from such an intense year of study to get back to what I love to do most!

Development Updates

The game is looking better than ever visually, graphics and art syle have finally come together in a way I’m comfortable working with, and most importantly am happy to show fully! While hopes of having new footage or even a demo have to be delayed due to the technical issues mentioned above, I’d love to share even more screenshots with you showcasing some of the new environments!

Okay, maybe a little loose with the word “new” since some of you may recognize some of the locations, but they’re constantly being improved and fleshed out to create interesting, memorable settings. Here’s a glimpse at one of the latest installations to the Japanese tourist town taken from the Unity Scene view:

Work in progress!

Merchandise

Don’t worry, I’m not jumping the gun just yet on CyberThreat merchandise before it’s anywhere near release! I’ve recently been testing different merchandise options as a potential way of generating funds for the game’s development, including t-shirts, posters and mugs so far. Nothing is planned to be publicly available yet, but it’s a pretty great feeling to see CyberThreat in other forms! Here’s a look at the most recent mug I ordered on Instagram, check it out, and be sure to follow if you haven’t!

Plans Going Forward

So I have some big plans going forward with CyberThreat now that everything is back on track properly in all respects. There’s new artwork in the pipeline, the character scripts are coming along really well with voice recording to start as soon as they’re editted properly, and even more surprises to come. As I catch up on some of the technical aspects, I want to try keep CyberThreat’s development as transparent as possible. This means I’m aiming to be more vocal once again across Twitter, Facebook, Instagram and more, with frequent updates being posted here too. Maybe even some development streams if there’s enough interest!

If you read all that, I salute you! Apologies once again for such spotty communication, I hope this clears things up and gives a slightly better idea as to where the game is right now.

If you haven’t already, make sure to like the CyberThreat Facebook page and follow on Twitter for more updates!

Facebook: https://www.facebook.com/cyberthreatgame/

Twitter: https://www.twitter.com/cyberthreatgame/

Keep an eye out, things are about to get a whole lot more interesting around here!

Thanks for reading!

Conor