Archive

Python

No game reason for this really – I just like the idea of messing around in a quasi 3D star system using the Traveller vector movement.

The aim is to have a 3D box with all the stars, planets centered on a plane so you move in 2D but the visuals are 3D with all the orbiters having their own size, radius and orbit time so they move around on their orbits over time.

The code part is pretty easy if you simplify the orbits to circles. All you need is a class that has planet size, distance (from star) and orbit length. The orbit length gives you the number of degrees the planet moves per day so all you need is a method that takes a time, adds on the degrees moved and moves the planet’s center point.

class orbiter:
def __init__(self, tup):
self.name = tup[0]
self.radius = tup[1]
self.distance = tup[2]
self.days = tup[3]
self.dpd = 360/self.days
self.angle = random.randint(1,360)
self.x = 0
self.y = 0

def dodays(self,numdays):
numdegrees = self.dpd * numdays
self.angle = (self.angle+numdegrees) % 360
#print(self.angle)

def dodraw(self):
radangle = math.radians(self.angle)
self.x = self.distance * math.sin(radangle)
self.y = self.distance * math.cos(radangle)
#print(‘radians:’,radangle,’x:’,self.x,’y:’,self.y)
c1.create_oval(self.x+100,self.y+100,self.x+108,self.y+108,fill=’white’,)

which currently ends up as this

python_solarsystem

(unrealistic orbit distances to test)(the button adds ten days)

This seems like it should actually be pretty easy but will wait until I’ve found out about Python’s Pygame module.

#

Got side tracked from this by the urge to do some Travellerized Dark Heresy chargen so that’s next.

Advertisements

First one done.

python_animalgen

not expert enough to give tips really but might be useful to someone (or me after a gap)

the way i did it was to take the tabular data and put it into a collection of what Python calls a tuple which you can then put into a collection and access as an array so for example adding all the terrain types and their various modifiers into terrain tuples and then bundling them into a tuple of tuples

d0 = ‘Desert’, 3, -3, ‘other’
d1 = ‘Badlands’, -3, -3, ‘other’
d2 = ‘Prairie’, 4, 0, ‘other’
d3 = ‘Hills’, 0, 0, ‘other’
d4 = ‘Mountains’, 0, 0, ‘other’
ds1 = ‘Crater’, 0, -1, ‘other’
ds2 = ‘Gorge’, -1, -3, ‘other’
ds3 = ‘Caves or Ruins’, -4, -1, ‘other’
dryterraintable = [d0,d1,d2,d3,d4,ds1,ds2,ds3]

so the animal size modifier of the ‘Badlands’ terrain type can be accessed as dryterraintable[1][2]

(indexs go 0,1,2 etc)

typing in all the table entries can take a while but once they are all set up going from step to step on the generator is simple enough.

Mine is slightly more complicated as the initial reason was related to my “Early Colonization ATU”. There, I was generating uncolonized planets with native primitive sentients and wanted to quickly generate candidate animals as the precursors of those sentients from the world stats rather than selecting a specific terrain type. That’s why there are two options.

In the early colonization ATU i’m taking atmosphere 2-9 as earth-like but earth at different stages: 2-3 is early earth with life only in the oceans, 4-5 is mid earth with life in the sea and beginning on land, 6-9 is the full deal. To that end i divided the Traveller terrain types into dry, wet and sea categories and atmosphere 2-3 only picks from the ‘sea’ category, atmos 4-5 picks from sea and dry, atmos 6-7 picks from all three. When sea and other categories are both available the hydro proportion weights which is picked.

The second option just picks a terrain from a list and randomly generates an animal based on that.

It’s rough but it does what I need.

As an example one of the colony sites, Irila, in my early colonization sub-sector is a new colony with a native friendly sentient as the most intelligent species (i.e. ant, dolphin, chimp type intelligence) and world stats of 568. These species can somehow become the hook for a particular world in some way.. The idea is to keep generating critters until something jumps out.

The first up is a sea surface dwelling man-sized triphibian social grazer. The social herbivore/grazer part fits with being friendly so maybe some kind of giant flying insectoid critter whose life cycle somehow involves both sea and land. Maybe caste based so it’s only the leaders who are sentient / near sapient.

RPG Styles

###

Type 1:

I’ve always been a scenario type GM i.e. where the GM creates a scenario with a plot, NPCS etc and the players play through the GM’s plot.

I think that’s perfectly fine: the DM gets the fun of creating worlds and plots and the players get the surprise of not knowing what is ahead.

Type 2:

Some people prefer RPGs where all the players generate the world, plot etc as a group. It’s not my thing but I can see why that might appeal.

However some aspects of it do appeal.

Type 3 – Middle Path:

I like creating worlds, scenarios etc so I don’t want to do it the second way but after listening to the various arguments I do like the more sandboxy style the second method generates.

So basically if you’re a GM type but you want to be surprised how can you do it?

One way is to use random generation; that way you still kind of create the setting – because you decide what gets put into the random generation tables – but the specifics are a surprise.

For example in Traveller there are random patron tables, random animal generators etc – so in a sandboxy game you could set up an area of space with only a bare bones description for each system/world and then let the players go where they like. The GM generates content on the fly depending on where the players go and which the players decide whether or not to interact with – making the game more like a procedural video game.

Problem

Generating stuff on the fly out of your own head is fast but you’re rarely if ever surprised.

Generating stuff from tables can create surprises you would never have thought of yourself but can take too long.

Solution

After watching Mr Driscoll’s Python adventures for a while

https://www.youtube.com/user/ShawnDriscollCG/playlists

I thought i’d take the plunge and see if using Python to create fast random generators could be a solution and i’d heartily recommend it to anyone who wants to try the compromise sandboxy method and you’re comfortable with programming. It’s a relatively easy language and is perfectly suited for this kind of linear sequence, generating a result from a set of tabular data with a simple GUI.

My first experiment was turning the classic Traveller animal generator into Python and that was pretty painless. (I’m an ex-programmer who hasn’t touched code for c. 10 years so your mileage may vary.)

The only problem I have now is it’s made me want to do a lot more:

– random conflict generation
– random plots
– random sub-sector/system/world generation
– trade
using either/both Classic and Mongoose tables

also Travellerized Dark Heresy / Rogue Trader
– systems, worlds
– Dark Heresy travellerized char gen

also a simplified random solar system generator with pseudo 3D
– everything happens on a 2D plane but with 3D models of planets, star etc
– 2D classic traveller style vector movement
– no real reason but i want to see visually how that kind of movement would feel with all the planets moving in their orbits

anyway – too many ideas, nothing gets done, so hopefully will be able to pick one at a time

(will post examples as I do them)