Unity Asteroids

09.21.2014

I've been (slowly) making my way through the last 3D Buzz Unity tutorial I purchased at some point in the last 2 years. The tutorial goes through and creates a 3rd person space ship shooter where you fly through an ever expanding asteroid field. I'm about halfway through coding the 7+ hour video series, having watched the series once just to make sure I know where all of this is going.

I make little mistakes following along with the videos. I type a wrong character or forget to add a component. So far there hasn't been any problem that's popped up that's taken more than 5 minutes to track down and fix. Part of following along with the video is annoying in that the guy doing the programming has a quirky way of naming his variables. A globally accessible variable is named in UpperCase. That bothers me as normally I would make them camelCase (which he uses for local variables in functions, which I would also do). This can be a little confusing when a variable ends up with the same name as the class, such as:
        public Camera Camera;
Camera is the class, while Camera is the object variable. That just bothers me. I big part of me wants to fix it (Camera camera), but the times I've tried this in previous tutorials I've gotten lost & confused when following along. Instead, I've opted to add lots and lots of comments in my code when pausing the video to try to force myself to explain what is being taught. This makes my tutorial progress slow, almost agonizingly so, but I think I learn more from it in the long run.

Earlier today I ran into my first problem that had nothing to do with actual code. The game has reached the point where my virtual spaceship can fly through the virtual asteroid field. No collision detection is set up yet, so nothing bad happens. Asteroids pop into view based on what can be seen on the monitor - only asteroids in the field of view exist and have movement, nothing (mathematically) is happening behind you or to the sides. My problem was that my monitors would randomly turn off. The computer is on and running, but the video output dies. Once I reboot the computer everything is fine.

Unfortunately I can only guess at what is causing this. My first guess is that the math of keeping up with 400 asteroids moving in 3D space is too much for my 5 year old computer. It shouldn't be, as the 5 year old computer was built for gaming and I don't want to think that I'm making a tutorial game that can break it. There could be a secondary process running interfering with the video - I think at least once I was transferring some video files over the network.

This always happens when I start to pause the game, which thanks to the controller setup means the ship starts looping and, at least in theory, a lot of asteroid position updating is going on. I'm taking a stab at lowering the amount of asteroids that can be viewed before continuing on my merry tutorial way. Maybe it'll work. Maybe not. I'm just guessing.

Tomorrow I get to the video explaining how to blow up asteroids. I'm looking forward to that one.


game dev programming/interweb

Jogging-ish

09.14.2014

My normal walking schedule is Monday, Wednesday, and Friday while trying to manage a 5 mile route each day. Not bad for someone who needed to rest when walking across a parking lot 2 years ago. This past week I faltered on Friday as I thought I would get rained out - the local radar always showed rain nearby but it always dissipated by the time it got here.

To make up for missing Friday, I went on an evening walk Saturday. I met Gina over by the school and she took her first walk with me in a couple of months (due to her plantar fasciitis messing everything up). She made it a mile before the pains started shooting, but I'm proud that she made it that far.

I stayed and walked a little farther. I've noticed that normally when I walk in the mornings, 5 miles of walking over an hour and a half feels about right. Later in the day, I don't want to walk as far but my pace seems to naturally quicken. When nobody else is within sight, I've even taken to attempting what I like to call a jog. Anyone else would call it a mildly controlled seizure where I somehow remain upright. Saturday night, since the walking track was devoid of anyone else, I decided to up my random jogging spurts.

Normally on the last mile of my walk, when I'm in my zone and nobody is looking (see above), every ¼ mile (there are posts along the trail marking this) I'll jog a little until I run out of wind. This normally takes about 30 yards, although I would swear it's really about a ¼ mile. I'll then try to catch my breath before the next ¼ mile post and start the process over again. Saturday I decided to just see how many of my jogging spurts I could get in on a 1.5 mile lap.

My lighting fast jogs register as green on the map above, save for the first one at the bottom around Athens-Limestone park. There are 6 green-shaded areas where I broke the sound barrier with my lighting fast pace. Lighting moves at a 13 minute/mile pace, FYI. Most importantly, I didn't pass out, fall down, or die from this extra exertion. Due to the tightness in my thighs I knew that walking around today would be.... fun, I'll go with fun.

The grunts each time I get up and start to move are signs of fun.

I'm just happy to be able to move and run around a little.


diet gastric sleeve

Everybody Dance. Now.

09.12.2014

In need of a placeholder until I'm feeling creative and wordy, so you get Paul Rudd from 2007 in I Could Never be Your Woman.


random

Re-remote

08.31.2014

I switched over to using Logitech Harmony remotes (evidently) in 2007. I was tired of having, at a minimum, 3 remotes laying around for the TV, receiver, and DVD player. The benefit of the Harmony remotes over others of the time was that the Harmony was programmed via the internet so that it wouldn't become obsolete as new electronics came to market. Instead of punching in a PIN to program the remote to work with the TV I now had, only to hope my future TV would have an equivalent PIN, Logitech just updates drivers on their website and everything magically works.

The 880 was my first remote which I thoroughly enjoyed. Around my birthday soon thereafter the 1000 was on sale which had more of a tricorder feel. I used the 880 in for the bedroom TV and the 1000 for the living room TV. The problem was that the 1000 was not suited for couch surfing as the device + button layout don't lend for 1-handed channel surfing. So after a while I picked up another 880. That was almost 4 years ago.

One of the 880s is starting to show it's age. It's been dropped a couple of times. Pieces of plastic have fallen out. In fact, there's something rattling around in it now. It still works, it just feels like I have to press buttons longer, and sometimes harder, than I need to in order to get it working.

I don't channel surf on the living room TV any more. The majority of time I do anything on that TV, I'm playing Grand Theft Auto 5. Every once in a while I'll watch a DVD. Gone are the days of living room 1-handed channel flipping, so I pulled the Harmony 1000 out of the drawer I had tossed it into years ago, charged it up, and updated it through the Logitech site. Now I've got a 6 year old remote that feels new in the living room.

I could probably download an app for some iDevice that would do the same thing, but I like having a dedicated remote.


random

JavaScript 4 Hire

08.29.2014

Today"s blog is for my own ego, to show what nearly 2 decades of web development actually does for me.

Yesterday Jacob told me of a little JavaScript job I could do for a site he manages. The crux is that sometimes an id will be passed along through the URL, and when that happens it needs to replace that id in a link on 2 pages. People might browse around on the site, but if they originally come in with that special id, it needs to be the one in the link on those 2 pages.

The actual description of what was needed wasn"t much like the above, as it went into unneeded detail about where links were coming from and going to, with special names for each.

This all had to be accomplished via JavaScript as the site is hosted on a server with no server-script side access. Jacob thought of because I know JavaScript and passed it along. While I know JavaScript, I have to look up a lot of the syntax, but I know how JavaScript works. Especially with the help of the Google.

I talked to Jacob to make sure I knew what was going on (see my re-written description in the 2nd paragraph above) and went over my plan:

With the above in mind I set out on the handy home PC and got to work. I found a function online to read in variables through the URL so JavaScript could access them. I found a nice set of functions that let me create and read JavaScript cookies by name (by default it"s just a string with all of the cookie names and values stored). I found a good example of regular expression replacement. After a good hour of programming, which took two to three times that as I kept getting sidetracked and was doing laundry at the same time, I sent it all off to Jacob to try out.

And it didn"t work.

The id would change on that initial page load with the id in the URL, but then it got lost.

So I looked at saw that on the live site each page appears under a different directory. Maybe it was a problem with cookie path permissions? I made a local test with files in sub-directories and had the same results as Jacob. The problem I suddenly had was that everything looked right in debuggers, inspectors, etc. Everywhere but where I had an alert box that was supposed to pop up when JavaScript found the cookie. After a quick chat with Jerry, I decided to just write out what the JavaScript cookie string was.

It turns out the handy dandy functions I found online for creating and getting named cookies worked fine if nothing else on the site wrote a cookie, as these functions used a completely different delimiter than what already existed. As such, my new cookie was getting merged into an existing cookie thanks to having the wrong delimiter. I Googled up a fix (just show me functions that work better!), tested it out, and sent it to Jacob.

And it still didn"t work.

Luckily I had an early breakthrough that would have had me beating my head for a long time. I noticed that on the live site, if I went to http://website.com?id=blah it quickly redirected to http://website.com/?id=blah. This is probably a side effect of some type of SEO URL parsing optimization. Unfortunately, it wasn"t cooperating with my script to read the URL and grab out the id as that added slash broke the JavaScript window.location.search parameter and left it blank as opposed to filling it full of juicy parameters to parse. After a couple of passes of trial and error I figured out how to get the parameter values out, and from there tested some more and passed it along to Jacob one more time.

This time it worked.

This was a little project that was estimated to take 2 hours, that I knew was really 30 minutes of coding. I worked on it off and on for 6 hours, which was at least 2 hours of real work. While I couldn"t remember the syntactical details of all of the JavaScript, I knew enough about how JavaScript worked, what it"s capable of, and more importantly what it"s not capable of, that I got this working and was never in fear of it not. Each time Jacob deployed the code and it didn"t work, I knew where to look (and what to look for) to get a fix coded.

Over the past 2 months of sending out resumes, I tend to underestimate and undervalue my skills when I talk to people - mainly recruiters. While some JavaScript programmer, or even a front-end developer, could have made the above chunk of code in much less than 2 hours, and there"s a good chance it would have worked the first time instead of the third, I can do that plus a whole lot more. Plus, I enjoy doing this kind of stuff. It was a little frustrating when the code didn"t work, but got a little excited about figuring out what was going on and how to fix it, because I knew that I was going to get it done.

I will now return to my humble self. Except when I talk about how far I"ve been walking.


programming/interweb

Blog Archive

As always, correct spelling is optional in any blog entry. Keep in mind that any links more than a year old may not be active, especially the ones pointing back to Russellmania (I like to move things around!).

Tags have been added to posts back to 2005. There may be an occasional old blog that gets added to the tag list, but in reality what could be noteworthy from that far back?

Blog Tags

3D Printer (26)
4ground (32)
4ground-mall (40)
action figures/toys (10)
airbrush (7)
Aliens (1)
Amazon (12)
antenocitisworkshop (11)
Atlas O Gauge (2)
Batman Miniature Game (2)
Battletech (1)
belt sander (12)
Blood Bowl (4)
boardgames (77)
books/comics (19)
computers hate me (5)
conveyances (15)
diet (53)
dreams (7)
fallout (1)
Foundry (3)
Gale Force Nine (1)
game dev (22)
gaming miniatures (227)
gaslands (10)
gastric sleeve (34)
Green Stuff World (2)
Hasslefree (9)
Hero Forge (1)
hobbies (101)
Jailbirds Minis (1)
kevin smith (1)
Knight Models (2)
malifaux (2)
Marvel Crisis Protocol (2)
mckays (1)
models (9)
mom (32)
moon light (5)
movies/tv/dvd (60)
ninja division (1)
Pathfinder Deepcuts (1)
pilonidal cyst (5)
plastcraft (2)
programming/interweb (41)
rambling (60)
random (365)
random maintenance (3)
Reaper Bones (3)
reaper chronoscape (32)
renovation/remodelling (24)
road trip (26)
salesforce (1)
sarissa precission (2)
scenery (16)
studio miniatures (3)
ttcombat (12)
video games (51)
walking dead (36)
wargame foundry (3)
work (6)
wrestling (45)
zombicide (1)
Zombicide Invader (19)
zombie mall (23)