Coding Questions.

Off topic discussion zone.

Moderators: winston, another_commander, Cody

Post Reply
CapnSkweek
Competent
Competent
Posts: 38
Joined: Sun Apr 15, 2012 6:43 pm

Coding Questions.

Post by CapnSkweek »

Of the places I have seen with people who know what they are doing with computers, this group seems the friendliest, so I'll give this question a shot here. For those who wonder, I'm running Ubuntu 11.10

I would like to learn to code, ideally to perhaps develop a game of my own someday. I do realize that this is similar to getting an empty tackle box and dreaming of being an expert fisherman, but I've always dreamed big. I am currently trying to learn Python as my first coding language, as it was recommended by multiple websites as a good beginner language.

The question is, let's say I wanted to develop a new class of ship for Oolite. What do I need to know to move towards that goal? I'm assuming I'll need to use some sort of CAD software to define the shape of the ship, graphic editing experience to develop skins for the ship, and then plenty of coding to make it run.

According to several "computer literacy tests" online, I have what those tests say is 'expert' literacy. Oddly, they only asked easy questions. What is data, etc. I'm essentially lost when I look at code, so I'm thinking I am computer literate, coding illiterate! I would like to rectify that in the next few months!

Does anyone have a few tips for a guy who wants to learn to code? What tools do I need? I have IDLE, which is basically a Python coder that checks my work. I can already do remedial math with it, and change a letter to a numeral figure. Input q=4, then input 5+q, and it prints 9. Beyond that, I get lost. I'm fishing for theories on this, seeing what I might need to start moving forward.

Really wish I could find a way to view Oolite source code on ships and the like, but on Ubuntu, I find that's trickier than I'm capable of. Ubuntu is fairly simple from a user standpoint, but to go in and look at the twiddly bits, oy, not so easy.
User avatar
Gimbal Locke
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jan 08, 2012 11:32 pm
Location: Brussels
Contact:

Re: Coding Questions.

Post by Gimbal Locke »

Oolite is written in Objective-C, the OXP expansions are written in JavaScript and property lists. I would advise you not to bother about Objective-C at this stage.

Check out http://wiki.maikschulz.de/index.php/OXP_howto if you are interested in creating OXPs. You can use any text editor to look at (and change) the .js and .plist scripts in the AddOns directory.

For creating ships you can use Wings 3D or Blender 3D, both are free and work fine on Ubuntu. Here's an Oolite Blender 3D Modeling Tutorial. You don't need to learn how to program to create a new ship, except if you want your ship to have some behaviour which has not been programmed before, because roles for traders, pirates, bounty hunters, big ships etc... as well as all kinds of shaders have already been defined.

You will not find much use for Python in Oolite. It is however an excellent choice as a first programming language indeed. If you want to learn Python, then How to Think Like a Computer Scientist, Learning with Python 2nd Edition is probably the best place to start - it includes a chapter on configuring Ubuntu for Python development (in case you wouldn't like Vim: just ignore their advise and use your editor of choice, IDLE is ok to start with). Also check Dive into Python. When it comes to writing games in Python, have a look at Pygame, there you'll find plenty of examples and tutorials for simple and complex games in Python as well as a friendly community. Python is also the scripting language of Blender 3D and its included game engine. I have collected a more complete list of free Python game programming resources here.

Since you are using Linux and want to learn how to program, I advise you to learn how to use the bash command prompt. This will give you a lot more control over your machine and help you to move your mindset from user to programmer by typing what you want your computer to do instead of clicking on buttons. When you find it easier to type "repeat the following operation 200 times" rather than clicking 200 times yourself, you have become a programmer. (Read the previous sentence again: that really is what programming is about.) Knowing how to read the man pages will help you with this. As a Ubuntu user, you should know about the apt-get and sudo commands.

Give it a try, using JavaScript for Oolite or Python for something else. I'm currently learning JavaScript myself and I found that folks around here are most eager to help.
CapnSkweek
Competent
Competent
Posts: 38
Joined: Sun Apr 15, 2012 6:43 pm

Re: Coding Questions.

Post by CapnSkweek »

Thanks!

I've got plenty to study, but I intend to get started. I've already got my mind wrapped around a basic shape for a vessel, it might never get beyond that, but I'll share pictures when I have some. :D

Thanks so much for the help. Lots to learn, but I figure by the time I'm 80 years old, I should have a good handle on it. ;)
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2025
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: Coding Questions.

Post by maik »

Gimbal Locke wrote:
Check out http://wiki.maikschulz.de/index.php/OXP_howto if you are interested in creating OXPs.
Mind that this is only the backup server. The main server is back online now, so rather use http://wiki.alioth.net/index.php/OXP_howto.
CapnSkweek
Competent
Competent
Posts: 38
Joined: Sun Apr 15, 2012 6:43 pm

Re: Coding Questions.

Post by CapnSkweek »

The updated Wiki looks Great, although the links on this page; http://wiki.alioth.net/index.php/OXP_howto_model to the Brickship and Oogie ship seem to be dead. I'm not sure who to submit the report to on that though.

Still plugging away at this, though I fear that trying to build a whole ship right off the bat is going to involve more cussing than I'm ready for today. I've got a skin (texture) idea in mind, and I'm thinking about giving it a try here shortly. If I do, I'll let you fellas have a look. :D
User avatar
SwissMäc
Competent
Competent
Posts: 33
Joined: Wed May 10, 2006 7:54 pm
Location: Zürich

Re: Coding Questions.

Post by SwissMäc »

CapnSkweek wrote:
I wanted to develop a new class of ship for Oolite. What do I need to know to move towards that goal?
Maybe you take an existing OXP of a ship and just edit it ?
(I took the italian translation, used the structure and translated it to german)

I like, no, I love Python, it's easy and powerful, it gives understandable Error-messages and to mix different datatypes is fantastic !


And use the mighty command line interface like BASH:
eg. type:

Code: Select all

more /etc/passwd | awk -F: '{print $5}'
will list all Full Names of your Ubuntu Users. (Tested with OpenSuSE)

(UNIX Kung-Foo: Command to printout a file, pipe the printout into the next command, scan for pattern, separate them by ":" and just printout the 5. field. )
(Foo is not a typo, some people find it silly :lol: lol)
Post Reply