Link Bar

Home | Games | Programming | Tutorials | Donate | Legal (These are mostly empty right now. Placeholders!)

warning code

This website contains adult content.

Sunday, February 26, 2012

Down the Rabbit Hole...

I started reading the textbook for The Elements of Computing Systems, it's very accessible and I recommend it to anyone who wants to know more about how computers work.  Here's their course map:
From The Elements of Computing Systems, by Noam Nisan & Shimon
Schocker (free online course) http://www1.idc.ac.il/tecs/book/preface.pdf

I just read through the preface & introduction, and I can't wait to get started!  I'm already learning new things, like the different levels of abstraction (as represented in the image above, and the text block below) that really go on inside the box.  I used to think that you just had your programming language, which was made "binary compatible" (whatever that would mean) by the compiler (whatever that did), and the computer ran on binary.  Well, binary and smoke (if you let the smoke out, the computer stops working).  Lo and behold, the introduction comes to the rescue, curing me of my misconceptions:
If you have taken any programming course, you’ve probably encountered something like the program below early in your education. This particular program is written in Jack—a simple high-level language that has a conventional object-based syntax.
// First example in Programming 101:
class Main {
function void main() {
do Output.printString("Hello World");
do Output.println(); // New line.
return;
}
}
Trivial programs like Hello World are deceptively simple. Did you ever think about what it takes to actually run such a program on a computer? Let’s look under the hood. For starters, note that the program is nothing more than a bunch of dead characters stored in a text file. Thus, the first thing we must do is parse this text, uncover its semantics, and reexpress it in some low-level language understood by our computer. The result of this elaborate translation process, known as compilation, will be yet another text file, containing machine-level code. Of course machine language is also an abstraction—an agreed upon set of binary codes. In order to make this abstract formalism concrete, it must be realized by some hardware architecture. And this architecture, in turn, is implemented by a certain chip set—registers, memory units, ALU, and so on. Now, every one of these hardware devices is constructed from an integrated package of elementary logic gates. And these gates, in turn, can be built from primitive gates like Nand and Nor. Of course every one of these gates consists of several switching devices, typically implemented by transistors. And each transistor is made of— Well, we won’t go further than that, because that’s where computer science ends and physics starts.
Computers are like way faster than I ever realized.  Also, no wonder my framerate starts chugging when I jack up the draw distance.

I also read the tutorial on the hardware simulator, and the lecture notes on the introduction.  I'm calling it:  my brain is officially full.  Project 00 can wait until, I dunno, whenever I get sick of trying to fix Fetris.  Catch you crazy cats later.

Friday, February 24, 2012

Day 10: FETRIS (work in progress)

I went through Evil_Greven's tutorial on how to build a Tetris clone in an hour with C++.  I followed his instructions using Microsoft Visual Studio 2008 Express.  I'm much less intimidated by C++ now than I was two days ago, but I feel like I'm back in the 5th grade again, learning Spanish for the first time.  "Yeah, I know what 'buenos días' means.  'Pantalones?'  Oh, man, this is gonna be easy.  Wait, why is N-yay a totally different letter from N-eh?"  Seriously, you guys, for the longest time I thought that "vedevaca" was the name of the letter, not just "veh" - I didn't learn about "b de burro" until I was in freakin' high school.  Same with "y griega," I didn't know it was as opposed to "i latina" until I dated a girl from Uruguay and she told me.

I guess what I'm saying is, I need to date a programmer now.  No, that is not the most cynical use of dating ever.  But, uhh... I can't come up with a more cynical one.  Because I'm so totally not cynical.  Double-promise.

Anyway, I got through with no problem, except that VC was telling me that I hadn't declared shit which I had so too declared, just look.  But whatever, I didn't let it bother me, and I kept on chugging through.  I would highlight everything that turned blue and hit F1 to bring up the help, and read through those articles.  This made it take like three hours instead of one, but that's OK.  Then I went to compile it at the end, and that's when shit hit the fan.

As my grandma would say, "Errors out the yin-yang."  Yes, my grandma talks like that.  No, it's not cool if you say that while being under 70 years old.  Yes, that's a moving target; it won't be cool for 70-year-olds to talk like that when you're 70.  Modern medicine has made it culturally impossible for us to be ironic by speaking in the fashion of young people when we are in fact old people.  And no, current old people do not suffer from this flaw in our age-based system of behavioral standards.  But hey, that's what you get for longevity.  Stupid double-standards.

ANYWAY.

I dutifully read the errors and went to the lines of code where they allegedly occurred.  Ahh, shit, I forgot a "( )".  Oh, damn, a legit typo; must'a fat-fingered it.  Whoops, left out a semicolon!  And... that... I can't...
fetris\main.cpp(187): error C2440: '=' : cannot convert from 'const char [7]' to 'LPCWSTR'
What the blue fuck does that mean?  OK, let's go to line 187:
wcx.lpszClassName=WINDOWCLASS;
Right.  And what did Evil_Greven say to do here?
wcx.lpszClassName=WINDOWCLASS;
All right.  Double-check each and every character, and... yup, that's exactly the same.  And what other sage advice does VC have to give me on this?
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Ohhhhh-kayyyyy... I know what that means and everything.  And I've got 21 more errors to go.  That's not bad, for over 600 lines of code on my first day.  Wait.  Hold on.  Remember Alexander the Great.


This tutorial was written in 2003.  This might be nobody's mistake, just a case of mismatched standards.  Maybe.  But if it is Evil_Greven's mistake, it's almost certainly beyond my ken to fix it now.  Dammit.  I really wanted to play my very own Fetris.  I even made the bitmap for the blocks!

Whatever, I'm putting this aside for now.  I'll come back to it over the weekend and see what else I can learn.  It's not like those errors are going anywhere, right?  Besides, there's nothing like fixing a broke-ass machine to get you familiar with its workings.  But for now, I'm done with this.  You get the Tetris God:


Also, you should check out Hatetris.  Because I just bet you're a masochist.

Thursday, February 23, 2012

Day 9: The Alexandrian Solution

After reading some more about the Playskool programming that is RPGcode, I grew despondent at the idea that anything I learn here is going to need to be re-learned or un-learned whenever I get my Big Boy programming in gear - because some things will work and some things won't, and I'll probably have to learn which is which one by one.  Hmm... let me think for two seconds here.

OK, I'm not doing that.

So has all this been a waste of time?  Absolutely not.  I've learned a lot in the last eight days, not only due to the reading I've been doing but also by playing around with things.  I now have a much clearer picture of what goes into a video game.  Look, here it is:

Green means "I get it."  Purple/Blue means I'm fuzzy on it.
Red & gold mean I'm fucking clueless.

So yeah.  There's this big, mysterious hurdle right there in the  middle, and it turns out it's the part that actually holds everything together.

I don't know how to untie this Gordian knot - at least not in any way that I would consider to be an effective use of my time - so I'ma straight-up cut the fucker in half.  I'm just gonna learn how to program.  It's a valuable skill, it will help me accomplish my goals, and it's bound to be less time in the long run.  I feel farther from finished game, but I know I'm closer to good game, and that's better to my mind.  However, this means that my daily progress is going to be much less interesting.  Actually, looking back... maybe not.

I'll probably also be able to research the things I'm interested in more directly, and take better advantage of Stack Exchange.  We'll see how this goes.

...ahem.

Doop a doot doo.

What?  You're still here?  Oh, right.  Progress.  Y'know, that thing I said I'd do a little bit of every weekday.


There was a minor tab explosion and I took a walk around the internet.  I learned a little bit o' FORTRAN way back when I was doing undergrad theoretical physics research (ugh, I let the professors write my bio and now it's stuck like that forever... that's what I get, I guess), so this shouldn't be too difficult.  Although I bet it'll be much harder than writing a program that brute-forces a square root approximation and laughs at you if you enter 1 or 0.  From poking around the 'tubes, it's looking like my best bet is C++.  Python seems easier, but I'll just have to learn C++ after it, anyway; and I bet I can learn Python faster after C++ than the other way 'round.  DarkBASIC could also be easy, there's a free version that runs only on ads, but I have little mini-versions of the same issues I've got with Python, and I don't want to wind up in any kind of legal limbo if I actually make something salable (or just have to do it all over in C++ anyway, which may or may not be worse).  Anyway, here's the best of what I've read today:

  • Stack Exchange:  What are good games to "earn your wings" with?  Several perspectives on how to go about learning game development from scratch.  Lots of agreement, and well-articulated disagreement.
  • The Game Programming Wiki:  Beginner FAQ.  More grounding on exactly what the Hell I'm getting myself into.  Getting many sides of the same issue is really helpful; repeatedly seeing the same ideas reinforces those ideas, and also "filters" some of the mere opinionating because it isn't repeated.
  • TGC:  Newsletter.  These guys sell software (they made DarkBASIC), which does not interest me.  But they have a newsletter, which does interest me.  So I signed up for it.  Hope that doesn't bite me in the ass... now I just gotta make sure I read it.
  • Nisan & Schocken:  The Elements of Computing Systems.  Zach once explained to me how computers work at the transistor level.  I understood that part.  I then asked him how you get from "physical logic gate" to "game on screen," and I was unable to comprehend his explanations (due in no small part to the fact that we were drinking that night).  This is a course on pretty much exactly that.  I now have great weekend filler for twelve weeks!  (Fourteen, if I stretch it.)  Here's a sweet video with one of the authors explaining what the book/course are about in more depth:


At Zach's behest, I also downloaded everything I need (I hope?) to use C# for xna.  That's gonna be my fallback if I suck so bad at C++ that I hate it.

Wednesday, February 22, 2012

Day 8: More book-learning.

Seriously, you guys.  I am thoroughly convinced that making a game takes forever and is impossible.

I got program vectors on the board, and I got NPC sprites on the board near the program vectors, but obviously they won't just go, I have to tell them to go and when to stop and blah blah blah.

I need to learn more programming, is what I'm saying.

So I looked up the section on vectors for more precise instructions, and it tells me to write things like "playerPath(variant handle, int flags, ...)" and "itemPath(variant handle, int flags, ...)" and expects me to know how to use RPGCode already (which borrows from programming languages I also don't know).  Fine.  I know when I'm in over my head, so I went to the RPGCode section to find something on "make sprite follow path vector."  This section is written by Occasionally_Correct, who you may remember from that useful tutorial I read on Day 4.  But the topic headings look like this:

  • Language Features
  • Basics
  • Program Flow
  • Creating Functions
  • Scope
  • Error Handling
  • Reserved Variables and Constants
  • Function Reference
  • Object Oriented Coding
  • Old vs. New
  • Methods and Using
  • Overloading Operators
  • Copy Constructors
  • Polymorphism

OK.  So.  None of those is on assigning an NPC to a path vector.  And in case you can't tell, this is not how I learn things.  I don't do well with things like "basics" and "principles" unless what I'm learning is something simple and limited, like playing cards, and I can immediately do a bunch of trial and error.  You get two through ten, then these three "face" cards (King beats Queen beats Jack beats Ten, and so on), and an Ace which can be high or low or both depending on the game.  That's it.  That I can learn with basics an' shit.  This is like nailing Jell-O to a wall:  you tell me something and I listen, but it's boring, and when I finally understand the second boring thing then I've already forgotten all about the first boring thing.  I can never learn exciting things this way, because I can't remember all those boring things all at once.  I need to start with an exciting thing, pre-formed and ready for dissection, and just use it first.  Then when whatever it does isn't good enough for me any more, I learn one boring piece of that exciting thing at a time, and tweak it into oblivion until I get what I want out of it (or at least have a more robust understanding of what I can/can't get out of it).  That way I can do something exciting, even if I'm doing it poorly, but I have practical knowledge straight out the gate and a way to branch out.  Then when I've amassed enough exciting things (or at least enough facets of the one exciting thing), that's when I'll grasp the basics in a broad-based way.

I want to be clear here that I'm not saying the guide is bad.  It's actually very good, but it doesn't fit me.  It's like a well-made tuxedo that's two sizes too small:  I can't fit it on and it looks like crap if I force it, even though it's evident that serious craftsmanship went into its design and manufacture.  What I'm saying is, this guide's start point is my end-point.  This guide wants to go backwards through my learning curve.  The cheek!


It's like I want the internet, but I have a textbook.  Yes, I can use the textbook; but the internet would work so much faster!  Whatever.  If this were easy, there's be zillions more shitty games out there.  There's nothing else really to do at this point, since I can't execute the other game features I want without learning everything about coding.  I guess I ought to keep working on the first game, then.  So fiiiiine, I'll reeeeead the tutooooorial, and probably like three others too.  Even though they put me to sleep because they start with things I don't care about and work up, rather than starting with things I do care about and working out.  Although I suppose it would be really hard to write a guide centered around "what I care about."

So that's what I've been doing today.  Found another good tutorial by this guy Marz, so hopefully that should mean "game updates" and not "learning updates" tomorrow.  I don't think you guys wanna hear about what variables and functions and arguments all are, anyway.

Tuesday, February 21, 2012

Day 7: Two steps forward, one step back.

I figured out how to do graphical and waypoint vectors, the other two kinds of vectors besides collision and programming.  I couldn't quite figure out how to get vector intersection (where your character is opaque when its collision box is outside of the vector, and can go in front of or behind it) instead of frame intersection (where your character is always behind, as though the object is "above" your character); the user's guide mentions their existence and then tells you to click an option that is not actually represented in the user interface.  I bet I'm going to feel really, really dumb when I do finally find that sucker.

On the plus side, I found out how to load programs upon entering a board.  You see, under the board's properties, there's a little section that allows you to load a program to activate upon entering the board.

I got the structure of a board intro here.  I'm angry at vectors right now, so I'll add NPCs & shit tomorrow.

Today's just one of them "do one thing" days, I guess.

Monday, February 20, 2012

Day 6: Taking things in a new direction...

So Saturday evening, after mailing books to prisoners & teaching seniors to use Facebook, I was walking home thinking about game stuff.  I thought, "I should see if I can make something game-ish with what I've got now," since the toolkit comes with a battle system.  It would be good practice!  And I thought, "Hmm... I could do that torus world thing I wanted to do, keep things nice and simple."

Oh!  Hey!  I could do it like a ring world, just one continuous strip.  Play around with how big I can practically make the boards.  Ugh, now all I can think about is Halo.  No way I'll be able to make something like that with this.

Fuck it, make everyone cats.  That'll do it.  Even the aliens:  small, medium, large, and extra-large.  They're, uhh, directed by a coven of witch-cats.  They're the Coven Cat Fleet.  Yeah.  And the human resistance relies on... Sergeant Scritches.  OK, so Sergeant Scritches goes off on this ring world, and he has to, like fight guys.  With a gun.  He can also use nunchuks, but they're terrible.  I don't know.  But he has to find a bunch of... hoops jump through, like... no, fuck it, just find the hoops and literally jump through them and magic happens.  That's enough to learn how to make the event happen, you can make it fancy later.

OK, so you travel ring world, you kill the Coven Cats, you find better nunchuks, and... I dunno, gain the ability to dual wield.  How can you heal?  Cats eat fish.  Mine for fish.  Wait, that's taken, isn't it?  Look, maybe he came up with that, but you can't copyright turning people into cats.  Or shooting barrels for lutefisk.

What'll I call it?  Something like Halo, but definitely not Halo.  Oh.  Oh, yeah.

Hula.

OK, so I made a little sketch:

A quick sketch after making a little mock-up of the original Halo box art.

I gave myself too much room just to write "Hoop-Jumping Revolved," so I added "It Done Did" and it just kinda stuck.  I played around more in GIMP, too.  I'm still in my finger-paint stage, but soon I'll have some nice, starry backgrounds to load my tilesets over...


Mm-mm.  That's some good GIMP practice, right there.

There was a point there where my screen looked like this:

Ingredients:  Kittens, Samus, Chief.  Put in blender.
Use "chop" setting for chunky, purée for smooth.

Before I get too far on this, though, I need to make a decision.  Green or orange?

Sgt. Scritches can dress for many occasions.

I mean, I like green and all.  But orange is the color of awesome.  Maybe if I make it darker?  I don't know.

Also, because I think everything needs a minimalist poster:

Saturday, February 18, 2012

Conversation with an Industry Insider!


Dear My Adoring Public,
This past week, I had a conversation with my friend Zach Lome, who is awesome and a really cool guy.  He has also worked on Real Life video games in the past, and lent me his insight during a conversation we had recently.  I'm sharing that insight with you, My Adoring Public, both for your benefit and so that I can remember it later.  Cheers!

T:  OK, so I accept that I will have to start everything over at least six times on this project.  But what would you recommend I learn more about first, now that I have the game running?  Should I build more world, work on combat, make menus and items, set levels…  If the whole team had to work on one thing at a time, what would they tackle first?

Z:  The first thing to tackle in game design is just that:  the design of the game.  Step one, write down (no programming!) how you want the mechanics to work.  Step two, create tools that let you implement your design.  Step three, use your tools to generate the scenario the user interacts with.  Step four, figure out whether or not the mechanics you designed are fun and engaging.  If you write a lot of flexibility in your game engine, you should be able to tweak variables and info without having to do a lot of extra coding.

T:  OK, I wrote two pages in Word about what I want there to be buttons for and how to interact with things, so that’s at least a start on the design document.  Step two is where you lose me, I have no idea how to get started on the “create tools” part, but step three is exactly what I want to do to those tools and I can picture a sort of tech demo in my head.  I’ll worry about step four after I have something at all functional.  I guess right now I need a clearer idea of what actual work I’m going to be doing in step two, so I know how much detail to use in step one.  What should I be Googling?

Z:  [REDACTED FOR GOVERNMENT SECRETS.]

T:  HOT CHA!

Z:  doo hoo hoo,hello hello!  This will be much easier. I can type faster and [REDACTED FOR PUBLIC HEALTH BENEFIT.] <_<


Z:  okay so when I said 'make tools' that's really more of a build-from-the-ground-up thing. Since you're using RPG Maker that's sort of… done already.  the problem is, I've never used RPG Maker, so I'm not entirely certain how much flexibility it offers in terms of implementing what you want.

T:  rpgtoolkit, actually. Those are two distinct things, it turns out.  I was surprised.

Z:  ah

T:  But yeah, they got forums and everything. And I see from having done the quick-start tutorial what sorts of things there are to do, I just have no idea what part of the game I want to make more of first.  But for when I do eventually make my own game-making engine, that's what I would be doing? Basically coding a program that enables me to edit the game?

Z:  so the way I would suggest doing it is pretty much what I texted: first, figure out how you want the game to be played. Determine every individual action a player can take (pick up an item, drop an item, fight a monster, use an ability on a monster, defeat a monster, recover loot from a monster, talk to an npc, hit an npc, flee from battle, exist in a cutscene, etc.)  Split things up into distinct sections of functionality — don't worry about story or art or music, but consider whether or not you'll need to do particular things with story or art or music (do you want a certain sound effect to be able to play when a text box pops up? make sure you have some way to do that).  And then what I do is just go from easiest to hardest in terms of functionality implementation.  So the easiest is having a guy that walks around.  But to do that there's gotta be the map, so you need to be able to generate a map.  So once you can make a map you have the guy walk around on it… what does walking entail?  There has to be input from the controls, animation, and probably a sound effect  once you have all of those implemented look at how you can extend it — collision detection for instance.

T:  OK. Wow. Crazy. OK, so make more land, make more mans, make more stuffs, make more menus. Yeah, I got the animation and was able to work the controls.

Z:  What kind of things can the user collide into?  Is there a difference between colliding with a wall and colliding with an NPC?  What does an NPC detail?  Let things spiral out of control naturally.  :)  Always focus on functionality though. if you've got a good list of what you want things to end up looking like then you won't suffer from feature bloat.

T:  Right on. OK, well I won't [CENSORED FOR EXTREME OBSCENITY.], but you've given me a lot to work on and think about. Thanks for your help!

Z:  S'all good :)    It's a bit harder in some ways when you're using an already-written toolkit, because you're limited by what the toolkit can do.  But it's also easier because you don't have to know C++ or C# and you don't have to write your OWN toolkits :)  

T:  Right.  I’ll do that later.  For now, I want to learn somebody else’s tools so that I have better ideas when I build my own.

Full Disclosure:  I sent an email to Zach, asking the following:
Dear Zachary,May I post our conversation from the other day to my blog?  I shall redact the parts about [REDACTED FOR PARENTALLY EMBARRASSING INFORMATION].  Well, one of them.  I'll censor the [CENSORED FOR ABSURDLY SPECIFIC PORNOGRAPHY].  For adult content, you see.
He replied:
Oh, absolutely! Feel free to take any ramblings I have and reprint them. You have my explicit permission unless otherwise stated by me during the course of the conversation to repost anything I say.
Feel free to print this out, laminate it, and frame it. As you do.