Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mathematikus

Pages: [1]
1
Programming / Beginner Question: How should maps relate to objects?
« on: November 22, 2015, 06:50:08 PM »
Recently I have studied the Complete Roguelike Tutorial, using python+libtcod (http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod) and I have been trying to implement some of the ideas with Python 3 and PyGame. Mostly I have been thinking about basic things like how objects should be modelled, how to split the required tasks to separate files etc. More sophisticated things like procedural generation of dungeons and Field of View algorithms are not top priority. I (suppose) am a novice in programming so a lot of the problems I have are probably elementary. I can do basic stuff like player object moving inside a map (list of lists of Tile objects).

If I have understood the code of the tutorial correctly, when going to the next map the new map is written over the old map. What if I want to keep the old maps and their contents?
I think maps should have their own class, but what I'm wondering is how the maps should relate to objects within them. Should maps have a 'list of objects' attribute that keeps track of what objects are inside it? Should the objects have an attribute or a function that identifies the map that they are inside of? Both? I would like to know how is this problem has been solved by more experienced people. The tutorial has a global variables 'map' and 'objects' (the list of objects). I think what I want is a list or a dictionary of maps. I am assuming the game is structured in a way that is similar to the tutorial (object composition etc).

2
Programming / First Roguelike on Python 3
« on: July 28, 2015, 03:39:15 PM »
Lately I have been learning Python 3 I would like to try and make a simple roguelike.

The apparently popular "Complete Roguelike Tutorial, using python+libtcod" uses Python 2.7. and says that libtcod is incompatible with Python 3.
However I have found a library called tdl (https://pypi.python.org/pypi/tdl/1.5.0) which promises to be a similar library that works with Python 3.4.
Does anyone here have experience with it? Is it similar enough to libtcod that one can follow the old tutorial?

For context:
I'm not very experienced programmer, but I can handle basic things and am not afraid of math or logic.
Admittedly there are things in programming that baffle me, although hopefully that can be surpassed.

So: Is it good idea for a beginner to try to make a roguelike in Python 3?
I would prefer to do this rather than revert to Python 2.7.
I could also imagine learning an engine (Unity? Godot?), but learning an actual language seems like it could be a good time investment.

Pages: [1]