• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
  • entries
  • comments
  • views

About this blog

Adventures in game making

Entries in this blog


Video and a GiF

Last time someone asked for video/screenshots, so decided to try some image recording and uploading to youtube. Hadn't done the youtube thing before, but was fairly straightforward. Time to see if GameDev embeds video or not:

Also, here's a gif:

I've done gifs before, I don't think this game shows quite as well as my turn based tank game does, though here's one with an image shader

And as before:

Available for Android and WebGL:







Still puttering away

So I still poke at my games, I just forget to post here =)

Lets see if I can sum up all the things added since last time:

Swinging Wrecking Balls
Magnets Overheat, top and bottom magnets as well.
Better tutorial message improvements
Level change message
Some image shader effects for entering the goal, and on death
The goal sucks you in now
Bowling balls

And some minor bug fixes.

Available for Android and WebGL:
Android: https://play.google.com/apps/testing/com.Ferrous.RollSwipeWin
Web: http://joshv.itburns.net/RollingWebGL/



[background=rgb(252,252,255)]This is my first time playing with Google Play Services integration with Unity. It's pretty early Alpha, but should still be fun to play, and I've got an integrated google leaderboard that I'd like to test out. I look forward to seeing your high scores on the leaderboard![/background]



[background=rgb(252,252,255)]Here's the link:[/background]



[background=rgb(252,252,255)](I should also get off my butt and try iOS, everything should work, just need to test it)[/background]



[background=rgb(252,252,255)]It took a bit more work than intended, the plugin has lots of steps, and there was some mystery compiler errors along the way that had to be deciphered.[/background]


I need to fix the audio, (including the audio options menu), add a way to view the global high scores without dying first, tweak more sounds. I think I want to remove the rocket turret, though if I could make some art for it instead of the placeholder rocket it might work better. And bugs of abound, of course.


So with limited time, I decided to laser focus on just one thing, and that was optimizing my radial pathfinding. Honestly, probably didn't need to be the focus, but when you don't have a boss, or a time frame, might as well follow your passions.

So, first thing of course, was to profile things. Which is relatively easy to do in Unity, though their profiler's UI is really awful, after going about 10 calls deep, it starts to choke. And this is 100% the ui, not the recording, as it's while digging into an already recorded trace while the game is not running. I even ended up moving some of my code around to avoid the problem, which is sad.

Anyway, some easy fixes stood out. For checking a dubin's curve, which consisted of a start arc, a line and an end arc, I was checking in that order to determine whether they crossed any tiles. And well, arcs are more expensive to check than lines, and if one is blocked anywhere, the path is invalid, so I swapped my if to check the line first. I also noticed that there was a lot of memory allocations happening, and moved many of my smaller classes that were mostly data to structs. That had a consequence though, structs of structs in the crappy version of mono that Unity uses (seriously Unity, why don't you update, I also would like to use C# 6.0 features), cause a str.memcpy to show up in the profiler every time there is a copy. Now it might just be an artifact, as it's not showing up as taking a large percentage of time, just annoying that it's showing up at all.

Also, to improve memory, I moved to pooling my visited nodes. I also decided to dig into the priority queue I was using. It's Blue Raja's Queue. Which is mostly good, it just has a lot of features that I don't really need. For example, each queue node has a double priority, a long for 'InsertionIndex' and an int for the QueueIndex. The InsertionIndex is to prevent ties. You're supposed to then inherit from his structure and have your own data for the visited node.

I simplified that down to a float Priority and a unsigned int for the QueueIndex, and an int for an index into my visited node pool instead of inheriting. For tie breakers, since I always start at 0 in the node pool, I multiply my priority value by 10.0f and add nodeIndex/NodePoolSize. It's crude, and if my floats got big enough, could possibly run into issues, but that's unlikely considering the size of my navgrid. So my PriorityQueueNodes are more compact and take less comparisons when doing cascades up/down:return (higher.Priority < lower.Priority || (higher.Priority == lower.Priority && higher.InsertionIndex < lower.InsertionIndex));Mine is:return higher.Priority < lower.Priority
I also moved away from an array of Nodes, which contained all sorts of data about them, to simple boolean array of Open/Closed nodes. Eventually I may need to change that to something more complex, to more accurately reflect nodes that cost different amounts to move through, and to take account of different costs between Node0 To Node1 and Node1 to Node0. (aka, not just nodes, but edges) but for now, what I have is good enough. I also trimmed out unnecessary data, ie, don't keep the index of the node in the array, that's just wasteful, I also dropped keeping the position coordinate, and calculate it every time I need it, as it's relatively cheap to calculate on a uniform grid.

Anyway, so on a Deep Profile, which is really slow, I am able to pathfind across my map in about 300-400 ms in the Editor. Considering I started around 1200-1400 ms, that's a pretty decent improvement. And outside of the editor, a windows 64 bit executable is screaming fast to calculate. WebGL is still slow, I'm guessing the conversion isn't as good, and there are other oddities as well, like my camera controls don't work the same.

I'm tempted to try it as a C++ DLL and see if I get any further improvements. There would be some small benefits to doing so, and the managed to unmanaged barrier would be minimal, since it's only at the start of the pathfind.


Long time no post

I got sidetracked by life for a while. Then I tried to integrate google play services for the leaderboard and somehow broke my Unity project. (Fun times) That kind of killed my drive. That and adding sounds, I found to be mind numbing. I don't like the sounds I have now, I find the saw noise to be too grating on the ears.

Anyway, here's a updated link:
I have an APK if anyone wants to try it on their android phone.

I also got sidetracked trying to optimize my radial pathfinder, I'll post about that in a separate thread/article/post/entry/whatever.


I should show my progress

Okay, it's been a bit, I've been having a devil of a time getting a long enough block of time to both code some stuff, and update my journal. So I've been usually defaulting to just coding =)

Anyway, here's the latest webGL version.

I still need to do a tutorial / control explanation, a web based high score table, sounds, a credits page, and probably should get some real graphics, those you see are all free from the asset store. I need to double check the license on the font, I may need to swap to something else. The turrets are also a little buggy, and I want to delineate the obstacles (easy, medium, hard) so they come in a little more gradually. (There is code in there that every 5 levels, it spawns all the same type of obstacle)

I also should try making an iOS build, the Android one runs great.

Swipe / LMB + drag to create roads, coins add score + time, get to the swirly vortex to get to the next level.


The GameObject Pooler

So another fellow was doing a journal and was a little nervous about posting code for review. It got me thinking that I should post some code up as well. (I do have a game update that I could do as well, but I'll save that for later)

Anyway, my game spawns a lot of random levels that are populated with random amounts of game objects, and rather than use GameObject.Instantiate and Destroy repeatedly, I decided to pool the objects and re-use them. I looked around online for free ones, saw someone posted theirs, but... I didn't like it, but it did give me a good base to strip out and make my own:[code=js:0]//This is a heavy modification of the original code found here: http://forum.unity3d.com/threads/simple-reusable-object-pool-help-limit-your-instantiations.76851/using UnityEngine;using System.Collections.Generic;public class GameObjectPooler : MonoBehaviour{ // TODO: I could probably re-work this to get rid of the singleton public static GameObjectPooler Current; //A public static reference to itself (make's it visible to other objects without a reference) public GameObject[] prefabs; //Collection of prefabs to be pooled HashSet prefabSet = new HashSet(); // internally we use this, makes it easier to programmatically add other prefabs to the pooler if we want Dictionary> pooledObjects; // key = prefab, value = list of pooled objects Dictionary instancedPoolObjects; // Key = instance, Value = prefab public int[] amountToBuffer; //The amount to pool of each object. This is optional public int defaultBufferAmount = 10; //Default pooled amount if no amount abaove is supplied GameObject containerObject; //A parent object for pooled objects to be nested under. Keeps the hierarchy clean void Awake() { //Ensure that there is only one object pool if (Current == null) { Current = this; } else { Debug.LogError("Attempting to spawn a second GameObjectPooler!"); Destroy(gameObject); } //Create new container containerObject = new GameObject("ObjectPool"); //Create new list for objects pooledObjects = new Dictionary>(); instancedPoolObjects = new Dictionary(); int index = 0; foreach (GameObject objectPrefab in prefabs) { int bufferAmount; if (index < amountToBuffer.Length) bufferAmount = amountToBuffer[index]; else bufferAmount = defaultBufferAmount; AddPrefab(objectPrefab, bufferAmount); // Go to the next prefab in the collection index++; } } public void AddPrefab(GameObject prefab) { AddPrefab(prefab, defaultBufferAmount); } public void AddPrefab(GameObject prefab, int startPoolSize) { if(!prefabSet.Add(prefab)) { Debug.LogError("Trying to add prefab that already exists in the GameObjectPooler"); } pooledObjects.Add(prefab, new Stack()); for (int i = 0; i < startPoolSize; i++) { CleanPoolObject((GameObject)Instantiate(prefab)); } } public GameObject GetObject(GameObject objectType) { Debug.Assert(pooledObjects.ContainsKey(objectType), "objecttype: " + objectType.ToString() + " not found in pool, did you add it to the GameObjectPooler?", objectType); GameObject returnObj = null; //If there are any left in the pool... if (pooledObjects[objectType].Count > 0) { GameObject pooledObject = pooledObjects[objectType].Pop(); pooledObject.transform.parent = null; returnObj = pooledObject; } else // I am just always allow growing, TODO: Grow by more than 1 at a time. { GameObject obj = Instantiate(objectType) as GameObject; returnObj = obj; } if(!instancedPoolObjects.ContainsKey(returnObj)) { instancedPoolObjects.Add(returnObj, objectType); } returnObj.SetActive(true); return returnObj; } public void PoolObject(GameObject obj) { CleanPoolObject(obj); Debug.Assert(instancedPoolObjects.ContainsKey(obj), "Object not found in pool: " + obj.name, obj); pooledObjects[instancedPoolObjects[obj]].Push(obj); instancedPoolObjects.Remove(obj); // this causes a bit of churn, but is handy for keeping track of all instances over pooled } // Be very careful with this. If anyone is holding any references to a pooled object, things get wonky public void PoolAllObjects() { foreach(var key in instancedPoolObjects.Keys) { CleanPoolObject(key); pooledObjects[instancedPoolObjects[key]].Push(key); } instancedPoolObjects.Clear(); } private void CleanPoolObject(GameObject obj) { //obj.SendMessage("OnClean"); // OnDisable gets called intrinsically obj.SetActive(false); obj.transform.parent = containerObject.transform; }}


Going Mobile

Oh, updated the webgl one, that link is here: Seems to work in Chrome now, yay. But oddly, it errored for me in FireFox at first.

So lets see, since last time, I have:

Added a local scoreboard
Added some extra obstacle types
tweaked some physics
drastically reduced the time to remove a swiped brick that is touching the player, color them based on the time left, and have it fall instead of just disappear.
Added a cheesy spark effect. (not sure what I'll do with that one yet)
Added a +X to show the amount of score/time that is received from a coin. (it combos, +1 for the first +2 for the second, +3 and so on)

And I've built a win10 version, and tried it out on my win 10 phones. So far, so good. Though the high DPI on the Lumia made realize that I needed to tweak my Canvas settings, as all my text shrank down to really squinty levels. I was happy with the performance, super smooth on the Lumia 950, though that thing is a rather beefy phone, so I would have been disappointed if it ran poorly. I need to test on an android, I'm downloading the SDK right now, and we'll see how it does on my less high powered slate.

I want to look into doing Unity Ads. I'm thinking of a scheme where the player gets an additional 15 seconds to their timer if they watch a 15 second video. Which they can do once per game attempt. It was either that or something like let them unlock another player sprite, with different physics properties, but then I have to add a bunch of things to unlock. I'm a little bummed that Unity Ads aren't supported on Win 10 though. I may have to look into doing Banner Ads or something with the UWP SDK stuff

I also want to do a server side high score -- I started looking into it, but all the various editors I found for creating an SQL table crashed on install...not sure what that's about, I know my machine is a little wonky, so I may have to do something drastic like upgrade to win 10.

And I should do a tutorial like level, something with some text explaining swiping to create, and some text about coins.

I also really need to look into finding an artist or paying for some assets, or going the glowy route.


Okay, so I fell off the coding wagon, and found it a bit intimidating to jump back to the big TBS game. I decided I'd ease myself into it by playing around with a quickie simple game, and learn more about the process of putting it up on an app store. (Of various flavors, I might try the Win 10 store first, I dunno)

Anyway, so without further ado, here's the prototype of RollingSwipe

Firefox/WebGL link. EDIT: Also works in Edge, whaddya now, though I didn't see any UI.

Old school webplayer, best with IE: Link

A quick how to play, since I haven't put that in there yet:
Goal is to get the tire into the center of the vortex, you can do that by swiping to create ramps for it.

The coins give both score and time. When time runs out it's game over. Falling off the world respawns you at the beginning, but otherwise is no penalty.

PS. Slightly annoyed that Unity can't manage to make a WebGL exporter that works on anything other than FireFox. But then again my project might be screwed up somehow? I noticed early that I was getting a bunch of crashes outside the editor because none of my UI canvas elements had a default material. Not sure if that's something to do with setting myself up as a 2d project or what.

TODOs: Need sounds, some fancier graphics, some animated text increases, some better coin pickups, and more obstacle types.

I'm pretty happy with my GameObject pooler, I started out looking at a free one online, quickly realized it was terrible, and completely rewrote it. But it's nice in that beyond the start, there are no game objects being instantiated (unless starting pool sizes are exceeded), and everything is being recycled.


Low hanging fruit

I updated the web player here, though Chrome I think disables plugins always now (works in IE, dunno about FireFox or Edge). But the last time I tried the webgl exporter, things were kind of funky and off. I'm not shooting to make my game as a web game anyway, but it is nice for showing other people my work. Though there's always youtube and Gifs.

So this time around, I decided to do some small stuff. I implemented clamping of the pitch of the gun, changed the gun to move towards the players targeting cursor at it's own rate, instead of just setting it to the cursor, did some smoothing on zoom / FOV, and futzed with some of the internal colliders, though I still need to go in and add the rest. Not sure how best to represent the turret ring, I'll probably have to make a set of small box colliders in a ring shape.

I need to do a cleanup pass at some point, there's some dead code, and some messy code.

Protip of the day:
Paste as New context menu from the component view....yeah, don't try to do that if the thing your pasting has a component requirement that isn't met. Crashes Unity. I filed a bug, though I'm guessing it's a known issue, seems like it should be common, right?

Playing with GIFs

Okay, so I've been doing a lot of mucking with the bullet cam, the damage system, etc. Lots of little stuff, haven't really gotten to dig into new features. Lots of tweaking of underlying things, trying to come up with not super ugly code.

Also here is my first attempt at showing a GIF
(I need to play with the the timescale curve a bit more I think, the more I see it, the more I notice a bit of a jump in time after the penetration.) You'll see some cylinders on the inside, those are crew member stand-ins. sooner or later I should go about learning how to get a hold of a basic human model in a static sitting pose.

That was from a free gif from flv site, IMGFlip, though the framerate isn't that great. I may have to look into youtube next. I'm fairly impressed with the tool I was pointed to for recording the video: https://obsproject.com/ It was free, and pretty easy to record.
Okay, so I have to admit, I dig the WarThunder Ground forces kill cam. And I'm attempting a rough duplication of it here. I'm learning a lot about shaders, rendering things always on top, and about the Animation class in Unity. Though I was a little disappointed by swapping materials through animation, this seemed broken, and I don't know why, other than in code, you have to swap the entire material array, and not just an entry at a time. (If it's broken, they shouldn't expose it...)

And I still don't like what I have here. I like the bullet outline, that's handy, it also always renders on top. I like the glow effect, but I don't like how it's the entire hull, which is what's getting penetrated here, i'd rather just show the surface portion that was penetrated. I might have to see if I can dig into all the vertices and do something, or maybe just give up and play a particle effect.

Anyway, I also fixed my turret turning slightly, i'm casting a ray from the muzzle to the target and setting the rotations on the turret that way, but introduced more bugs with it, silly PzII main gun being off center turret threw off my math. I'll have to do something there, maybe even mild IK. Though I'm tempted to cheat and just move to first person mode. I still need to finish remapping the collision texture I use. I've colored about 1/3 of it, and need to go in and assign armor values for the rest. It's boring work though. I also need to clean up the end of the bullet cam, it leaves things in a messy state, and do something about the timescale I have currently set. Ideally it would do some lerping between start and target. I could just get rid of gravity entirely and do a raycast to see what gets hit, or fire a phantom bullet first at full speed to see what I hit, then use an AnimationCurve to adjust the timescale as the bullet travels.

And Unity Physics never fails to disappoint, it seems to do all sorts of weirdness. Okay, I get not handling a projectile that's travelling at 1000 m/s, but even after lowering that to 250 m/s and lowering the gravity on my shell by the 1/4 as well, in a sort of pseudo time scaling, I still get strange collision behavior. And upping the solver iteration count and lowering the Fixed Timestep doesn't completely alleviate it either, though it does make it better. I've already marked the shell as Continous and tried both Extrapolate and Interpolate.

And then there's the setting to think about. I'm trying to justify WWII tanks and some sort of X-Com or Pirates like gameplay, with the player accepting missions for different factions and controlling a small hodge podge force of two tank platoons, with possibly some support infantry, if I can swing it. (or i could try to toss the WWII trappings)
So I finally got around to uploading a new prototype to the web for people to look. After doing all the work for the pathfinding with a turn radius, I didn't really like any of my initial schemes for then turning the turret toward a target, aiming at a specific spot on the target, calculating cover (I thought about render to texture for a fuzzy analysis, I'd done it before in an XNA prototype). So, I thought about doing it Valkyria Chronicle style, and here's the attempt. It's still really rough around the edges.

Basic Controls:

In movement mode (default):
Left click to select a tank, right click to select a new location, hold down right click to choose a final direction. You can also click and drag the transparent tank to move the destination around, or click and drag the arrow to change the direction. Click the Checkmark button at bottom center to confirm a move, or left click on the ghost tank.

In attack mode (after hitting the attack button with a tank selected)
Mouse look, mousewheel zooms, left click to fire, right click to back out to movement mode. This mode is still rough, I want to give a meter of turret rotation points, limit the up/down, add inaccuracy depending on the movement mode selected on the tank.

And of course, damage modelling. There is almost none. I've added track colliders =) Now it's pretty snazzy what I do have, I check the armor at the point of impact, adjust the armor thickness based upon the angle of impact, and adjust how far the shell will continue to penetrate after impact based on how much penetration value remains. But you wont' see any of that, because, as I said, only the tracks have colliders, and I also don't do anything with that info...yet.

My basic plan there was to add a collider per point of interest, but that got kind of messy, I think I'm going to move to a texture map. I don't' have a simplified hull, so that's going to kind of suck for perf, but oh well, turn based. Though I suppose I should learn to use a modelling program. After modelling the armor/collision model, I also need to add some components inside, like the engine, crew, etc. I also need to model HE / HEAT, etc.

*Also, the tank is just some freebie one from the Unity Asset store. I still haven't decided if I should go sci-fi, or try to come up with a setting that involves WWII era tanks.

So I added multiplayer, [color=rgb(0,0,0)][font=Helvetica]

the UI is the default garbage Unity GUI, but it works and its easy, so it'll do for now as a quick placeholder to get to the new stuff. I also have a slider for the number of bots. I'm particularly happy that it supports dynamic joins, updating the map destruction for new players.



Now the downsides:


1. Colors are not synchronized over games (I should do a hardcoded list of good color and distinctive colors, or pass a seed, was lazy, it's just random values)


2. It's damned hard to find yourself in a 8+ player game, I should add some sort of effect, even just a light.


3. The AI gets confused when it gets too close to other AI. (actually a collision/movement issue)


4. I don't handle disconnect messages


5. Or have a way to restart a game


6. Or have a way to set the port (just a matter of adding the UI)


7. Or have a way to name yourself (or chat).


8. I don't have a win condition.



I need to test the synchronicity and smoothness, as it's client/server, but I only have the players instantiated as network objects, and even they don't pass info, except to the server. I probably need to do some smoothing, I think.


So this is a remake of an old Atari game: http://joshv.itburns.net/MazeWar.html


The basic ruleset is you can have only shot out at a time, hitting a wall causes it to explode shortly thereafter, sending shrapnel in the cardinal directions it wasn't shot from. If a projectile hits a projectile, it causes a backsplash.


Still has a few things to do, player/player collision is borked, for example. I should add difficulty, number of zombies, scoring and if I really want to go nuts, I'd add multiplayer of some sort. I should probably try adding mouse controls, and maybe do some actual AI, the current zombie is really simple (doesn't even really do pathfinding, though I don't believe the original game had all that much either, it mostly speed up their move speed.


The original game, by Mark Price is here:


Alright so http://joshv.itburns.net/WebAttempt.html has been updated with some help text to help guide users. If anyone finds it too terse, confusing, or anything at all, feel free to let me know!

I've also updated my path planning with a minimal turn radius (http://joshv.itburns.net/RadialAttempt.html), fixed a bug, and some other general performance improvements. I still need to add the width test, as you can pass through diagonals, and the routes will cause the object to penetrate the walls on the sides.
So, a while back, I decided I wanted to make a game using Unity, to get my feet wet in it. I wanted something fairly simple. So I went with a Tower Defense game. But of course, I had to put my own spin on it, by making everything physics driven. No hitpoints! To defeat the creeps, you have to push them off of edges, into the infinite pit below.

Anyway, here it is:

I'm using NGUI (demo license), arongranberg.com's pathfinding (overkill, really, but I just wanted to get up and running quickly), and using open source sounds ..mostly, I need to replace some that aren't.

Honestly, I think it was probably more fun to program than it was to play.
Sign in to follow this  
Followers 0