|
Post by Daedalus on Jan 27, 2015 21:06:10 GMT
I feel like I could make a decent text-based game with a month of time, if I had a plot to work with ( The Anarch?). Helloooooooooooo! I had an idea for a fanfic that I was trying to write some time back. It might actually work pretty well as an adventure game, be it textual or graphical. A single main character with various puzzles to solve, etc. I could drag it back out and see about making it game-ready once we know what kinda game it'll be. Or if you're still wanting to do a fighter, I might could come up with something for that right quick. Either is fine, though I already wrote the idea of a combat system. But I want to hear this plot do you want to PM me or put it here? I'm not particularly into fighting games anyway. But I don't want that code to go to waste if possible.
|
|
|
Post by The Anarch on Jan 27, 2015 21:13:41 GMT
But I want to hear this plot do you want to PM me or put it here? I'll slide a PM your way here in a minute, just gotta weed out a couple things. Most of the idea file for the story is a copy/paste job from an instant messenger conversation about it. Depending on how it goes, maybe both games could be made! Never know!
|
|
|
Post by Daedalus on Jan 27, 2015 23:22:01 GMT
Depending on how it goes, maybe both games could be made! Never know! Well that would require someone else to join the project (glare at everyone)
|
|
|
Post by Daedalus on Jan 28, 2015 5:59:09 GMT
COMBAT SYSTEM V2.000002:
# TESTING TOOLS def test(var): print(var) input() def panic(): raise SystemExit def customize(): while True: temp=input('Command: ') if temp.lower()=='quit': break else: try: exec(temp) except: print('command not recognized')
# CLASSES AND DEFINITIONS
#pretty boring #just clears console def clear(): print('\n'*75) #designed for syntax of exec(marker(number)) #to execute all effects at that time point def marker(num): global relevant_effects command='' for effect in relevant_effects: #effect syntax is [type, time, effect] #such that the effect is a string of code if effect[1]==num: command+=effect[2]+'; ' #chain it to the others being used relevant_effects.remove(effect) #delete the ability once it's used return command
#player traits are stored in player_list dictionary #currently they are [hp, p_atk, s_atk, abilities, items] #abilities is a list containing lists of [type,time,effect] class Player: global player_list, player_traits def __init__(self,name): self.name=name #shortens repetitive self.hp=players[name][0] etc #this also allows further trait addition later for i,trait in enumerate(player_traits): exec('self.{}=player_list[name][{}]'.format(trait,i))
#passive items have continuous effects (itself a list) #they can be added or removed by inherent methods class Passive_Item: global player, player_traits def __init__(self,name,effect,boosts): #boosts is a list of stat modifiers #which should be of length three #effect is nude code in a string self.name=name self.effect=effect self.boosts=boosts def attach(self,player): for i,trait in enumerate(player_traits[:-2]): exec('player.{}+=self.boosts[i]'.format(trait)) #when attached, the boosts modify permanently #this prevents it to have to check it every time self.owner=player player.items.append(self) def remove(self): player=self.owner for i,trait in enumerate(player_traits[:-2]): exec('player.{}-=self.boosts[i]'.format(trait)) #when removed it gets rid of previous boosts player.items.remove(self)
#active items can be used a fixed number of times #when used up they disappear automatically class Active_Item: global player def __init__(self,name,effect,uses): self.name=name self.uses=uses self.effect=effect def attach(self,player): self.owner=player player.items.append(self) def remove(self): #does not require owner to be named player=self.owner player.items.remove(self) def activate(self): #syntax: exec(Active_Item.activate()) self.uses-=1 #denote that it has been used once if self.uses==0: self.remove() #automatically removed when no activations remain return self.effect #STORAGE OF BACKGROUND INFO ON MOVES, PLAYERS, ETC player_traits=['health','physical','special','defense','abilities','items'] #first three stats are designed as simple integers #fourth is a list of lists; format [[type,time,string],...] #type is a string (atk, def, or both), string is code #fifth is a list of objects, initializes to empty player_list={'annie':[500,10,50,100,[['both',3,'print(\'hellooooo\')'],['atk',1,'print(\'blah blah blah\'']],[]], 'eggers':[1000,40,15,200,[],[]], 'renard':[700,30,30,500,[],[]], 'coyote':[2000,50,200,1000,[],[]], 'shadow':[300,0,50,1,[],[]]} '''off_abil={'annie':[['either','if crit_hit: damage*=2']], 'coyote':[['either','damage*=100']], 'eggers':[], 'renard':[], 'shadow':[]} def_abil={'annie':[], 'coyote':[], 'eggers':[], 'renard':[], 'shadow':[['physical','damage*=0'], ['special','damage*=2']]}''' #attack format: {'name':[type,power,extra effects],...} attacks={'blast':['special',50,'crit_chance+=40'], 'punch':['physical',30,''], 'boxbot_nuke':['special','PlayerD.health/PlayerA.special','print(\'helloooooo\')']} #these are modifiers that apply equally #to both players and universal constants import random global_effects=[] skynet_cost=99999999 crit_mod=1.5
#ASSIGN PLAYER IDENTITIES while True: try: #prompt player's name; break when both are legal all_chars='Legal names: ' for character in player_list: all_chars+=character.capitalize()+", " all_chars=all_chars[:-2]+'\n' print(all_chars) Player1=Player(input('Character 1? ').lower()) Player2=Player(input('Player 2? ').lower()) break except: pass
#DETERMINE ATTACKING/DEFENDING PLAYER PlayerA=Player1 PlayerD=Player2
#screwing around testing space Sword=Passive_Item('sword','print(\'this is my sword. there are many like it but this one is mine\')',[1.5,1.5,1.5,1.5]) Sword.attach(Player1) Torch=Active_Item('torch','print(\'torch\')',3)
#For as long as the program runs... while True: while True: #keep prompting attack name until something is legal try: #prompt attack's name move=attacks[input(PlayerA.name+'\'s turn: ')] #when legal answer is given, break loop break except: pass #gather all relevant effects into the eponymous var #an effect is relevant if it's defensive for PlayerD #or if it's offensive for PlayerA, or if it's for both relevant_effects=[] for ability in PlayerA.abilities: if ability[0]=='atk' or ability[0]=='both': relevant_effects.append(ability) for ability in PlayerD.abilities: if ability[0]=='def' or ability[0]=='both': relevant_effects.append(ability) #activate active items? if input('Activate items? ')[0].lower()=='y': name=input('Name: ') exec('exec('+name+'.activate())') #this is what I get for writing general cases #inside exec( yields the return from activate() #outside exec( executes this code in turn ugh print('Remaining uses: '+str(eval(name+'.uses'))) #this in turn is another abomination due to the fact #that the name of the object referenced is not known #DETERMINE MOVE POWER damage=eval('move[1]*PlayerA.{}'.format(move[0])) damage/=PlayerD.defense test(damage) #APPLY CRITICAL HITS crit_chance=50 #redefined each time so effects can modify it #determine if the hit is critical crit_hit=False rand=random.randint(0,100) if rand>crit_chance-1: damage*=crit_mod crit_hit=True print('Critical hit!') #APPLY DAMAGE TO DEFENDING PLAYER print(PlayerD.health) #actually apply damage PlayerD.health-=damage print(PlayerD.health) #SWITCH ATTACKING/DEFENDING PLAYERS if PlayerA is Player1: PlayerA=Player2 PlayerD=Player1 else: PlayerA=Player1 PlayerD=Player2
Minor changes. Though I have not added many abilities or character traits, or tried to balance their stats, that's easy to do from here. About to design a system for position/objects in a room. Yay, nights without work.
|
|
|
Post by Daedalus on Feb 8, 2015 7:49:32 GMT
MOVEMENT SYSTEM V1.000001:
def test(var): print(var) input() def rock(): print('you can\'t move here!') return False def empty(): return True def move(dire): global c_p, dire_def old_cp=copy.deepcopy(c_p) c_p[0]=c_p[0]+dire_def[dire][0] c_p[1]=c_p[1]+dire_def[dire][1] try: if not master_map[c_p[0]][c_p[1]](): c_p=old_cp except NameError: exec(master_map[c_p[0]][c_p[1]]) def display(): print('\n'*75) global master_map, c_p global map_indicators disp_str='' for i in range(len(master_map)): for j in range(len(master_map[0])): temp=master_map[i][j] if [i,j]==c_p: disp_str+='U' elif temp==empty: disp_str+=' ' elif temp==rock: disp_str+='X' disp_str+='\n' print(disp_str) import copy dire_def={'w':[-1,0],'s':[1,0], 'd':[0,1],'a':[0,-1]} [r,e]=[rock,empty] master_map=[[r,e,e,e,r,r,e,r,r,e], [r,e,r,r,e,e,e,e,r,e], [r,r,r,e,e,e,e,e,r,r], [e,r,e,r,e,e,e,e,r,r], [r,e,r,e,r,e,e,e,e,e], [e,r,r,e,r,r,e,e,r,r], [r,e,e,e,r,r,e,e,e,e], [r,r,e,r,e,e,e,e,r,e], [r,r,r,r,e,r,e,e,e,r], [e,e,r,e,r,e,e,e,e,r]] map_indicators={empty:' ',rock:'X'} #called master_map[row][column] #so, for example, [0][3] is 4 #going up is a decrease in map[0] c_p=[1,0] while True: display() move(input('dire? '))
Very basic movement system, currently wsad. Potential to be expanded through definition of square meanings. Expandable to any number of maps and objects, but I'm too lazy to add examples or comments. I will fix this later. Good night, all.
|
|
|
Post by Daedalus on Feb 8, 2015 21:07:05 GMT
MOVEMENT SYSTEM V1.000002:
def test(var): print(var) input() def rock(): print('you can\'t move here!') return False def empty(): return True def move(dire): global c_p, dire_def old_cp=copy.deepcopy(c_p) #back up old location coordinates c_p[0]=c_p[0]+dire_def[dire][0] c_p[1]=c_p[1]+dire_def[dire][1] #add the direction list from dire_def try: if not master_map[c_p[0]][c_p[1]](): #all types of square (currently #just rocks and empty squres) #have a function defined with #that name above defining what #should happen when you move there #and is then called. In addition #to the effect of the square itself, #each of these methods returns a #boolean of whether the move is #legal. If not, your position is #returned to the backup copy. c_p=old_cp except NameError: exec(master_map[c_p[0]][c_p[1]]) #if the map square is not defined, #it will be custon nude code there #which is then compiled and executed def display(): print('\n'*75) global master_map, c_p global map_indicators disp_str='' for i in range(len(master_map)): for j in range(len(master_map[0])): temp=master_map[i][j] #find what is in that spot if [i,j]==c_p: disp_str+='U' #display player elif temp==empty: disp_str+=' ' #display empty elif temp==rock: disp_str+='X' #display obstacle else: pass #what to do if there's #no defined function for #this square. Write later. disp_str+='\n' print(disp_str) import copy dire_def={'w':[-1,0],'s':[1,0], 'd':[0,1],'a':[0,-1]} #defines what the wsad keys mean [r,e]=[rock,empty] master_map=[[r,e,e,e,r,r,e,r,r,e], [r,e,e,r,e,e,e,e,r,e], [r,r,r,e,e,e,e,e,r,r], [e,r,e,r,e,e,e,e,r,r], [r,e,r,e,r,e,e,e,e,e], [e,r,r,e,r,r,e,e,r,r], [r,e,e,e,r,r,e,e,e,e], [r,r,e,r,e,e,e,e,r,e], [r,r,r,r,e,r,e,e,e,r], [e,e,r,e,r,e,e,e,e,r]] #th map_indicators={empty:' ',rock:'X'} #called master_map[row][column] #going up is a decrease in map[0] c_p=[1,0] #current position: [row,column] while True: display() move(input('dire? '))
Comments added to clear stuff up. Any additional clarifications welcomed.
|
|
|
Post by fwip on Feb 11, 2015 5:44:31 GMT
Depending on how it goes, maybe both games could be made! Never know! Well that would require someone else to join the project (glare at everyone) I'm up for creating pictures. Like the one above. Give me something to draw and I'll try to draw it for you.
|
|
|
Post by Daedalus on Feb 11, 2015 6:03:10 GMT
Well that would require someone else to join the project (glare at everyone) I'm up for creating pictures. Like the one above. Give me something to draw and I'll try to draw it for you. Give me a bit of time, sorry. It would have to be ported into Java before visuals even begin. I am currently learning Java. It's harder than Python meh. But so much faster, so that's a plus. And more friendly to making games.
|
|
Thoth
Junior Member
Posts: 92
|
Post by Thoth on Feb 11, 2015 6:12:45 GMT
I am currently learning Java. It's harder than Python meh. But so much faster, so that's a plus. And more friendly to making games. I've done a lot with Java. If you want to ask any questions I'm on IRC right now (and will be for several hours at least).
|
|
|
Post by Daedalus on Feb 11, 2015 6:17:02 GMT
I am currently learning Java. It's harder than Python meh. But so much faster, so that's a plus. And more friendly to making games. I've done a lot with Java. If you want to ask any questions I'm on IRC right now (and will be for several hours at least). I'm going to go to sleep soon, but I may ask you in a few days Thank you very much, though forgive me please if I'm still trying to learn the basics.
|
|