IGLADI / Ethereal-Hyperspace-Battleships

8 stars 0 forks source link

fix: proper integration with database and following of architecture #92

Closed LordTlasT closed 9 months ago

LordTlasT commented 9 months ago

Description[^1]

The theme of this pull request is making sure the location.py and travel commands work as designed.

Modifications[^2]

location.py:

travel_cog.py:

player.py:

database.py:

travel_cog.py:

Additional remarks[^4]

The random image part has to be rewritten, I made sure it will be by hardocding "../assets/space0.jpg", this is because I think the code should know how much images we have and pull from there instead of using randrange(1, 9)...
It is not possible to create a location object with a coordinate when the location with said position is not in the database. This will throw an error.




[^1]: Description of the pull request. [^2]: Modifications, commands modified and explanation. [^3]: Files added, commands added and explanation. [^4]: Additional remarks (e. a. documentation needs to be updated)

IGLADI commented 9 months ago

floating in space picture has been discussed and we be done afterwards in the corresponding branch by calculating per zone (so zone1 =x0y0-x100y100 and have their specific picture and so on for every 100units)

LordTlasT commented 9 months ago

I think the choosing of images is a seperate matter of this pull request I propose following algorithms:

  1. Have a max map_size and segment our map by the number of pictures MAP_SIZE = 500 x = pos.x/MAP_SIZE*len(pictures) y = pos.y/MAP_SIZE*len(pictures) picture = pictures[x][y]
    • This needs to have an array of x*x pictures.
    • This relies on calculating the map border, which at this point is the maximum value of an int
  2. A new picture every x units. units = 50 x // units y // units picture = pictures[x][y]
    • We need to have enough pictures for this, so might use modulo instead for now.

PS: if none of this are good let's open a seperate issue for this