Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


mousetail

Member Since 30 Nov 2012
Offline Last Active Today, 07:17 AM

Topics I've Started

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   0 downloads

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

Attached File  gamedev2.png   73.96KB   0 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?


My sci-fi RPG game design

17 May 2014 - 08:21 AM

(sorry about the misspelling in the title) MOD EDIT: fixed the title spelling, I think :)

Hello people, its almost my summer holiday, and in my holidays I usually work on big projects. I have a idea for a RPG that I am going to make and I want to know what you think. I might not finish it, so don't be disappointed if i end up with half the features that I listed here.

 

So the basics are like a normal RPG. You have many skills, you can train in them, and you can go on quests.

skills:

The first thing that is unique is that you don't know what skills exist until you have trained in them. That way, there can be a large amout of skills without every player needing to train fully in every one of them. The skills will be grouped into categories, and you get prizes for having level something at every skill in a category. Skills can be part of more then one category. You also have a level in each category witch is usually your highest level of the subskills, but in some, a custom formula is applied. entire categories can also be in other categories, and if that is the case, the category is called the skill, and the others are "Subskills" that are not in your normal skill list, but by clicking on the parent skill. For example, if mining metals and mining gems uses a different technique, then they would be separate subskills of mining, but for most purposes, you only care about your skill in mining.  Here are a few ideas for skills:

Mining & Smiting: same as in other RPGs

Electronics: build devices

Piloting: Riding vehicles, has many sub skills. Because driving spaceships is hard

Farming: this will probably be a one-place skill, and you need to return to this again to harvest your crops

Nanotechnology: allows you to build nanobots in labs

Combat: Divided into defense, strength and accuracy,  covered later on

Knowledge: this will be the most important skill, it increases whatever you do and is needed for most quests

A skill about making cloth

Thieving: pickpocketing, lock-picking, and other related gunk

 

 

 

(any more ideas, people?)

Combat:

combat will be turn based. probably for melee style weapons walking into your enemy will do attacking, for ranged it will probably be WASD if arrow keys are for moving.

Weapons will deal a certain damage type (they can also deal more then one) and armor will be more protective against certain damage types (eg. Iron armor will be weak against electric, but strong against laser). There will be no real distinction between melee and ranged except for the range

here are a few ideas for weapons:

Normal: swords, arrows, clubs, classic weapons, don't do much damage against more modern armor

Electric: metal swords and arrows can be statically charged so they do more damage, though they need plastic handles to be used in this way, there are also devices that zap large amount of electricity to a enemy, but do no normal damage

Laser: laser guns for ranged, and maybe a type of light saber for melee

Heat: if a item is really hot it can do small amounts of heat damage. Plasma weapons deal large amounts

Radioactive: This is also a "extra" to weapons that mainly deal normal damage. it has a delayed effect.

Bioweapon/Nanobot sending microscopic stuff into your opponents body. this damage is not done much in combat, but "needle darts" can do it, gas bombs can sometimes deal this type of damage

Gas: send a poison gas at your enemy, for defense, it only effects the helmet/mask, Also used in traps

note that for electric, gas, heat and radioactive, the user needs to protect himself against it also, especially for radioactive, this is a big down side for using it, since you need to wear full anti-radioactivity armor.

combat won't be as important as it is in some RPGs, you can stay out of combat a lot of time if you want to. Dieing will return you to your latest checkpoint, or at a save point.

 

The game will be isometric 3d, like my last game (see my signature), but this time I will use XNA instead of python. Tell me if I have forgotten some important information. I need to finish my final design by next week, so please reply fast.


Best physics and game engine

09 January 2014 - 05:54 AM

I don't know much about how this is done, so if I am asking a stupid question, just redirect me to the answer.

 

In C#, I recently hacked my way into displaying graphics on the screen. It was a bit slow, especially the collision checking. I wondered if there was a better way of doing using a game engine of some sort. Now I have a idea for a game that needs physics (I probably am not going to make it, but just in case) Can someone redirect me to a place that has information about this stuff, like a nice table that lists each of there features or something?


How to install GCC

18 December 2013 - 11:02 PM

I just got a new book about C and I am excited to learn the language that is used in most games, but the book says I need to install GCC. I found the GCC website, but it doesn't seem to have any download link anywhere. The only link it has leads to cygwin.com, and I don't see how that is related to C. Can anyone give me the link to download GCC for windows?


PARTNERS