[Python] How would I create a floor based on an XY quad (4 points) for my Raycaster Engine?

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I'm working on a Raycaster, and I decided to steer away from the usual path of using DDA and stuff similar, which use an array to store walls per cell. My raycaster stores walls as lines which are defined by giving them a start and end position and a height, I store my floors as what I now know as quads, which store 4 points. my idea for the whole raycaster engine being able to create more nicer geometry and being able to go up stairs. I have gotten as far with my raycaster engine to the point of having textured walls and really nice collisions.

    The problem with the floor part, is that I do not know how I should go about it, and that I don't know how to draw a part of the floor as I'm dealing with quads that aren't strictly a square shape.

    I have only been able to theorize about how I would go about it, and I've thought about first getting the XY coordinates for each point in the floor onto my screen, then gathering an amount to step by towards the point below it based, but I've got no clue how I would do that at all. I have gotten as far as trying to get a point drawn on the screen from the XY coordinate, but I've failed with that as the point did not stay where it should have, which made me just scrap that part.

    I'm looking to be shoved in the right direction on how I should render my floor, considering the fact that it has 4 points rather than being the usual stuff from other raycasters. I've been stuck on this for a few days now. I'm hoping this is a decent question to ask, and if I manage to get it solved, that it helps other people with the same problem as I. Any help is appreciated, apologies for the fact I've got no code to show currently, and the fact that I might be asking something pretty ridiculous. I'm more than happy to post my code

    Continue reading...

Compartilhe esta Página