project-navigation
Personal tools

Author Topic: How to find battlescape map information ?  (Read 3876 times)

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
How to find battlescape map information ?
« on: March 22, 2010, 06:36:50 pm »
Yop.

I want to experiment with assigining spawn position for actors (i.e. not using predefined spawn points), so im looking for information.

Id like to know how to find the coordinates and size of the UFO tile, and dropship tile, and if theres a way to check if a coordinate is valid (is that position in a wall, in the air, ...).

With this, ill test some theory on spawning troops inside the dropship (I think having to manage the deployment is part of the fun, with the risk due to all your soldiers being in pack and very sensible to reaction fires & AoE), and spawning aliens at not-random points (once you're used to maps, you know where they'll spawn) depending on how quick Phalanx troops came to the place and other parameters.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: How to find battlescape map information ?
« Reply #1 on: March 22, 2010, 08:08:44 pm »
* check the pathing table for a valid grid pos (reachable spot) after that convert with PosToVec to get the world coordinate.
* use a actor bbox (resp. grid size) aligned world pos and us a trace to find out whether you are in a wall or not. see the comments on the trace functions (fraction)

Offline Duke

  • Administrator
  • PHALANX veteran
  • *****
  • Posts: 1037
    • View Profile
Re: How to find battlescape map information ?
« Reply #2 on: March 22, 2010, 08:51:26 pm »
Sorry, pathing tables are not valid at spawn time. You need to look at the routing tables, but that's rather complex. And we don't (yet) have a CanActorStandHere() interface.

In your log, you'll find:
2010/03/21 01:33:37 CM_LoadMap: "-africa/af_ +craft_ufo_scout +craft_drop_firebird +empty1 +empty2 +house1 +house2 +house3 +house4 +house5 +house3 +fence1 +fence2 +fence3" "8 -8 0 -24 -16 0 0 8 0 -8 8 0 -8 -8 0 16 8 0 0 -16 0 -8 0 0 8 -16 0 0 -8 0 -8 -16 0 -24 8 0 8 8 0"
Go to CM_LoadMap and see how this string is created.
Note that this won't work on static maps.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: How to find battlescape map information ?
« Reply #3 on: March 22, 2010, 10:04:48 pm »
For the pathing tables, I suppose I can let actor spawn, then teleport them to new positions ?

Im not confortable with the idea of tracing to check if theres a wall here because geometry can be complex. Maybe just checking if traveling works between this node and at least one adjacent node could be sufficient ?

Ill check that CM_LoadMap function.

Thanks to you two :)


Offline Duke

  • Administrator
  • PHALANX veteran
  • *****
  • Posts: 1037
    • View Profile
Re: How to find battlescape map information ?
« Reply #4 on: March 22, 2010, 11:17:54 pm »
For the pathing tables, I suppose I can let actor spawn, then teleport them to new positions ?
No. Phalanx doesn't employ mages, you know ;)
Quote
Im not confortable with the idea of tracing to check if theres a wall here because geometry can be complex.
True. That's done in routing.c. And even the evaluation of the resulting tables is still complex (see Grid_MoveMark).
Quote
Maybe just checking if traveling works between this node and at least one adjacent node could be sufficient ?
Close, but No. How would you know that your starting pos is valid ?