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 - Hundertzehn

Pages: [1]
1
As soon as you start doing it right, it works!  ;)

2
I am at the stage where I finally want to save the current game on disk.
I have an instance of a map object. In it, there is a list of instances of the tile object. The tile object has a list of instances of the thing object, one list entry for every thing on that tile. Things can have inventories, thus more lists with more thing instances.

A few loops and "pickle" could solve this problem, but I wonder if there is a more elegant solution.


3
Development Process & non-technical / Re: My project - HesseRL
« on: November 13, 2014, 02:20:06 PM »
Slow progress. I now have doors. ;)

4
Development Process & non-technical / Re: My project - HesseRL
« on: November 07, 2014, 03:34:05 PM »
My map can now be bigger than the screen, and it even scrolls so that the @ stays in the center.

5
Development Process & non-technical / Re: My project - HesseRL
« on: November 04, 2014, 08:05:13 PM »
I made progress.
I now have an action economy system. Different actions (like walking diagonally) can take different amounts of time, and different creatures can be faster or slower than others.

Also, fighting works, and slain enemies even leave corpses!

6
Development Process & non-technical / Re: My project - HesseRL
« on: October 29, 2014, 10:53:34 PM »
I spent much time eliminating a few minor, but ugly looking glitches in my shadowcast algorithm. I was shortly tempted to simply switch to a library, but am glad I pulled through and now have my own code in working order.

I also reorganized my object system. Walls are now objects like everything else, they just sit on tile locations and block movement and LOS - which means it is now trivial to add the possibility to destroy walls.

The interface is now roughly like I want it, with WASD for movement and mouse (or arrow keys for purists) to look around, point the flashlight and shoot things. Are there roguelikes out there with a WASD/mouse interface? (I guess the answer is yes, but where can I find them?)

Next on the list: - Make it so that things can be destroyed!

And my near term goal is a very simple game, just one level to run around, search the exit and avoid/shoot the zombies. At the current speed, it could be finished next week.

After that: - Inventory!
After that: - Level generator!

7
Programming / Re: [Beginner] Strange shadowcast
« on: October 29, 2014, 10:56:01 AM »
In my circular shadowcast, there are a few cases where it is possible that one tile is blocked by an other tile with the same (integer value) radius. I didn't check for that, but just assumed that tiles could only be blocked by tiles with a smaller (integer value) radius. One additional check later, all seems fine!

8
Programming / Re: [Beginner] Strange shadowcast
« on: October 29, 2014, 08:22:52 AM »
I'm back to the shadowcast. The devil is in the details. I have one case (really, eight cases because of symmetry) where a tile that should be invisible is visible. I know exactly why that is so - the computer just does what I tell him to do - but I have no idea for an elegant solution...

9
Development Process & non-technical / My project - HesseRL
« on: October 25, 2014, 10:25:10 PM »
So, I just started my own roguelike. I plan it to be a rather small, conventional RL, so hopefully I will be able to finish it sometimes.

It will feature a rather big static central region based on a real world haunted castle in Hesse, with only a hand full of procedurally generated regions branching off.
There will be a simple inventory system, half a dozen different hostile creatures with different AIs, and a simple quest system.
And procedurally generated fog for outdoor regions.

Right now, I have finished a very basic game engine, I can move my @ around and LOS is calculated, and there are zs (zombies!) that shamble around and begin to hunt me if I come too close to them. I think I will work an a simple combat system next.

10
Programming / Re: [Beginner] Strange shadowcast
« on: October 25, 2014, 08:12:54 PM »
Tada:


I like it so far.

Now I have to decide if I continue with monsters or with items...

11
Programming / Re: [Beginner] Strange shadowcast
« on: October 25, 2014, 05:12:14 AM »
Thanks for your replys. I didn't find the bug, but decided to change to a circle-based shadowcast. It is already working and almost bug free. No strange behaviour this time!  8)

12
Programming / [Beginner] Strange shadowcast
« on: October 24, 2014, 01:19:12 PM »
Hello!

I just started to program a roguelike, and I ran into a problem with my shadowcast. Perhaps someone can help.
(This is only 1/8 of a shadowcast so far, so only one octant)

This is what happens:
(@ = player, S = shadow, . = visible, # = wall)
Code: [Select]
@......
S......
S##S...
SSSSS..

When I move closer to the wall, I can see around the corner:
Code: [Select]
SSSSSSS
@......
S##....
SSSSSS.

Similar behaviour occurs in similar situations. Can someone give me a hint what might be the case?

The relevant code:
Code: [Select]
def shadowcast(self,start_slope, end_slope, dx):
        # iterative shadowcast
        if dx < 30: #30 is the maximal range of vision
            # dx is the distance from the @ the current iteration is looking at           
           
            # a few renames for our convenience           
            pc_x = PC.position[0]
            pc_y = PC.position[1]
           
            original_end_slope = end_slope           
           
            # calculate the starting point of this column
            starting_point = int(math.floor(start_slope*dx))
           
            # checks if the starting point is still on the map           
            if (starting_point + pc_y) > (MAP_HEIGHT - 1):
                starting_point = (MAP_HEIGHT - 1) - pc_y
               
            end_point = int(math.ceil(end_slope*dx))
           
            # does the calculation for the column start with a blocked los?
            prior_blocked = map.content[pc_x + dx][pc_y + starting_point].block_los
           
            # some cosmetic changes. Make more walls visible
            cosmetic_y = starting_point + 1
            if (pc_y + cosmetic_y) < (MAP_HEIGHT):
                if (map.content[pc_x+dx][pc_y + cosmetic_y].block_los):
                    if not(map.content[pc_x+dx-1][pc_y + starting_point].block_los):
                        map.content[pc_x+dx][pc_y + cosmetic_y].visible = True           
           
            for dy in range(starting_point, end_point-1, -1):
                # The tile that is checked               
                tile_x = pc_x + dx
                tile_y = pc_y + dy
                # every tile checked is visible, or we wouldn't check it.               
                map.content[tile_x][tile_y].visible=True
               
                # If we go from unblocked to blocked, new end_slope is
                # calculated and recursive call is executed               
                if (not prior_blocked) and map.content[tile_x][tile_y].block_los:
                    end_slope = (dy+.5) /float(dx-.5)
                    if (tile_x+1)<MAP_WIDTH:
                        # Recursively continue to calculate
                        self.shadowcast(start_slope, end_slope, dx+1)
                    prior_blocked = True
               
                # If we geo from blocked to unblocked, a new start_slope is
                # calculated for later recursive calls
                if prior_blocked and (not(map.content[tile_x][tile_y].block_los)):
                    start_slope = (dy+.5) /float(dx+.5)
                    prior_blocked = False
           
            # if we are still on the map, recursively calculate the next column
            if (pc_x+dx+1)<MAP_WIDTH and (not map.content[pc_x+dx][pc_y+end_point].block_los):
                self.shadowcast(start_slope, original_end_slope, dx+1)

Pages: [1]