Categories
entity systems

Support me on Patreon for early access to new Entity Systems articles

I love researching and writing about Entity Systems, but it takes me days or weeks to make a single article. I’ve written almost nothing for the past 18 months because on my current salary I can’t afford the time off work.

So … now I’m crowdfunding the long, detailed, in-depth ES articles. This gives me a way to spend the time I need to write each one while still paying rent, food, etc.

You don’t have to sign-up – I know there’s lots of people like myself who are in bad financial situations, and I hope all the articles will be made free eventually. But if you’ve found my ES articles useful, and you want more of them, and you can spare $5 once every couple of months, please do.

You can sign up here: https://www.patreon.com/tmachine

Categories
games design

Brief look at obvious #UX mistakes in Civilization 5 (and why you should never buy another Firaxis game)

Civilization was one of the best games ever designed and shipped.

Civ5 is tragic. It’s one thing to launch a AAA title full of nerfed gameplay and obvious, in-your-face bugs, but quite another to leave them unfixed for years after. It’s one thing to officially fix your bugs only in pay-for add-ons – but quite another to keep those add-ons at full price for years after they released.

Here’s a quick view of what’s still broken in Civ5 today, if you buy it direct in the online stores:

  • The game autosaves every 10 or so turns; this has NEVER been correct for Civilization (from memory, the original game used to save every other turn by default (maybe not; running out of disk space was a real concern back then); modern teams at Firaxis seem to be too amateurish to implement this. Civ 4 used to crash so much that putting it on “save every turn” was a requirement).
    • No-one at Firaxis should be “unaware” of the need for every-turn autosaves
    • I struggle to think of a rational explanation; best I can think of so far is some weak game-designer thinking that autosaves are “cheating”, so they decided to deliberately break the concept so it only half worked.
    • I haven’t yet found an easy way to un-break this in civ5. Given how crucial it is to the game, and how it’s been present in every previous version, it should be in the game-options, but it’s not. That’s two bugs for the price of 1!
  • The user-interface for moving units is more broken than in any version of Civ to date. Civ1 had a perfect system (but predated the existence of a mouse on every computer): units moved where you told them by pressing numeric keypad keys. Civ3 and Civ4 had “automatic” pathfinding that was badly broken: it often walked your units into 100% certain death for no reason.
    • Civ5 takes this one further: if a unit is selected and you move across another unit, civ5 moves BOTH units, causing double the catastrophe.
    • This automated action – that IME is almost NEVER what the player wanted to do, and is extremely destructive, frequently causing game-losing events – cannot be undone. This breaks the cardinal law of user-interfaces: if you do an automated, un-asked-for, action (which you generally shouldn’t) … then you MUST provide an Undo.
  • Civ5 also has a strangely bad algorithm for pathfinding: it generally takes 1-4 seconds to run the algorithm during which time the game lies about the game-rules, and claims that your unit is “immovable”.
    • This appears to be a junior programmer discovering “asynchronous” coding for the first time in their life, and not realising the obvious side-effects
    • I have no idea why the algorithm is so insanely slow. It is slowest in a huge game, but even in a tiny game, with nothing happening, and only a tiny game-world, it randomly takes anywhere from no time to 1-2 seconds to “switch on”
  • The buttons for “required” actions are deliberately placed in the worst-possible positions: the far OPPOSING corners of the screen.
    • This breaks the most basic and obvious guidelines in UX design
    • For bonus points, the buttons don’t get larger on large/wide screens. Those buttons are so small and so far away you rarely see them, let alone find it easy to press them
    • It’s as if the Firaxis team were out to beers with the misguided team at Microsoft who decided that Windows 8 would rely upon a single “magic pixel” to activate core functions, and thought: “hey, I know how we can really mess-up our players! That impossible-to-hit pixel idea is great! It’ll make the game so much harder!”
  • The interactive HUDs giving critical information on the global state of politics, that made Civ4 a significant improvement over previous versions – and that were extended massively by the community, increasing gameplay without removing any challenge … have been deleted.
    • The question begs: we know Firaxis has many people who’ve played the previous civs; how on earth did they forget how critical and popular the dashboards were?
    • The game is almost unplayable without dashboards. It’s a waste of time: you have to play solo, or click through a series of menus every single turn simply to find out the current status of your opponents. A massive step backwards in gameplay.
    • Best explanation I can think of: failed game-design strategy to “make it more mass-market friendly”.

That last point leads into the legion of game-design failures in Civ5. As I understand it, most of the game was “Designed” around the idea of dumbing-down: apparently the Youth of Today are so stupid and lazy that they cannot play games that are deep, enjoyable, or interesting. The way to make money is to make games idiot-proof with as few options as possible and no meaningful decisions.

Ironically, this is the exact opposite of what the legions of Civ fans had shown they valued in the Civ franchise, via the overwhelmingly popular mods for civ4. Master of Mana added depth, difference, more depth, more variety, more difference, and yet more depth, across the board. It hacked the tech tree into becoming 5 different tech-trees, all running in parallel (WTF? Oh, yes!) – and players loved it.

One day, I may write a post on the flow of game design, successes and failures, and the #facepalm that civ3 and civ5 were (between the two of them, both abject failures). Strangely enough … the two things in civ5 that I remember the community being most afraid of (hexes and 1-unit-per-tile) … seem to have worked fine. The radical changes were a success; it was all the easy, “you can’t possibly screw this up”, parts that the dev-team screwed up. And that is why I consider civ5 “tragic”: they got the hardest bits right, despite the odds … and tripped over their own shoelaces messing-up the easy bits.

Civ4 had a similar trajectory, with two differences:

  1. It appeared to be a legitimate mistake: they didn’t realise until after shipping how broken their own game was
  2. Within a couple of years, the add-ons were being bundled with the core game for free, or at most five dollars. As they should be: they were mostly re-adding content that had been removed, and fixing launch-bugs, with only a tiny sprinkling of extra content/changes.

For Civ5, someone in charge (publisher? studio director?) appears to have decided: “hey, we shafted the consumers and exploited the franchise well there – but we could do so much better! Let’s do it deliberately this time: save money by deliberately shipping incomplete product, then use online market-controls to force everyone to pay 3 times to get a working game! We’ll be RICH!”.

In their defence, Firaxis did ship one major content update for free, which was wonderful: they added retina support. That’s unnecessary (not a bug, retina’s didn’t exist when it came out) and nice to have – but in no way justifies ignoring the rest.

Categories
entity systems Unity3D

Simple #unity3d bugs and flaws fixed by Entity Systems – number 1

I periodically write massive long documents detailing all the bugs in Unity that I know, have memorized, and have to workaround on a day-to-day / hour-to-hour basis. But it makes me so angry and frustrated – so much terrible coding, so little technology-leadership at the company – that I end up deleting it. Life is too short to be daily reminded how crappy (and yet easy to fix) our tools are.

Then, every 6 months or so, when people ask me for simple examples of how ECS’s fix Unity, I have to wrack my brains for something simple.

So I’m going to start blogging simple examples as I run into them, with only enough context for me to understand them. Here’s the first…

Categories
computer games dev-process games design

BlobBlobBlob screenshots

New prototype I’ve been playing around with…

Screen Shot 2015-10-06 at 23.11.43

Screen Shot 2015-10-06 at 23.40.22

Screen Shot 2015-10-06 at 23.57.34

Screen Shot 2015-10-08 at 19.40.00

Screen Shot 2015-10-08 at 19.45.08

Screen Shot 2015-10-08 at 23.11.50

Screen Shot 2015-10-09 at 01.26.21

Categories
PHP usability web 2.0

How to get an awesome tag-cloud for WordPress

There’s only a few tag-cloud plugins that still work – most of them have stopped being supported.

The best one I found has super-awesome-multi-colour mode. But by default it’s disabled, and the config-options don’t include a way to turn it on. You have to dig in the developer documentation to find out how.

Categories
Unity3D

Unity: the “real” version 5 just released (#Unity3d 5.2 fixes many severe issues!)

A new version of Unity is now out – https://unity3d.com/unity/whats-new/unity-5.2 – and it’s a doozy.

I don’t normally blog a blow-by-blow account, but this set is particularly interesting.

It suggests the tech team has been focussed on fixing many “critical but un-sexy” problems. That is a noticeable change in direction from the past few years. Possibly this is a one-off to get Unity 5 working properly.

If you’re still using Unity 4.x, it is finally safe to move to Unity 5.

Unity 5 is not a complete replacement for Unity 4 – there are still major featuers of 4.x that have been removed from Unity 5 and have no upgrade-path – but it’s finally production-ready (or very nearly). That … is big news!

Hilighted improvements / fixes / changes

Please note: there will be a lot of negative comments here; that is inevitable, considering most of the change-list is “things that were broken, or wrongly implemented, or poorly designed – and are now not”.

To be clear: I’m pleased and excited by the overall shape of these changes.

Graphics: Added CullingGroup API, which allows you to specify a large set of bounding spheres that are integrated into the culling pipeline and subjected to frustum and occlusion culling

Unity has (amazingly) never had built-in culling accessible by developers, which is almost unheard-of in game-engines. This suggests we’re getting towards it (although spheres are only a first-approximation for culling, and I wonder how deep the interaction is with Unity’s pipeline here. I’d assumed we’d get access to something more like BSP)

Application.UnloadLevel. Unloading scenes is now possible while the game is running. References to lightmaps are cleared but you have to call Resources.UnloadUnusedAssets() to actually unload them.

Scenes in Unity are very much FUBAR as a concept – they were created by people who had very little understanding of computer-game design and development. Ideally, we’ll see Unity remove the whole “Scene” concept in a future major release, but in the meantime this is a significant step towards reducing their weaknesses, which is good to see.

Layout elements under a ScrollRect component may not work properly

No s***, Sherlock! Yeah, most people using Unity’s “new GUI” have found it’s fundamentally broken in a bunch of places. Good to see Unity working on this, and hilighting some of the issues – but really they need to create an entire webpage listing “the following parts are broken, don’t use them – or beware if you do”.

Right now, you tend to waste hours, half-days at a time … re-discovering known bugs in Unity’s GUI.

Scene view picking in linear color space does not work for DX11 when MSAA is used (quality: fantastic)

If you’re on Windows and have the highest quality settings, this is lethal: Unity simply doesn’t work. But it’s coming in an emergency patch very soon.

Mecanim: Playable API.

If this does what I think it does, then it was essential back when Mecanim was released (3 years ago); glad to see it’s finally here.

between 5% and 30% lower CPU cost for rendering

That’s an enormous speed-up for an engine as old as Unity – this is big news. Reading between the lines, the speed up is partly a side-effect of them making it a bit more multi-threaded (which became normal for game engines many years ago).

If we thought that was a lot, wait till you see:…

Particle rendering optimizations (especially for VR), with speed improvements varying from 15% to 50%

… 50% performance improvement! Wow. Name-checking VR here is probably the key item. We keep seeing VR’s extreme performance-requirements forcing engine-makers to up their game, and dig deep to find perf boosts. The “minimum” hardware reqs for basic VR rigs are very high even now, several years after Oculus Rift launched.

UI now uses multithreaded batching & geometry generation backend

This was the minimum we expected from the “new GUI” when it launched in Unity 4.6 almost a year ago. This fix brings the GUI most of the way towards being “production ready” … ironically, 6 months after Unity changed their website to hide the existence of the “old (but works) GUI” and pretend it didn’t exist.

Added parameter QueryTriggerInteraction to all physics queries (raycast, spherecast, overlap) to allow any query to override whether or not the query should hit Triggers

This is patching a MAJOR design bug in core Unity that has plagued Unity for many years. I want to play with this some more, and see how much we can un-**** Unity’s ****ed ray-casting system using it.

(I don’t believe any experienced game-developer would have accepted Unity’s original design here – it was clearly a terrible approach that would cause never-ending head-aches when making games. It mixed concepts that were very obviously unrelated and distinct)

Fixed Function shaders work on all platforms now (including consoles)

This one has been blogged about extensively by some of the graphics team, IIRC.

In my experience, Unity’s shaders have been OK, with a few that were terrible (e.g. all the Mobile ones), but the framework which holds them has generally been excellent: it’s isolated us from the pain and suffering of GPU-specific shader bugs. This house-cleaning doesn’t make much (if any) difference to most of us, but apparently keeps Unity’s internal code clean in a way that will facilitate rapid changes and improvements going forwards.

2D Rect Mask

TL, DR: “we finally implemented masking properly in the new GUI”.

See previous comments on the new GUI, and how it’s getting much closer to production-ready.

UI: Dropdown control

Yes, really – Unity has finally added the “dropdown”, which has been a global expectation in UI design for 20+ years (it was made compulsory in web-browsers back in the 1990’s).

Editor: Remove legacy Mac OS X corner window resize behaviour

Apple told devs to remove this … um … about 3 or 4 years ago? At first, it was broken (couldn’t resize windows), then it was annoying (Unity added optional resizing on all edges, but put an illegal resize-hot-corner in bottom right that broke all EditorWindow code, because they made it a private API).

Working around that on Mac … forced you to mildly break things on Windows.

TL, DR: custom editors (as found in many/most of the best Asset Store plugins) will now be a little less-broken across the board.

Substance … All crashes and hangs at build time, level load/change time, playmode entry/exit should be gone

Yay! I’ve not been using Substance, but I’ve met several developers who’ll be breaking over the champagne over this, given how miserable they’ve been about crashes and hangs with this in the past.

CanvasRenderer now takes a Mesh instead of List this allows for the use of imported meshs as part of the UI

Without this feature, the new GUI was not usable in most non-trivial games. It’s hard to over-estimate the importance of this for declaring the new GUI production-ready.

Allow sprites to be dragged into scene view in 3d mode

Small but sweet. It’s a little thing, but makes a big difference to the frustration level of the user; in my experience, these things are often the real reason why you sacrifice the cost-savings and benefits of your own engine and use something like Unity instead.

i.e.: with your own engine, you can’t afford the time/money to polish every small interaction; 3rd-party game-engines can shine here, and should take more advantage of it.

I sometimes mention stuff like this as suggesting that Unity’s senior management team are out-of-touch with their product. Unity’s early community loved it largely because of small things, but as Unity grew, the company stopped sweating them. I suspect time will eventually tell that was a huge strategic mistake.

Improved Export Package window (now uses a proper tree view)

This window hasn’t correctly worked for at least three years; converting it to a “proper tree view” might – finally! – make the “Export Package” function do what it’s defined to, instead of exporting the wrong things, breaking keyboard and mouse interactions, etc.

(most of the bugs appeared to be a side-effect of the non-maintained, half-implemented, custom tree view code)

Make sure ObjectField and Object Selector shows icons for game objects and prefabs

Co-incidentally, I tweeted about this recently: Unity could make their engine noticeably faster to develop with if they provided visual feedback on these fields.

It’s embarassing, almost shameful, how poor the UX is on these fields today. By the sounds of things, this patch merely makes them “less crap”, rather than fixing them – but the last 5 years has been so awful that any improvement is welcome!

Selection.selectionChange callback triggered when selection changes

To call this “important” is somewhat of an understatement.

Substantial areas of the Editor API’s are surprisingly poorly maintained by Unity. The bugs undermine people each time they try to use one of Unity’s overwhelmingly greatest features: its extensibility.

Graphics: Added a quality setting ‘Shadow near plane offset’ to allow working around shadow pancaking artifacts

If this does what I suspect, it will make it trivial to fix a lot of common, frustrating “why do my shadows suck? OMG! UNITY SUXXS!!!!” situations.

Mecanim Improvements

SO MANY.

I don’t use Mecanim: it’s been slow, clunky, buggy – and it solved the wrong problems at launch. It felt more like a marketing excuse rather than a developer feature. For me, working x-platform and often on mobile: not very useful.

However, looking at how long the list of fixes is … it might finally be worth using it. In context of all the other changes we’re seeing – maybe production-ready for general use now?

(modulo: the performance. Last time I checked, it was still way too slow for cross-platform games unless you were happy to have a relatively small number of animated objects)

Go check it out! If you’re a long-time Mecanim user, let us know what you think of this list of changes!

Now a TerrainData object embedded into a scene (created by script) allows scene objects being selected as tree prefabs

Unity’s Terrain system was implemented using a nasty, ugly hack that should never have been used.

As I understand it, that was in itself an attempt to workaround some problems with the fundamentally broken – and allegedly “unfixable” – Serialization system that is core to Unity, but is too much code for anyone to fix (and will be thrown out / fixed / replaced around Unity v6 or v7. Maybe).

This change reeks of a “workaround to a workaround”: you can’t create TerrainData in the scene (which should be the ONLY option!), but you can artifically create one if you write a script to do it for you. Either way, it’s good news – TerrainData Assets are a common source of project-corruption, because they’re abusing a feature that wasn’t intended for this.

Stacktrace logging: Allow to log full (native/managed) stack trace when log is printed, the option is available in the console window in top right corner popup menu.

OMGWTFBBQ!!!!!!!!!!!111!11111!!!!11!!!1!

I frequently discover major bugs in Unity core; there is never anything I can do about it because Unity strips / deletes all stack traces (in most cases) before outputting anything.

If this fix does what it says on the tin … WOOOHHHOOOO! … we can finally workaround Unity crashes (by debugging them!) and give Unity much more detailed and accurate bug-reports (leading to greatly increased chances of them fixing bugs).

Cross those fingers…

Fix Cursor

As I recently tweeted, Unity’s support for custom mouse-cursors was recently broken. That’s a huge pain given most games today use custom cursors. Several fixes here, looks like they’ve cleaned them all up (I hope).

Fix possible data loss on Windows when renaming folder with locked files

:O

Fix occasional recycle bin bypassing when deleting assets on Windows

:O

Serialization: Fixed not being able to serialize a field called “Base”

:O

UI: Stop disabled graphics from blocking raycasts

If this is what I think it is, it’s another example of “should have been fixed before 5.0 was released” – but I’ve had so many problems with the bad system of Unity raycasts that I go out of my way to avoid them anyway.

Core: Fixed hang when passing large arrays to the Undo system

Sounds unexciting, but … I think I’ve encountered this on some of my projects: unexplained hangs that came out of nowhere and destroyed my ability to keep working on one particular game, related to Undo.

Note: I keep saying this in public: Unity’s Undo system simply Does Not Work, it’s appallingly buggy. As far as I can tell, the person who originally wrote it had little or no experience of what they were doing, and didn’t consult the literature to find out how to implement Undo systems correctly.

Some days, I genuinely feel it would be better for everyone if Unity removed the “ctrl-z” keyboard combo, because so often when you press those letters you corrupt your game project. A lot of the time, you don’t notice that Unity has just corrupted your project – not until much later, and then you don’t realise that it was Unity’s broken Undo that caused the corruption. Instead, you blame yourself, or your co-workers. Seriously, it’s that bad.

(I’ve stopped bothering logging bugs against it)

Importing: Changes to scripts are now correctly processed synchronously, fixing a range of issues with scripts relating to asset processing at import time

Subtle, but … I suspect this fixes a LOT of bugs we see on larger Unity projects, where you’re frequently hot-loading complex sets of scripts, assets, inter-related dependencies, custom asset-processors, etc.

…the end

So that’s it. What do you think? Any other major items you notice in the release notes that will make your life significantly better?

What’s still broken?

Categories
android computer games games design games industry games publishing iphone Unity3D

#Unity3d hardware usage + implications – Summer 2015

There’s tonnes of blogs out there, so I only talk about the bits that other people have missed, or were too polite or inexperienced to cover. Often that means I’m the one pointing out the flaws (most people don’t want to write bad things. Screw that; ignoring the bad points does you no favours!).

Sometimes I get to talk about the good bits that – sadly – few people have noticed. Here’s one of those.

Categories
games design programming Unity3D

New #unity3d feature: Virtual Scenes

Unity3D has a great core architecture – it’s easy to understand and use. However, it has some significant flaws.

One of the recurring problems I run into is that Unity requirs you to have precisely one “Scene” at any one time, but often you need to have multiple scenes at the same time. Problem? Yes, lots…

Unity 5 has some hacks to make it “sort-of possible” to have multiple scenes at once in-Editor.

Note: these were mentioned by Unity corp in August 2014, but aren’t available to most users yet

But they (appear to be) hacks: they help for a fraction of the use-cases. That’s fine: Unity has 10 years of software written on the assumption there is only one “Scene”; that’s an enormous amount of code to change! But can we do something about this?

TL;DR: I’ll put this on the Asset Store

If you just want a working solution, here’s the Unity Asset store page / support page, new versions will appear here first.

I’m using it myself on my own projects, and will do some beta testing with other people’s games. If it works well enough, it’ll go on Asset Store. I suggest reading this full post anyway – it’s an example of how to creatively solve small issues like this in Unity.

(if you’d like to beta-test this, tweet me @t_machine_org or email me (address at top of page). Unity Corp only let me have 12 beta-testers, so you’ll need to give me some info about what you’ll use it for, how soon, how much feedback you’ll give me, etc! Sorry :( )

Categories
computer games design games design MMOG development programming Unity3D

Writing a #unity3d mini-game … to help you design a AAA game

One of my hobby projects is a testament to the Ultima and Elder Scrolls games – a massive open-world, where everything you do impacts the world around you. This has long been promised by commercial games – and it sucks from a gameplay perspective; it’s just not fun. But a very old ASCII-graphics game, Omega, showed a couple of ways of doing it that delivered on that promise while still being “fun” – very fun! That’s what I’m working towards.

It’s a test-bed for the high-performance Entity System I’m writing for Unity (more info here). I’m aiming for “gameplay considerably richer than Skyrim” with “graphics about the level of Oblivion”. To be clear: Oblivion was released almost 10 years ago! To reproduce those graphics today is fairly easy.

Challenge: Believable Cities that evolve over time

One of the things I have yet to see in any FPS RPG is believable cities, and more: cities that actually evolve. The nearest I’ve seen is the beautiful “large towns” of the Assassin’s Creed series (they represent cities, but the distances are way too small).

That doesn’t cover the “evolve” part though – even the AC cities are 100% static and unchanging. Hand-crafted, and because they cannot change (technical design choice) the player is incapable of altering them. You can’t burn down blocks, or build a new bridge. You can’t buy two houses and knock them together.

Hey, RPG industry, you can do a lot better!

This is one of the main new gameplay elements in my design. If all I managed was to take an off-the-shelf-RPG mod and add living, growing cities … I’d probably be content. What does this mean, though?

Categories
dev-process programming Unity3D Unity3D-tips

Template for #unity3d to test custom procedural game meshes

One of Unity’s dirty secrets is that (out of the box) it’s plain awful as a prototyping tool. You can fix that, but it requires quite a lot of work. I’m going to start publishing my fixes one by one. Here’s the first: a test-bed for making custom meshes.

Categories
programming Unity3D Unity3D-tips

#unity3d missing docs: EditorWindow lifecycle

If you do any non-trivial customization of Unity Editor, you’ll almost certainly extend EditorWindow. But Unity (to date) refuses to tell anyone how to do this legally, or what the contracts you’re being held to are. Without that, many plugins on the Unity Asset Store are wrong and buggy, and sooner or later accidentally cause problems for users.

Their fault? Partly, but I don’t blame them too much – rather: Unity’s fault for failing to document (and failing to test assets before approving them!).

For those of you who aren’t happy shipping crappy, broken, buggy plugins (And charging for them), here’s a guide / reference for the lifecycle of EditorWindow. Extra info, explanations, and gotchas welcome!

Docs-UnityEditorWindow

Categories
games design usability

#UX conveying critical info to public via number rating: Food Hygiene Stickers

How do you make good UX / GUI to present information to a mass-market audience with widely varying levels of education and attention-span?

This is a problem faced all the time by game designers and developers. It’s one of the most under-appreciated skills of the profession: good game developers know more about “presenting information and choices” than almost anyone else, anywhere. Because games are generally overloaded with info, and the dev teams have to filter that down and present it clearly – but if they get it wrong, the player’s in-game character dies, the game is lost, and the game itself tanks commercially. The developers then – ultimately – lose their jobs when the studio goes bust.

I’m going to start looking at non-tech examples of design and UX through the lens of game-design, and see where it goes…

Categories
Unity3D Unity3D-tips

Use shift-N to create new scripts in Unity Project Window, fast

In Unity, you create new scripts many times per day, and folders but there’s no keyboard shortcuts. I fixed this, and made the popup rather more intelligent than Unity’s built-in one. I’ve decided to make the basic version available for free here:

UPDATE: there’s a bug in the 1.0 version – it WILL NOT WORK if you set your Project window to 2-column layout. This is due to BUGS IN UNITY (not my code!). I have a workaround that’s in the Asset Store version, but is missing from the free version. I’ll patch it later

FreeIntelligentNew.dll – I’m not supporting this; it’s free: use at your own risk.

Or, for $2, you can get the latest version with full source code from Asset Store – I’m supporting + updating this.

Installation

Drag/drop the DLL into any folder named “Editor” in your project.

(required by Unity; this is how they make sure that Editor scripts aren’t accidentally included in your final game)

Usage

  1. Select the Project panel
  2. Hit shift-N
  3. By default, it intelligently guesses if you wanted a new Folder or a new Script. If it guessed wrong, hit “tab” to cycle through the options
  4. Choose a name and hit Enter (like normal in Unity). Done!

How…?

This works by peeking into some of Unity’s internals and detecting which EditorWindow has focus. If it’s the Project window, it uses some hardcoded constants (which differ between Unity versions, due to bugs they gradually fix, I think) to get the positions right, and offer you the popup.

I did it this way because Unity currently provides NO PUBLIC API for reproducing some of their core Editor features (e.g. where they temporarily change the render-style of the “newly-created item” in a Unity windowpane, so that you can edit the name in-line. Not possible for you or I!)

With a bit more hacking, I might be able to hook Unity’s own code and enable / trigger / alter the hidden features from keyboard, but … that’s on the wrong side of “Fragile; would probably break unexpectedly in a future version”.

How I’ve done it so far it sits independently of Unity’s code, and is very unlikely to stop working, or to cause bugs later on. YMMV…

(if you want to know more, get the Asset Store version, read the source. I’m happy to answer quetsions via the support links or in the Unity Forums page for this)

Categories
entity systems programming

Entity ID’s: how big, using UUIDs or not, why, etc?

This has come up a few times, and I ended up replying on Twitter:

But that’s a crappy way to find things later, so I made a quick-and-dirty infographic with a few key points:

Docs-entityID

Categories
advocacy games industry games publishing marketing and PR Unity3D usability

6 ways to massively improve the #unity3d AssetStore (for #gamedev’s)

Six months ago I tweeted a handful of obvious ways that you could make the Unity Asset Store greatly more profitable.

One of the Unity folk reached out to me, claimed that Unity was highly invested in improving this and asked for specific suggestions. So I wrote longer, detailed versions of each tweet and emailed them.

It’s been six months. No response. So … for Unity’s competitors, maybe looking to make/improve their own Asset Stores (or newcomers hoping to unseat the incumbents), here’s six obvious commercial improvements.

I’ve cut a few paragraphs I wrote to Unity about who I think their 3 main audiences are on the Asset Store; I included them as a “here are the assumptions I’m making” – I have no idea what their real audiences are. So I omitted that here.

NB: I’ve made the formatting webpage friendly, added some details, but this is essentially an info dump. I was too busy at the time to sugar-coat it – I figured that if Unity wanted to talk, I’d talk to them, and in person I’m really quite friendly and gentle. But at the time we were working 24/7 getting ready for a major exhibition, so this is a bit … terse.

Categories
Uncategorized

Journalling for #entitySystems: #unity3d corrupted my scene; I’ve built a debugger for Unity!

Experimenting with shorter Entity Systems articles

This post is an experiment: rather than write massive, heavily-edited articles, I’m writing “shallow” versions first, which takes me only an hour or so. Then I’m saving the in-depth, detailed versions of each topic for future subscribers to my own Unity3D Entity System. This way I can cover a lot more topics in the same amount of time, and I suspect most people will get all they need without the deep dives I used to do.

Let me know what you think – @t_machine_org

The Unity bug that deleted my game prototype

A few days ago, I fired up my Unity3d test project for the new Entity System. All the data was serialized into Unity’s scene, everything was fine. I was expecting to see all my “registered” components (that are saved directly into the scene) exactly as they were last time:

Screen Shot 2015-05-26 at 11.23.54

Instead … I got this. Why, Unity – WHY?

Screen Shot 2015-06-07 at 21.29.31

On further inspection, Unity’s serialization system had stabbed me in the back: it combined data from two different situations (which is blatantly wrong and should be impossible – although since Unity has failed to document it … who knows what contracts it promises to uphold internally?). I’d like to know why…but the Unity Editor won’t tell me (they don’t let us see this data).

But I don’t really know what happened. Even with extensive logging, Unity lacks a solid debugger – and most of Unity’s code here runs BEFORE your debugger starts or AFTER your debugger stops. Any Unity bugs here are happening inside the invisible, opaque, known-to-be-buggy, Unity startup/shutdown routines. ARGH!

Software … has BUGS! OMGWTFBBQ!

Unity has bugs. Lots of bugs. So does all software. So what?!

Some (many?) of Unity’s many bugs sit in mission-critical parts of the engine. Rumour suggests that’s not because the devs are unaware of them – quite the opposite! – but because they’re too hard to fix. Any mistake in the fix, and it might cause more harm than the original bug (because these systems are so core).

This in itself suggests Unity’s internal dev teams maybe lacked a culture of TDD in the early days. My impression was that they do significant TDD now (yes? no?) but if it only arrived recently, then much of their code might be weakly tested or even untestable. i.e.: I try not to be too hard on them here, even when I’m suffering and there’s no help to be had.

In particular with Serialization: Unity doesn’t allow anyone to see what the bugs are. The Serialization system (along with some other super-critical-data-corrupting-bastard-evil-features of Unity – like the Undo system) has no API to let people outside of Unity corp see WTF it’s doing.

And we know it has bugs. But we can only guess at them, and how to workaround them. Unless you have a million dollars spare and can afford to purchase source-code access…?

Incidentally, this is why it is standard in the games industry to demand source-code access to your game-engine. This is non-negotiable. It has always been a black mark against Unity in professional / experienced gamedev teams that they are so secretive about their source code. It would be fine if they had a high-quality, Automatically Tested, well-documented accurate API, etc – but they don’t.

I have an idea … a new feature for my Entity System

At this point, I’ve already accidentally built quite a lot of the pieces of a debugger for fixing Unity itself. I’m recording the exact data, I’m storing it in memory in raw bytes (which sidesteps all the bugs in Unity’s undocumented serialization layers), and I’m displaying live data-visualizations in human-readable pretty colours, etc.

Enter: the Entity Systems Journal.

What’s a Journal?

If you don’t know, and you care about programming that involves data or storage, read this:
http://en.wikipedia.org/wiki/Journaling_file_system.

In the event of a system crash or power failure, such file systems can be brought back online quicker with lower likelihood of becoming corrupted.

What’s an Entity System Journal?

As many people have noticed, while experimenting with Entity Systems for their games, an ES is very easy to integrate with Event-driven programming.

You’re changing raw data which has no side-effects; that makes it very easy to write generic code that automatically converts every “change” into an “Event object” that the rest of your app / game can programmatically inspect.

With an ES, we’re going to use a Journal to record exactly what happened to your entire game-state, at all times, and in all places.

Journals in AAA Gamedev

To be clear: in an abstract sense this is nothing new, games have been doing “journalling” (But not calling it that!) since the 1990’s, when it was discovered to be a very effective way of making multiplayer / internet games run reliably while sending minimal data over slow network connections. Read about the early RTS implementations (Anything from Patt Wyatt’s blog, or the old Ensemble Studios gamasutra piece about 10,000 archers IIRC).

What makes this a little different is that we’re going to be a lot more … explicit … about it. Our Entity Journal will come with its own cross-platform API that’s easy to write tools for.

Considerations

a.k.a. “lessons learned in software design and architecture over many years and from standing on the shoulders of giants”

  1. The API itself might be best expressed using one of the API’s we’re already using to access and/or manage data elsewhere
    • aka: the “don’t screw-up like XML version 1 screwed up” rule; XML (a data langage) invented a second language to describe its data. Until they woke up one day and said WAIT A MINUTE … WE ALREADY HAVE A DATA LANGUAGE!
  2. Whatever first-class objects exist in the API need to be few, simple, and generic
    • Journals are a bit like Entity Systems: the simpler the API, the more robust and easier to optimize performance – and re-use with all the world’s generic data
  3. The Journal is a lot like Quake3’s networking compression; however we build it, it OUGHT to be compatible with that when finished
    • i.e. once this is implemented, it ought to be re-usable “in server mode” with almost no code changes to provide a multi-host non-uniform distributed event log and playback system. “ought to”.
  4. From a tools perspective, we want to click on any Journal event and see the exact state of the entire Game at that point in time
    • Game Debugging … on steroids. BECAUSE WE CAN, THAT’S WHY
  5. …which’ll destroy C#’s crappy Garbage Collector.
    • So we’d better be aggressive about using weak references and/or converting “old” data into “summary” data, and dumping the data itself
  6. Just like an FS Journal, the ES Journal should allow us to reconstruct our entire game data at any point in time, so that we never, ever lose data, no matter how many bugs in Unity we encounter
    • Unity: your refusal to debug and TEST your own frickin’ “undo” implementation? Yeah. I’m looking at YOU!
    • Make a stupid mistake in your game-code and accidentally delete critical stuff while in Editor? Not done a git-commit recently? NO WORRIES! GO BACK IN TIME AND RELOAD IT! YEAH!
    • Find a bug in the Entity System itself? (shock! Horror! But also: guaranteed to happen) … well, we’ve got you covered ;)
    • …(which leads to the next point)
  7. This absolutely unfailingly guaranteeably … must not have any bugs in it.
    • Unit Tests FTW
    • This is our equivalent to Unity’s Serialization: everything will rely upon the assumption that “the Journal will take care of it”, making the Journal our weakest link / most critical code
    • KISS: the simpler we keep the implementation AND the API, the more confident we can be that it works at all times in all situations

Building it

Yeah, well … that’s going to be a much longer article (or three!)

Want more? Want to support this ES in future?

…Sign up here to be kept up-to-date on the project’s upcoming Kickstarter / Patreon / whatever-it-ends-up-beign (if you’re already signed up, it won’t add you again)

[smlsubform emailtxt=”” showname=” mailinglist=”ecs-kickstarter”]
Categories
dev-process devdiary entity systems games design programming Unity3D

2015 talk: Progress on An Entity System for #Unity3d

Slides from my talk last night at Unity Brighton.

Three parts:

  1. First: introduction / overview of Entity Systems, and why you care (as a “person who makes games”)
  2. Second: Progress so far: screenshots of the Unity Editor with explanation of the new features I’ve added
  3. Third: Challenges and solutions I’ve encountered so far

Aliqua-progress-2015-BUUG-v3

WordPress, HTML, the web etc – don’t support “presentations” yet. No, I’m not creating a fake Slideshare account just so you can wait ages for a non-bookmarkable slide viewer to (slowly) load. Until then … we have PDF. Enjoy!

Categories
entity systems programming Unity3D

Unity3D Entity Systems: Zero-copy data storage revisited

Recap: previous posts on Unity3D and designing an efficient Entity Systems add-on library, using structs to store data in C#.

But …

Categories
advocacy agile education entrepreneurship startup advice

Self deception of the Startup Founder: Paralysed decisions

This week I’m paralysed on some of my simplest decisions while happily making complex decisions quickly, and being incisive and highly effective on others. This problem occasionally crops up in my work and personal life, and it frustrates the hell out of me; I’m going to write about it here, see if it helps me find a new way forwards. Hopefully this may also help others who’ve experienced a similar problem in their own lives.

Categories
entity systems Unity3D

Data Structures for Entity Systems: Multi-threading and Networking

(One of a series of posts about converting Unity3D into a 1st-class Entity Component System. Read others here)

It’s a year and a half since I wrote about choosing Data Structures for high-performance Entity Systems in A-AAA games. I always had a followup post in mind, but never wrote it down (thanks largely to the demise of #AltDevBlog). These days I’m too busy to write such big articles, but it’s long overdue … This post is a shorter version of what I had planned, but should have enough to get you going in the right directions.