Quadrophobia: State of the quad

So – made some more progress today.

Implemented a Reload icon/button.  Works when clicking it.  Will have to try on my tablet.  In theory it should work fine, but you know how things go.

I also implemented the “falling stars”.  Though no trails, just applying gravity.  I messed around a bit with trails tonight and I don’t think I like how it looks.

So that’s 2 more things off the “to do” list.  Now that I have the ability to count how many moves I’ve made, drop the stars if I’ve gone beyond that number of moves, and reload the scene, I’ll either have an auto-reload or the ability for the player to select to reload or to move one (if they can).

Looking at it now, of course, the problem with a gravity effect when you pass the threshold (i.e. the lowest star falls offscreen if your number of moves go beyond that value (so instead of 3 stars, you’d get 2 for that level))… The problem is that gravity takes time.  Since it takes time, when you go to the next level, it instantly goes there, and if, say the value to hit was 5, and you had 6 moves, the 5 would start to fall offscreen, but then you’d hit the portal and BAM  next level… the falling didn’t complete.

Now – I can wait to load level until any falling has finished.  It’s going to take some learninatin’ however, because AFAICT there is no easy way to tell if a UI element is visible on camera or not.  With mesh renderers in the unity engine there is a boolean “isVisible” which can tell you whether or not the object is visible on screen.  I think the assumption is a UI element will be on screen cuz, UI.  But if you’re doing a transition effect.

I suppose a second way to do this would be to implement an animation (and probably what they really want a developer to do).  In that case, you would animate, and I’m sure there’s an “isAnimationFinished” boolean you could check.  So of course that means I’m going to have to redo all the work I did today.

The other option is to do some sort of tween effect, like a fade (I did try that on the star image, but since that applies only to the image, not the child text, it didn’t get rid of the value listed on the star).  That’s what I use to make the “Player Has a Key” icon, just an instant fade-in.  I do have iTween installed, and since there’s a way to tell if the tween still in process, that might be one way to check for a transition.  If I do that, I’d probably just do a fade-out of the stars.  Though I suppose I could just apply a falling effect manually (instead of using the built in gravity).

I’m sure part of it is the fact I’m applying gravity to a UI element, though since it’s not off limits, why the fuck not?

It’s kind of a bummer.  I know any system will have its weird limitations, but sometimes things seem like they should just work like you want.  But it never is the case.  Sometimes that’s due to the need to architect a program a specific way (that is, if you add a feature you think is “obvious” it might interfere with the implementation of another feature).  Other times it’s due to the developer having a different vision of the software, or it might be that it takes too much time to implement that feature in the way you think it should be done, and they’d rather work on some other feature.

There’s always a million different reasons a program might not work the way you want it to.  And of course, that’s a generic issue, not just an issue for game developers and coding.  Anytime a human interacts with a computer, they are, by design, interacting in one specific solution design, and therefore, not the other.  This means that you are always constrained by the vision of the programmer, the systems available (whether it be hardware, or language features, etc…), that’s not even accounting for money/time which is another HUGE issue on development, of course.

On the one hand I’m bummed that I may have to redo what I did today, but on the other, failure is just one more route to learning and understanding something better.

This might not be an issue if I animate the scene transitions (which I generally plan to do at some point).  If I zoom the camera in after entering a portal, the items on screen would get bigger, but still be animating, and thus, falling off screen, instead of an instant shift to the new level.  So that’s one possibility then I wouldn’t have to redo anything or check for whether a star/value is visible before moving on.  I may just use a camera animation then.  Of course, I still have to learn how to do it, but I think it could work.  AND it’s more dynamic since you’ll be having vertical (y-axis) motion of the star(s) and zoom motion (z-axis) of the camera…

Unity: Frustrations

So Unity has these things called Prefabs.  The concept is simple, in theory, in implementation, not so much.  Not that they aren’t powerful, they certainly are (look I’m making games, ain’t I?  Easiest way to make a game I’ve found so far (well… I mean there’s a learning curve, but memory management and shit like that, compared to, say C/C++ engines, is easier by far)).

So here’s the thing.  A prefab is sort of a like a meta-Object.  It can contain all the details you want in an object, and can duplicate it, copy it in a scene.  That’s great!  You can easily just make an object once then populate a scene with a lot of these objects and activate and change the parameters of the instances of the prefab.  It’s almost, but not quite, like a Class in OO languages.

One of the great things is that Unity is Component based.  This means you can add components to objects.  I could add multiple scripts to an object (which was hard for me to wrap my head around at first, because I was used to a more Object oriented approach (the class/script contains all things the object can do – whereas with component-oriented you build ground up.  you think “these are the actions my object can do, I will make a script for that single action” then make a bunch of them to be called when you need to, instead of stuffing it all in one “object/class” file).

Another great thing is you can add “Child objects” and establish a link between two different things.  A quick example might be a shield for a ship.  I would attach the shield object to the ship prefab, and then activate or deactivate as necessary, and of course this shield would have its own script(s) to dictate how it works.  Great!  Now I can take a ship and drag and drop it into any scene and it will exist already with a shield.

Further, you can take a shield prefab and drop it onto ANY ship.  Now any ship can have a child called “Shield”, not just the one I attached it to.  Great!

Now – in my case, here’s where the bullshit/frustrations lie.

I’m working on an interface, which has a canvas prefab.  I’ve attached things to this prefab.  In fact, some of my wasted time this past cycle of work on the game has been due to me needing to attach objects to the prefab in the scene, then drag that into the prefab folder, (overwriting the old prefab) THEN having to go into each scene and reset every single instance of the prefab so I have the latest and greatest version.

In order to add a child object to the prefab itself directly, I have to do it in the “scene” view (a particular listing of all the items in a given scene), before I can attach it globally outside.  That’s the first thing I can’t just drag and drop something onto the prefab itself and have it be attached.  Nope – go through scene, then duplicate/drag/drop and THEN I have the new prefab with child I want.

THEN having to go into each scene to reset it.  Now, imagine you’re adding elements to the UI as you design this thing.  And over time you have a lof of new elements, or you change elements.  You place them into the scene, lay them out like you want, but it’s a new child element, so you can’t just apply it you have to drag it down and replace, but THEN you have to reset everything.

I forgot to add that if you refer to any particular item in a scene and copy the prefab, replacing the currently existing instance of the prefab, so it gets all the new stuff, those references that previously linked to items in the scene are lost (which is fine, to some degree, because if you have a new scene, you won’t necessarily have the same elements in it when placing a prefab in there the first time)  but while it may be fine and logical, it causes a lot of pain if you need to continually drag in the new prefab into a scene (because you realized you need to add an icon or two, say), and that overwrites some previous connections which you then have to reapply.

So there’s multiple steps to reset shit if you just want to add one fucking item to a prefab.  Now, imagine as you work on the project, yoiu want to keep adding things.  Every.  Single. Time.  That means for X scenes that have the same prefab, you have to drag/drop from the prefab BACK into the scene (because you’re having to copy the new version of the prefab with its own copy of the new child object), then reset all the references in the scene for each component and/or children…

Let’s just say it’s a pain in the ass, to say the least.

There is an answer, here, which requires custom scripting in the editor that will automatically do this duplication and deletion and such, but I don’t think it will reset links of components and shit like that (though I could be wrong).  Still.

It’s annoying as fuck, because I don’t feel I should have to choose to work on the UI only before making new scenes and then if I want to change it, change it across ALL scenes and makes sure everything points properly.  FFS, I Just want to add a child object.  At this rate I’m thinking I’m just gonna flipping add the child object to the Prefab, and then manually go into each scene and jsut drag/drop the child object onto the scene instance of the prefab then any future levels I create will have the correct shit (with the new child prefab ready to go).  This will”save me time” (if you count having to jump through these hoops “saving time”) by not having to relink all the links to various instances in the scene, but it’s NOT saving me time if it worked how one would think it would.

I’m mostly pissed/annoyed, because I’ve lost so much goddamned time to this bullshit already.  I suppose, again, I’ll have to work with the custom script editor linked above to do it automatically, but then I have to parse out what the fuck it does, and link the proper scene elements in the code to make sure I have everything resetting like it should, which is just one more level of indirection in this whole process.  I want to work on designing levels and coding, not working on the metaproject of fucking trying to reset shit I”ve already done over and over and over. GAH.


On the plus side, though, I realize that one of the things I was doing stupidly (in a different part of the UI) was manually setting a link to some UI text in the inspector (the drag and drop UI setup of Unity that makes a lot of the stuff easy).  But what I should’ve done is added a “gameobject.find().getcomponent<text>()” so that everytime the scene starts it’s loaded automatically, and if I point to something else, I can do it in script and all the other prefabs will change.  In the end, this is the real issue for at least one problem I was having.  And it’s so bloody obvious now that I see it, but its one of those things you don’t even think of cuz you started doing it one way, and then it hits you later on in a single moment (like now).

Totally ok with me, saves me trouble in many ways.  I did try using that custom inspector script, but I think it didn’t do what I wanted it to do, and I didn’t care to futz with it, my number of levels are small enough now that I don’t care to waste time with that.  I’ll have to learn how to make custom inspectors at some point since it helps level designers do things, so if I were to code, I could pass it off to a designer instead of worrying about them futzing around in code.

Quadrophobia: Loading menu, work to be done….

FIRST: Real Life Escape Rooms

1) How come I never heard of this? (I mean the real life versions)

2) How come I didn’t think of it?

3) Hmmm…. Who needs a job working for some company – maybe all I need to do is make real life room escape puzzles and make mint before anyone else in Madison makes it huge. LOL… Nah.  I’ll keep working on my games.  Speaking of.



4) Progress on the Quadrophobia menu – worked on buttons, logos, etc…  Placement, animations…  Got the “New Game” button to load a new game, and then reorganized the layout of the screen a little.

Next, I need to work on a “reload level” icon/function (for when you failed or didn’t get as good as you want).

Then implement the logic and animations for “falling stars” (e.g. if you don’t get the value of the 3rd star, it falls off screen leaving you with 2 stars, etc…).

Then work on saving state between levels/games, then work on a “resume/select level” screen.

Also – instructions (not hard, but still needs to be done).  I currently have a button, but I may just end up putting in the text as a “live” tutorial (I already sort of do that with the simple levels, just need a text overlay telling players what they can do).

I think, since it’s my first game and super simple, and not that big or whatever, I may just release it on the Google Play store and put it as a free game, with an ad at the start and end, and then they can pay a buck if they wanna get rid of the ad.

Of course, I need to make enough levels to make it worth a dollar.  At least 30, I’m thinking a square value, so maybe 49…

I’m much less worried about my skill at making games, but just writing this stuff down makes me realize how much goes into making even a simple game like a small “move around a grid to an exit” puzzle game.  Sheesh.