大瓷砖地图游戏1000x1000

发布于 2025-02-08 09:25:02 字数 501 浏览 1 评论 0 原文

我开始学习MongoDB,并试图找出如果需要存储大量瓷砖,则更适合于大型2D瓷砖地图。 就我而言,玩家必须填写免费的4个瓷砖() - 这是一种城堡。

假设数据库包含这样的文档:

{
  "_id": {
    "$oid": "62ad13e2a4658cfa758956d4"
  },
  "data": {
    "player_id": "asdfadsf-asdfasdfas-fasdfsdaf-asdffds"
  },
  "location": [[
     [ 0, 0],
     [ 0, 1],
     [ 1, 1],
     [ 1, 0],
  ]]
}

是否可以为下一个城堡找到一个免费的随机2x2正方形,而从未与第一座相交? 也许Mongo地理空间查询不适合这种情况?

I started learning mongodb and was trying to figure out which way is better suited for a large 2d tile map if I need to store a large number of tiles.
In my case, the player has to fill in the free 4 tiles (quad 2x2) - this is a kind of castle.

Let's assume that the database contains a document like this:

{
  "_id": {
    "$oid": "62ad13e2a4658cfa758956d4"
  },
  "data": {
    "player_id": "asdfadsf-asdfasdfas-fasdfsdaf-asdffds"
  },
  "location": [[
     [ 0, 0],
     [ 0, 1],
     [ 1, 1],
     [ 1, 0],
  ]]
}

Is it possible to make a geospatial query to find a free random 2x2 square for the next castle that never intersects with the first one?
Maybe the mongo geospatial query is not suitable for this case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文