Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


mousetail

Member Since 30 Nov 2012
Offline Last Active Yesterday, 04:01 AM

Topics I've Started

Are monsters data?

23 April 2015 - 05:16 AM

So, if you have read by blog, you know I am working on a roguelike in python. For this, I need a large list of monsters and items, all with distinct properties, behavior, visuals, stats etc. Right now, at load time, I use decorators to add them all to a large list, but I really dislike doing anything at load time, especially since it creates annoying circular dependencies that require me to import modules at the end of code files instead of the beginning.

Also, I feel like I am missing some encapsulation since the player object has about 25 functions, and all items have to reach threw the player to do anything. However, most of the players functions are internal since my system for handling turns works most efficiently with every action having it's own function, some requiring 2. For example, I have the wear command. This calls removeFromInventoryByLetter(letter) and if that function successfully gets a item, I call wear(Item). My container class also uses removeFromInventoryByLetter(letter) when putting a item into the container, but this code is in the container class, outside the player class. This method should however not be directly used by the AI, since it doesn't calculate movement cost. Neither of them should use the function displayWelcomeMessage(). If I wanted a object to explode when touched, I would do something like self.owner.world.explosion(self.owner.position, magnitude) and then remove myself from the players inventory. It just seems like there will be a extremely high chance of getting bugs by calling a invalid method or a reference not set properly or a method that in some cases has to depend on whether the player is alive and sometimes shouldn't.

I am just curious how you would go out organizing a large amount of very similar classes, with slightly different code, that only get a reference to there owner (The player or a monster) with which to access the world.

 

(I realize this is a bit of a run-on post, if you are confused, just give up)


Does the old art site from the gamemaker FPS tutorials still exist?

09 March 2015 - 03:21 AM

I need some textures for a teck demo I am doing. I remember a website called something like "davdeg" from the game maker FPS tutorial. I tried searching on Google, but I guess I remembered the name wrong. I can't find the tutorial anymore either with the yoyogames site redo. Does any body know if this website still exists, and if so, where the adress is? And if not, does anybody know a art site with a similar site?


Am I overengineering

29 December 2014 - 05:23 AM

I am just starting working on a RPG. (Well actually, I have been working on it for 6 months, but I had to restart some time ago, using different technology). Anyway, I had just finished building a system to give monsters turns depending on there speed and that type of stuff, when I wanted to start working on the combat system. But for the combat system, I think I will need a HUD first, so I can debug the players HP and level and stuff, and I would need a HUD later anyway, so I thought I would do it right away. I wanted a message system similar to old games like nethack that you could read back from to see what happed in the past, and I thought I might need other off screen elements like inventory or a detailed examine/encyclopedia window later. I didn't want this to get all to complicated, so I decided to split the screen in 4 sections, that I call windows, one big one to show the screen, one for stats, one for log lines, and one for inventory. The problem was that all drawing and main stuff was handled by one class called "Isometric_Rendered", that also called the level generators "Generate Level", stored the level, kept track of all objects in the world (different from level in this case), passed all events on to the player object, managed when AI got turns, drew the debug log while loading to show progress of level generator, and a whole lot more stuff. Taking out the render world code and placing it in a "Window"class would be easy enough, but the renderer, of course, needs access to the level data. So I Thought I would build a world object that took out this part of the main classes responsibilities. But then, would every level have its own world object, or would there be one global world object, or should I just assume there is only one level as long as there is only one level, and worry about that part later when I actually have multiple levels?

 

So does anyone have any comments on the way I am doing this?

 

(I realize that this is a horrible run on paragraph rant, but if you don't like the post but have nothing to say about my problem, I would rather that you PM me then that you post about that, I know some people on this form who like to go around posts and complain about peoples grammar, but could those people just PM)

Ask if there is anything I can clarify.

The art is temporary, until by artist has time


Slow performance on A*

15 October 2014 - 02:55 AM

For my level generator, I need to connect my rooms with passageways. I don't want pasageways to run straight thew other rooms, or crash straight allong walls, turning a whole row into doors, wich looks ugly, so I decided to use a more complicated algorithm to find the path for the paths:

        weightsgrid=Grid([self.rowsize, len(self.data)/self.rowsize],-1)
        weightsgrid[pointa]=1
        tries=0
        while weightsgrid[pointb]==-1 and tries<100:
            tries+=1
            for coords in weightsgrid:
                if weightsgrid[coords]>=-1:
                    posible=[]
                    if weightsgrid[coords]!=-1:
                        posible.append(weightsgrid[coords])
                    for adj in getadjacent(coords):
                        try:
                            if weightsgrid[adj]>0:
                                posible.append(weightsgrid[adj]+max(weights[self[adj]],weights[self[coords]]))
                                #print "Did SOmething"
                            else:
                                pass
                        except IndexError:
                            pass
                            #Can forget about this error since we don't care about values outside the grid
                    if len(posible)>0:
                        weightsgrid[coords]=min(posible)
        
        walkposition=tuple(pointb)
        l=None
        tries=0
        if not function:
            l=[]
            function=l.append
        while walkposition!=tuple(pointa) and tries<len(self.data):
            try:
                walkposition=min(getadjacent(walkposition),
                             key=lambda x: weightsgrid[x] if weightsgrid[x]!=-1 else 8388608)
            except IndexError:
                print walkposition
            #weightsgrid[walkposition]=8388608
            function(walkposition)
            tries+=1
            #print tries
        self.weightsgrid=weightsgrid
        return l

note that the class that generates subclasses grid, so self is also a grid object. The function works mostly well, but takes 2 or 3 seconds to run (least is 0.1 second, most is 5 seconds) and since I need to run it 19-38 times each time I generate a level, it becomes kinda unacceptable. Since I am doing this to learn, in the future I might need to use a similar system to for enemy movement, so I want to know what I am doing wrong.
 
Just in case you need it, this is the rest of my generator function:

        numrooms=len(self.data)//512
        rooms=[]
        print "0}GENERATING ROOMS"
        for i in range(numrooms):
            ok=False
            tries=0
            while not ok:
                x=random.randint(10,self.rowsize-19)
                y=random.randint(10,len(self.data)/self.rowsize-19)
                width=random.randint(8,16)
                height=random.randint(8,16)
                floormats=random.choice([(3,4),(5,6)])
                room=[x,y,width,height,floormats,Storage_Obj()]
                ok=True
                for room2 in rooms:
                    if ((room[0]<room2[0]+room2[2]+3) and #room.right>room2.x and room.x<room2.right
                        (room2[0]<room[0]+room[2]+3) and
                        (room[1]<room2[1]+room2[3]+3) and
                        (room2[1]<room[1]+room[3]+3)):
                        #print room,room2
                        ok=False
                if not ok:
                    tries+=1
                    #print "tries: ",tries
                if tries>1000:
                    print "failed after",tries,"tries"
                    break
            if tries<=1000:
                rooms.append(room)
        
        print "Len(rooms)=",len(rooms)           
            #print [x,y,width,height,floormats]
        print "0}Bordering rooms!"
        for room in rooms:
            for i in range(room[0],room[0]+room[2]+2):
                
                for j in range(room[1],room[1]+room[3]+2):
                    ok=False
                    while not ok:
                        if (i==room[0] or i==room[0]+room[2]+1 or #x position
                            j==room[1] or j==room[1]+room[3]+1):
                            self[i,j]=random.choice([1,1,1,1,1,2])
                        else:
                            self[i,j]=random.choice(room[4])
                        ok=True
        print "0}Connecting rooms!"
        timesperroom=1
        totaltimes=timesperroom*len(rooms)
        timestried=0
        lasttime=datetime.datetime.now()
        for room1 in rooms:
            room2s=[random.choice(rooms) for i in range(timesperroom)]
            for room2 in room2s:
                if room1!=room2:
                    timestried+=1
                    center1=room1[0]+room1[2]//2,room1[1]+room1[3]//2
                    center2=room2[0]+room2[2]//2,room2[1]+room2[3]//2
                    #try:
                    print "Running a*! ({0:0>2}/{1:>2}) time: {2}".format(timestried,totaltimes,datetime.datetime.now()-lasttime)
                    lasttime=datetime.datetime.now()
                    self.astar

edit: I see people don't get my problem, so I am going to post a few screen shots to show what I mean:

Attached File  gamedev1.png   74.75KB   1 downloads

these are my rooms, but I need to connect them. So I run A* and I get:

Attached File  gamedev2.png   73.96KB   1 downloads

this is great, except that it takes 5 minutes to run!


Level Design in Visual Stuido 2013 & XNA

21 May 2014 - 10:07 PM

So, I am working on a RPG, and I need a level editor. I first wanted to make it a separate program, with the game consisting of a engine, the game, and a level editor. The advantage of that was you could reuse the engine and the level editor to make more games. The problem is that the level editor should be able to import its own graphics without opening Visual Studio, but there doesn't seem to be a way to load external images. Yesterday I go the idea that instead of a separate program, the level editor could be a visual studio extension. The problem with that is I would need to update it many times while I already started using it, and I don't know if that would work.

This seems like a common problem, how do you do your level editing?


PARTNERS