Showing posts with label horrible tittle pun. Show all posts
Showing posts with label horrible tittle pun. Show all posts

Thursday, July 21, 2011

Reticulated programing: playing with snakes part 1

Well for a change of pace some hopefully useful or at least intriguing information if people were ever interested in programing. So with my current weapon of choice I present playing with snakes.

Image via this website

So as I like to be goal orientated to go about things we're going to make a very bare bones terminal based RPG that my friends had dubbed a long time ago the Fighter RPG. Very basic, no real options, you get to level up and chose some stats to bring up and maybe use some potions. Sounds simple, but programing it is a bit of a challenge.

First things first, you need to download the Python interpreter. For the purposes of me not having to read up on version 3 go with version 2.7. Though I doubt it'll make a difference. I don't believe version 3 broke a lot of code.

For this post I'll just stick with basic output right now. Since I'm not doing anything fancy everything is just text. 

After it extracts and you run it you'll be greeted with the shell. Which will be where we will play with today.
snake skin
The IDLE gui will work well enough to program in and it will give us some syntax coloring. Though in my experience that'll be erroneous sometimes though it'll at least show that it's an important keyword. What that means I'll get to later. For now I'll show the neat thing about interpretive languages. Right now you are able to input code and Python will execute it. For the age old starter we'll do the age old "Hello World" 'program'. To do that you'll need to type the following.

Print "Hello World"

After that just hit enter and it'll execute. You should notice Print and "Hello World" were different colors. Print is a command in the language while "Hello World" is a string, for now we'll just denote strings by the pairing of " but it can be done otherwise. Anything between the two "s will be counted as being part of the string. Print will try it's best to print out what's following after it. For instance you can print out the result of a math function. Try the following.

Print 5+4

You get the obvious result of 9. Now for a tricky part, in most languages there is a concept of  Concatination. Where you are able to combine strings together. To show this off try the following.

Print "Hello " + "World"

The result is the more complex version of Hello World above. What happens is effectively string math. It takes 'World' and 'adds' it to 'Hello ' to produce 'Hello World'. There are other math commands that python likes using with strings but I'll save those for later. Though speaking of math, what happens if we wanted to use numbers with strings? Like print out #1) for some innane reason? Well lets try it.

print "#"+1+")"

You got a big wall of red text there. That's an error, the interpreter has met with something it did not like. In this case I'll skip letting you figure out the horrors of that message and tell you what went wrong. It's an annoying part of python to me but you can not straight out concatinate strings and numeral objects. You have to convert the int, I'll explain what that means later, into a string. So to do that.

print "#"+str(1)+")"

No ugly red text. str is an inbuilt function in Python which I will get into later, all you need to know is by placing something between the brackets it'll try it's best to make it a string. Though this is an academic case, if you knew you were going to need one there you could have had it contained as "#1)". I don't know the best way to explain this but when it's in a string, it's in a string meaning when it's surrounded by "s it's seen as a character and not as a potential number by the interpretation. So you should have something like this.

I think this is week 1 of a computer science course in a nutshell




And I'll leave that as it for today. While not immediately useful it's a glimpse into programing. I may take this to completion faster if anyone is interested though it'll serve as something I like doing, showing people how to program.

Edit: Forgot to briefly touch str()

Tuesday, July 19, 2011

Prognosis Terminal.

For a change of pace I think I'm going to talk about programing. In this case about the Python language.

All rights to Python belonging to Python Software Foundation and all and is quite open source at the moment.

With that hopefully leganise fulfilling line I have to say I like python. During a class called principals of programing I was introduced to this little language and was both astounded and annoyed by it. To this day the feeling hasn't changed much. It's easy to get on any computer and for most applications of it you don't have to download a bunch of dlls or development kits to work with it. It's also very easy to program in from my perspective at least. I've used it almost exclusively for a while now as I haven't been bothered to get anything more complex than it. It gets my simulation data done and I don't need anything heavier at the moment.


Though it does raise some ire in me. For one it uses white space to separate blocks of code, may not mean much to the laymen but when I have a scroll horizontally to see what I'm working on it gets on my nerves.
I really should use spaces but they look ugly

Granted this is a very messy nested loop that I possibly could have done better through diving up the load in different methods but it was a quick dirty Monte Carlo test, along side some actual expected averages,  I wanted to get done. The next on the list is a blessing most of the time until it comes to debugging. Python being an interpretive system does not care about variable decleration or even type until it tries to do something with it. More than a few times I have been stuck debugging a misspelled variable that was oddly another variable of a different type while looking for a logic error.

Another down side that doesn't quite bother me is the GUI or visual portion. While it does have an inbuilt one of TkInter though I question some of it's practices. Though I'm not much of a visual person, terminal output and input is often enough to acomplish what I've done. Most of this is easily remedied if you know what you're doing visual wise or even if you hunt down some modules to expand python. Eve online is made with python if I remember correctly. How much python is hard to say, I have never looked into the guts of their system files to see if there would be any reconcilable extensions.

Hmm a bit short. Maybe tomorrow I'll try my hand at making some sort of python tutorial.

Thursday, July 14, 2011

Statistical analysis

An image I didn't make? Madness. QWOP will have more to do in a minute though.

There has been a long standing tradition in games to take a nature vs nurture approach in games. Nature being your innate abilities that are largely unchanging, though can grow in minor ways , and skills which are constantly being increased in decent numbers. There is a lot of weird things to this, so I'll begin with the parts I know decently well.

I know there were other games around when chain mail became Old Dungeons and Dragons but I just don't know how to find them, a lot were probably lost to the passing of time. But D&D had Stats. Back then stats didn't matter quite as much, in fact I think it had weird system of bonus EXP when you did things involving the bonus from your governing stat and magical things.

First things first, D&D is rooted in wargames so is a little weird at times. I know the modern statistics are Strength, Dexterity, Constitution, Intelligence, Wisdom, and Charisma. Don't know if any were added along the way and not in the mood for long research, which I may take up later for fun, on the original game. I do know stat "bonuses" were calculated completely differently making an 18 in them a godly thing. Supposedly wasn't too different throughout the years until 3.5 started making them mater a lot more and be prerequisite to a lot of feats which were needed, or spells cast, or even just hitting something.

The approach to this is a little weird. A lot of stats line up with one thing, sword hitting things intelligence hitting another, and in latter editions exceptions get made everywhere. 3.5, and possibly 3rd, in general had feats or little extras that you can get when you level up allow you to use Wisdom to fire bows and arrows. Strength has added to accuracy for melee attacks, except for light weapons which could use dexterity if you took the feat for it. Wisdom is some where between common sense, experience over time, and flat out natural instinct as every natural animal has high wisdom. The more "what is this stat actually representing?" of all of them is Charisma. It's always been described as a "force of personality" while having attractive races get bonuses to it and ugly races getting penalties, until 4th edition but another box of dead horses.

What does this all mean? Stats, attributes, and characteristics are somewhat silly. Though they serve a purpose. Table top gaming or even computer RPGs need some amount of abstraction to not be horribly cumbersome and not understandable by the people who use them. This is where QWOP comes in, it's a game that is realistic to a degree. You don't hold left or right to move the guy along, you actually go to the source of how he goes about moving muscular movement. Legitimately categorizing how a character should realistically go about things would be about as elegant as making QWOP man jump a hurdle, it can be done but I doubt most people will enjoy it. All games use some form of abstraction for this reason, reality isn't clean and fun. The most we can ask is that we can only eye roll a little at the designers choice and keep them constant. I'll probably revisit this under different systems, nWoD had I think 9 stats in total and comparing it to D&D could be fun.

Saturday, July 9, 2011

Roguelikes, the frustration maker.

I like Rogue likes. Not that I'm good at the mind you, I have a morgue file with a body count that gives me problems if they have 'ghosts'. That aside every so often I get into the mood to play them. The first Rogue like I've touched on was Nethack and did horrible at it, after that it was Dungeon crawl: stone soup which I could do half decent at. Later ones I've encountered is doom Rogue like which is actually very fun, and 5 minute dungeon which does away with the notion that everything moves and turns it into some sort of wonderful puzzle Rogue like hybrid that I am actually good at.

I like them for their no nonsense gaming, I'm there to kick down a door and get the best loot without having to memorize a bunch of area layouts or what enemy wave is coming up. It's also challenging though sometimes they like the idea of memorizing certain secrets (Don't pick up cockatrices, throw a longsword in a fountain on this floor) to avoid cheap deaths or have a legitimate chance of getting through the game, which isn't my kind of challenge. Though when they get a challenge right I feel like I could have gotten out of it if I did my tactics a bit better and that makes me come back. Dungeon crawl: stone soup meets this for the most part, there are some things that you realize you shouldn't do after you've gotten yourself into a situation a few times to realize that will just kill you unless you're decked outwith some gear or avoid it entirety.

And to finish up his little rant I have another pointless story. Back when I was getting my degree in my "principals of programing languages" class we were shotgunned with about a dozen languages over the course of the semester in hopes of exposing us to different programing structures and ideas. This was my introduction to python among a few other languages. For one of our projects we had to make a program with TKinter which is pythons inbuilt GUI system, we had a game to make that he liked to use in other projects. I asked if I could do something else as long as it was a game and used TKinter and made a very minor Rogue like. Effectively it was a game where you ran away from zombies towards an exit with some random 'rooms' thrown down. Really the rooms were squares of various sizes with one part removed. I just pushed a line of symbols onto a label it counted as graphics and had buttons that were key bound so you didn't have to click to move in directions. Had made line of sight code which I hate doing, I'm not a math person. While it wasn't exactly what I wanted I was happy with it since I got it done in some week or week and a half which is things I can do when I have actually consequences or someone else sitting behind them. Sadly I don't have the program anymore, lost due to the lowest bidder laptops or just not copying it over it's gone forever now. Could attempt to zombify it but I have other things that would take priority.