CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on Simulated Structure Placement

    Update - Release 6

    - Pushes blocking units out of the way automatically

    - Uses official "Placement" models where applicable

    <object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/EujdO1HmGME?fs=1&amp;amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/EujdO1HmGME?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement
    Quote from XPilot: Go

    The best method I have found so far is to use CameraForceMouseRelative and a very small mouse sensitivity so that the camera does not move much. Every frame (1/16th of a second) I move the camera back to where it should be, and use the difference between where the camera is and where it should be to calculate how much the mouse has moved.

    I plan to experiment with this and see if it improves the placement simulation controls. I will have to add some additional bounds-checking for when the structure ghost is about to go off-screen, and move the camera position.

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement
    Quote from SouLCarveRR: Go

    BTW are you dynamically loading the buildable units and structures or did you have to pre arrange those dialog buttons your using for the build options?

    The answer is yes and no. I am dynamically positioning the buttons, but I am explicitly choosing which units get a button. I have an initialization function which allows me to specify basically a list of unit types, and from that list the buttons are generated on a dialog.

    Quote from SouLCarveRR: Go

    Tempting do do something similar for a td but the center camera thing would drive me nuts

    If blizzard ever exposes a "Mouse Position" function, I will throw out the center camera thing in a heartbeat.

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement

    @GeEom: Go

    Unfortunately, no. Hence this thread.

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement

    <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/unSbDNidKhc?fs=1&amp;amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/unSbDNidKhc?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement

    An initial version of the Structure Placement Grid Emulation has been added in Mock Battle Release 3

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement

    @Wolf1322: Go

    Is there a Galaxy function to invoke which will display this modified footprint? As far as I knew, the footprint texture was only visible during the "Structure Placement" mode, a mode which is enabled when you click a Build command from a unit's command card, and could not be invoked directly through triggers.

    I do, however, have access to the dimensions of the footprints and so could display a reasonable facsimile of a footprint texture with another trigger hack, I believe.. assuming a Galaxy function exists to tell me whether a particular Terrain location is "No spawn" or "No build" or "Creep."

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement

    The placement grid / footprint display / no-spawn ground blocking is a major feature I want to tackle with this, but I haven't figured out how to display the grid yet. Locking the camera seems to be the only legitimate way to poll the mouse at present.

    My theory is that I will display several anchor units, each with their own grid square, colored individually either red or green and moving synchronously with the main anchor.

    The main reason that led me to this development effort was that I wished to consolidate my UI, and having a separate builder unit seemed overly cumbersome.

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement
    Quote from SouLCarveRR: Go

    You forgot the part where if the units Placing footprint says the placement is invalue it turns red..

    First question I have for you is ..... why would you even bother to do a build mode in triggers when you can just create custom Build abilties that allow you to do any type of building.

    I for one love to do everything in triggers as well. But "build" abilites are not something I would do with triggers. Im pretty new to the data editor and ive found that making custom build abilities and adding sub abilities on it is pretty simple and straight forward.

    Locking the camera when clicking a "build" ability sounds like it would be terribly annoying.

    Why? What limitations of the "real" build abilities has led you to even bother with this?

    Posted in: Project Workplace
  • 0

    posted a message on Simulated Structure Placement

    At the request of progammer I am starting a discussion on what I call "Simulated Structure Placement." Basically with MockBattle's structure mode, I've attempted to emulate the structure placement mode you see when you issue an order to a builder unit. Blizzard's actual build mode is still far superior to my trigger-based version, but that's part of the reason I've started this discussion: to reach out to other programmers and see if anyone has any thoughts on the matter.

    Terran structures, for instance, get a special green animated wireframe model (the "Placement" model for the Unit) along with a green Placement Grid texture underneath. The grid is a visual representation of the structure's footprint when built, and it also displays in real-time any non-passable areas which would prevent a structure from being built. If any of the footprint squares are non-passable, the order cannot be completed, and you get an audible error noise.

    Unfortunately, there are no map editor functions or triggers which allow the tracking of the mouse cursor directly. So here is what I've done so far, to see if I can work around the limitations.

    Set the Camera mode

    There is a camera mode which simulates the "middle-mouse" drag mode: "Lock camera mouse relative mode". Once enabling this mode, the camera will be centered on the mouse position until disabled. Also, the mouse cursor will be hidden. In MockBattle, I enable this mode upon clicking any of the Structure mode buttons for either player.

    Track the Camera

    Since the camera now follows the mouse, we can set up a trigger to fire when a player moves the camera, and we can even specifically give the "Mouse Scroll" reason. This trigger will merely record the position of the mouse. Our camera mode will correctly fire this event on even the slightest mouse movement. The only drawback is that this input mode is somewhat delayed, and not as crisp as native mouse-polling mode (which we don't have access to, as far as I know).

    Display the Model

    To simulate the placement model, there are many options. In MockBattle, I decided the best method for the time being would be to create an instance of a dummy unit (I named him "Anchor") in the game world, and set its position to the position of the tracked mouse camera. Then, I assign the model of the structure unit we're supposed to be placing to the dummy unit. To distinguish the model from "real" units already in the game world, I send an Actor message to the Anchor, instructing it to "Glow"/pulsate and lower its opacity to 40%. I also fetch the "default facing" for this structure from the catalog and apply it.

    Footprint Visualization

    (edit, 8/31/2010) To show a reasonable facsimile of the Structure Placement Grid, I initialize an array of Cube units and adjust their scale so they occupy a roughly 1x1 square. Using the position of the simulated placement model as Center, I calculate X- and Y- positions for each of the placement grid squares. Then, any time the model moves, I move the fake placement grid as well. A check is performed on each square's position for passability, and its color modified accordingly.

    Grid Snap

    When tracking the camera position, you'll get the actual floating-point coordinates of the center of the screen as projected onto the terrain. This is all well and good, but structures adhere to a placement grid, with spacing exactly equal to 1 square. To simulate this, I adjust the captured position as it is read. Specifically, I apply the following formula: X' = Floor( X ) + Gx, where Gx is 0.0 for even-sized footprint widths and 0.5 for odd-sized footprint widths. the Y-value receives similar treatment with respect to the footprint height.

    Finalize the Placement

    When the user clicks the mouse, we then delete the Anchor with its temporary model, and place the actual structure unit at the tracked camera's position.

    Improvements

    1. Use the actual placement models where I can.
    2. Display the footprint/placement grid texture.
    3. Display blocking squares in realtime for the placement grid.
    4. Block creation of structures with invalid placement.
    Posted in: Project Workplace
  • To post a comment, please or register a new account.