• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.
  • We, the systems administration staff, apologize for this unexpected outage of the boards. We have resolved the root cause of the problem and there should be no further disruptions.

Teaching myself Python 3 through Traveller

Golan2072

SOC-14 1K
Admin Award
Marquis
As you may have seen from my previous threads, I am slowly teaching myself Python 3 by writing various RPG-related scripts, primarily for Traveller (or the Cepheus Engine).

I am intermittently working on my sector generator, but now am trying my hand at a character generator. This is a very useful project, as it allows me to experiment with Object-Oriented Programming. This is my FIRST EVER EXPERIENCE with OOP, and so far is going very well; I have already learned about Inheritance.

I also learned quite a lot about Dictionaries from dealing with the skill list.

The main concept is this is a super-class called Career which has all the chargen methods, then a specific career class which inherits from it and sets the career values (enlistment, survival, skill lists, etc), then the character himself who is also a class and inherits from the specific career class.

All classes except for the character itself will be in a "library" py file, with the program's "mechanics" (the generation process itself, saving to file, etc) being in the "main" py file.

Very enjoyable and educative so far!
 
As you may have seen from my previous threads, I am slowly teaching myself Python 3 by writing various RPG-related scripts ...

The main concept is this is a super-class called Career which has all the chargen methods, then a specific career class which inherits from it and sets the career values (enlistment, survival, skill lists, etc), then the character himself who is also a class and inherits from the specific career class.

All classes except for the character itself will be in a "library" py file, with the program's "mechanics" (the generation process itself, saving to file, etc) being in the "main" py file.

I've been working on something very similar, and have also enjoyed it very much. I'll be able to share code in a few days, if you want to see it. You can see what it does in the "Young Thug" thread, which I just started.

My class organization is a little more complex, and goes like this:
class Rpggen contains basic RPG stuff (dice, tables, etc.)
class Traveller contains "generic" (really "Classic") traveller rules
class CepheusEngine inherits most things from Traveller, but implements anything specific to CepheusEngine (for example, the extra skills in basic training).
Both Traveller and CepheusEngine contain an object called Career, which does what you would expect. (CepheusEngine Career inherits from Traveller Career.)
Both Traveller and CepheusEngine contain a class called Character, which also does what you would expect. (CepheusEngine Character inherits from Traveller Character.)

Tables (which are part of Rpggen) can be created directly as Java object, or read in from json files, or read in from plain text files. Dice are specified by strings, as you would expect: d6, 2d10, 1d6+2, etc.

If you've got any questions, just ask. It's fun!

Joshua Levy
 
Cool, would you consider putting it on the makhidkarun repo so others can pitch in? Work is pointing me back to Python, though 2.x. Feel free to grab potentailly useful ideas from my CT_Character_Generator efforts. They are my Ruby conversions of PHP ideas. Also, if you're interested, Python should be able to use the Names database.
 
Cool, would you consider putting it on the makhidkarun repo so others can pitch in? Work is pointing me back to Python, though 2.x. Feel free to grab potentailly useful ideas from my CT_Character_Generator efforts. They are my Ruby conversions of PHP ideas. Also, if you're interested, Python should be able to use the Names database.

At the moment, the code is too ugly to show in public. But my goal is for it to be pretty, at least pretty enough for a first release, in a month or two. Please PM me, or post here, to describe what makhidkarun is. I know it's a git repository, but what is it's goal, how is it administered, etc. That is what I'd like to know. Do I post my code on my git repo, and makhidkarun "points" it, or do I upload it to makhidkarun directly?

Joshua Levy
 
Hey Joshua!

You should be able to join the Makhidkarun GitHub organization directly, create a repo, and upload your code there. I took a quick look at the young thugs output page, not bad!

Having my code on GitHub makes life easier for me. I can ask questions on IRC or e-mail lists and point straight to fresh code for feedback. It does mean my work isn't nice and shiny but I'm more a pragmatic "how can I make this better?" type. Exposing the code pushes me to improve both code and design decisions.

If you have any issues with getting into the project, let me know. Makhidkarun is more a shared repo that a few Traveller players code-congregate at than anything else.
 
I'm kicking myself that I didn't search harder for T5 tools. I'm close to a release candidate for a T5 system generator. Work in progress is at https://github.com/egor045/T5_worldgen; current latest branch is v0.1-json-import. I'll be merging that to master once things have been cleaned up a bit and I've written some documentation.

I've cloned makhidkarun/t5 and will see how much of my code might be useful in there.

I've been using Python (2.7, but it should work in 3.x as well).For context, I'm planning to use T5 worldgen for a myTU campaign using Cepheus System rules.

Arthur
 
I'm kicking myself that I didn't search harder for T5 tools. I'm close to a release candidate for a T5 system generator. Work in progress is at https://github.com/egor045/T5_worldgen; current latest branch is v0.1-json-import. I'll be merging that to master once things have been cleaned up a bit and I've written some documentation.

I've cloned makhidkarun/t5 and will see how much of my code might be useful in there.

I've been using Python (2.7, but it should work in 3.x as well).For context, I'm planning to use T5 worldgen for a myTU campaign using Cepheus System rules.

Arthur

Logged an issue as it requires Pseudohex and I'm not seeing references to the requirement. Not able to find pseudohex module either, but that could be operator error on my part.

The print statements seemed to fail under Python 3. Golan2072 uses Python 3, I'm installing it for a class though my system comes with 2.6. Might be a design decision on which version to focus on first.

This is why I like shared spaces like Makhidkarun; more eyes on the code, more feedback.
 
Question: I've got a github account with a fair amount of never released and mostly incomplete Traveller software (I made a goal to finish 1 this year and get it into the app store. So hopefully one will get completed) Can a repo include another or does it all have to hang out in one space? My stuff is all C# but as mentioned upstream, more eyeballs are always good (and maybe make me move faster than a resting sloth)
 
Question: I've got a github account with a fair amount of never released and mostly incomplete Traveller software (I made a goal to finish 1 this year and get it into the app store. So hopefully one will get completed) Can a repo include another or does it all have to hang out in one space? My stuff is all C# but as mentioned upstream, more eyeballs are always good (and maybe make me move faster than a resting sloth)

Makhidkarun is an "organization" that hold repositories. You can add a repo by just creating one and pushing up code. or by forking, I believe. You can have multiple repos of the same code but will need to watch how you handle in on your local machine. And plan on how merges are done, etc.

Send me your GitHub ID and I'll add you if you're not already in the organization. Then you can play with how to slosh the code around.
 
Logged an issue as it requires Pseudohex and I'm not seeing references to the requirement. Not able to find pseudohex module either, but that could be operator error on my part.

The print statements seemed to fail under Python 3. Golan2072 uses Python 3, I'm installing it for a class though my system comes with 2.6. Might be a design decision on which version to focus on first.

This is why I like shared spaces like Makhidkarun; more eyes on the code, more feedback.

That's one of the cleanup tasks :)

I should really add the cleanup tasks as issues in Github rather then tracking them in a private list. Adding a "move cleanup tasks to issues" task ... done
 
Logged an issue as it requires Pseudohex and I'm not seeing references to the requirement. Not able to find pseudohex module either, but that could be operator error on my part.

The print statements seemed to fail under Python 3. Golan2072 uses Python 3, I'm installing it for a class though my system comes with 2.6. Might be a design decision on which version to focus on first.

This is why I like shared spaces like Makhidkarun; more eyes on the code, more feedback.

Making Pseudohex available is one of the cleanup tasks :) (I had it installed on my dev machine so actually making it generally available slipped down the list). I've just now uploaded it to PyPi; presumably it will be installable in due course. I'll add Pseudohex to T5_worldgen in the meantime.

+1 on shared spaces. Eyes and feedback are good.

I'd be very happy to put this in a Makhidkarun repo, if you'd be prepared to let me do that.

Arthur
 
Making Pseudohex available is one of the cleanup tasks :) (I had it installed on my dev machine so actually making it generally available slipped down the list). I've just now uploaded it to PyPi; presumably it will be installable in due course. I'll add Pseudohex to T5_worldgen in the meantime.

+1 on shared spaces. Eyes and feedback are good.

I'd be very happy to put this in a Makhidkarun repo, if you'd be prepared to let me do that.

Arthur

You should have a github invite now. Let me know if there are any issues plopping your code in.
 
Back
Top