• 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.

World generator program for Cepheus Engine/Traveller

Also, in thinking about this, would recommend to a default name for the output files. Getting and filtering user input is a dark art fraught with peril. Just print the name and let them copy it to whatever they want.
 
I've had my best UI success with CGI scripts using Apache and python (and please understand that I'm speaking as a rank amateur...to refer to me as a "hacker" would require one to be thinking in golfing terms, not IT terms.:rofl:

Tkinter and the other available toolkits just dumbfound me. As someone who learned to code on a Vic-20, Python, CGI etc makes sense to me. The WYSIWYG toolkits simply do not.

I did learn PHP for a project once and I thought it was a very useful, intuitive language, being joined at the hip as it is with http but there's just something about Python that brings me back _every_time_ I need to code something.

I'd be interested to dip my toe into a collaborative effort, although I may be more of a hindrance than a help if it requires me to display anything more useful than being keen. And all this newfangled hardware with > 3583 bytes free is just wasted silicon.:rofl:
 
I'm trying to wrap my head around GUI development, with both tkinter and PySide I don't "grok" it yet. Will have to learn other parts of Python first.

How simple is web development (Django? Flask?) for Python?

I've used Flask for a few projects, it's fairly easy to use once you get a basic project working. The problem I have with web development is you need to learn so many different technologies all at the same time. E.g for a typical Flask based web site, aside from the language and Flask you also need to learn a templating system such as Jinja2, HTML, CSS and maybe some JavaScript. With GUI programming once you've got your head round Python and a GUI toolkit you're done.

I do all my hobby programming in PySide on my iPad these days and dont have a desktop dev setup right now, but may change that soon if I can get my hands on a dev box at work as I've got some projects there I'd like to tackle.

StarBase is a bit of a monster. Some of the individual code files are thousands of lines. But it started out based on one of the PyQt example programs and grew from there. EDIT: Actuallly this one -

https://github.com/pyside/Examples/tree/master/examples/graphicsview/diagramscene

Simon Hibbs
 
Last edited:
Back to this once again.

I think I will re-write most of the code now that I've learned dictionaries, and, more importantly, OOP. With OOP, I can greatly simplify the horribly complicated worldgen loops and even create a dictionary of worlds, which might be useful for later projects. Saving a dictionary to file is another mental leap I'll have to go through, though.
 
Back to this once again.

I think I will re-write most of the code now that I've learned dictionaries, and, more importantly, OOP. With OOP, I can greatly simplify the horribly complicated worldgen loops and even create a dictionary of worlds, which might be useful for later projects. Saving a dictionary to file is another mental leap I'll have to go through, though.

Most languages have serializers - you simply convert your object to a string & save to disk. Read from disk & convert from string back to the object.

In pseudo-code:
var serializer = new Serializer<object you want to serialize>;
string s = serializer(object);
write to disk (s)

and the reverse - read a string (or series of strings to get a list of objects) and deserialize them

There are usually libraries or gems to do all the heavy lifting for you (sometimes the native code ones are...complicated)
 
I would recommend outputting JSON format to a straight text file. Pickle means only python people can use it. Another option would be SQLite, a file base database using mostly standard SQL.

Addendum: Python's JSON module. And a PHP based example of using SQLite.
 
I would recommend outputting JSON format to a straight text file. Pickle means only python people can use it. Another option would be SQLite, a file base database using mostly standard SQL.

Addendum: Python's JSON module. And a PHP based example of using SQLite.

Sadly XML is going out of vogue but does offer some advantages.

SQLite is pretty much universal and simple to use for the most part. There are also standalone programs to be able to look into & edit the SQLite DB, so if done this way you could simply pass the DB file as well. IIRC, SQLite is a single file for the database.

Sticking with a standard (JSON, XML) that other systems can read/write is generally a good idea if you want data interchanges.
 
JSON in HTML

I would recommend outputting JSON format to a straight text file. Pickle means only python people can use it. Another option would be SQLite, a file base database using mostly standard SQL.

Addendum: Python's JSON module. And a PHP based example of using SQLite.

Does this help?

https://github.com/MaggotIISS/xxxTFX/blob/master/src/web/traveller/WorldGen.html

another unfinished project

https://github.com/MaggotIISS/xxxTFX/blob/master/src/web/bits2page/CounterMaker.html
 
Last edited:
Back
Top