last day (214 days later) » 

4:59 PM
I'm starting a text-based adventure game engine, and I'm looking for tips on the best way to store different choices and "paths" the user can take.
No, memory really isn't the issue here, I'm just looking for methods that would make the engine easier to use, and less complicated.
Well, even if it's memory-intensive, I'm interested.
Dictionaries, in this case.
Yup
 
You know you've been programming too much when.... you ask someone what they call their hashmaps and you can then tell what the programming language is.
of course you can
 
My first idea was to have a nested structure for choices, like this: {"start": [someFunction, {"choice1": [someFunction, ...]}, {"choice2", [someFunction, ...]}, ...]} Where someFunction is a function executed when the choice is picked, and additional choices are placed where the ... are.
My only concern is that that method is can be really complicated.
Ahm, well, Python has a recursion limit, but it can be a viable option.
What's your idea?
Well, the current idea seems viable, but who wants to type out a structure like this:
my_map = {
	"start": {
		"func": some_func,
		"choice1": {
			"func": some_func,
			"choice3": {
				"func": some_func,
				...
			}
		}
		"choice2": {
			"func": some_func,
			"choice4": {
				"func": some_func,
				...
			}
		}
	}
}
 
@EthanBierlein I would extract that to a datatype though, then it wouldn't be a risk for a recursion overflow, I believe.
 
Maybe like a GameMap class?
 
@QPaysTaxes Groovy DSLs! The answer to everything!
 
5:13 PM
Man, I wish python could have explicit typing...
 
that's not Python though, of course :)
 
@QPaysTaxes Have you seen the syntax we're now using for Cardshifter? It's kinda neat. For example: github.com/Cardshifter/Cardshifter/blob/groovy/extra-resources/…
What about if you need to go to one room to get a key, and then go back to another room that you've been to before to unlock a door that you need to go through?
I love making people re-think their design choices :)
 
Actually, I'm coming up with another idea rn. It'd use a 2d list to store data, and the player would move using cardinal directions, e.g, north, south, etc.
 
Well, what if you need to choose the right dialogue choice to get a key?
 
5:20 PM
my_map = [
	[{}, {}, {}],
	[{}, {}, {}],
	[{}, {}, {}]
]
Replace each of those {} with something like a MapPosition class that stores data.
 
room topic changed to Adventure Engine: (no tags)
 
Noo, not the s
 
34 messages moved from The 2nd Monitor
19 messages moved from The 2nd Monitor
23 messages moved from The 2nd Monitor
 
There we go. Relocated all the relevant messages here
 
5:24 PM
Doesn't have anything in it yet, but, I'll get there.
 
thought it could be useful to make the history clearer, that's all
 
Did me making you a room owner remove that message? Sounds like a bug
oh, sorry about that. Did not know that
 
Okay, here's what I've implemented for a map room:
class MapPosition(object):
	"""
	This class stores relevant data about the
	position on a map, e.g, is_accessible, or
	required_key.
	"""
	def __init__(self, desc, is_accessible=True, required_key=None, function=None):
		self.desc          = desc
		self.is_accessible = is_accessible
		self.required_key  = required_key
		self.function      = function
Yes
for example:
def run_func(func):
	func()

def f():
	print "a"

run_func(f)
Hmm, seems promising.
Anyways, I'll be back in 5-10m, friend just called me.
 
5:48 PM
Hello @AnnonomusPenguin
 
@EthanBierlein hello!
Psych!
I'm doing great! And you @QPaysTaxes?
What's this room for? I stumbled across it
 
I'm making an adventure game. This is where we talk about it.
 
hey @QPaysTaxes
i love games
 
*Engine
 
@EthanBierlein open source?
 
5:50 PM
Yes
 
@QPaysTaxes #1 reason for terrible code :)
@QPaysTaxes thought so.
 
gonna write it in python i guess? what graphics library?
thats going to be a lot of writing!
 
"""
This file doesn't have anything yet! Maybe
you might want to implement something or
delete it?
"""
 
Yeah, I haven't really gotten anywhere. Yet.
 
5:52 PM
Any unsynced changes?
 
I'm also on a skype call with my friend, so my productivity is already at minimal.
 
So is it ASCII art style games or is it like "You have reached a cactus. Would you like to eat it? [Y/N]"
 
You can fork it or something if you want. I don't care.
 
@QPaysTaxes uh, how do you implement an engine for that?
 
one nice thing about ASCII art is that you can use images to generate it now
 
5:55 PM
Hmm... concept still not making sense 100% (as far as how you would implement this)
Unless it was just like a function for the main control loop and some events like a keypress or banging on the keyboard randomly
Game idea: UNIX based console game. You can type any command in it: the goal is to not break the computer. The person who can type the most unique commands wins.
Easy to program, easy to lose.
 
@AnnonomusPenguin Instant win: :(){ :|:& };:
 
@Mast that would only count as one command tho
You only type one command into it yourself
 

  last day (214 days later) »