jasonrobot / gamedev

Join me on my journey of learning to make video games!
GNU General Public License v2.0
0 stars 0 forks source link

Make the player able to 'target' another entity #18

Closed jasonrobot closed 8 years ago

jasonrobot commented 8 years ago

I eventually want combat to be an open-ended sort of thing. Battles will have no official start and end.

It will also be real-time, so there's no time spent at a menu like there would be in a FF game for targeting and ability selection. (Ok, so its not entirely real-time. Its actually a bit more like how VATS works in fallout3 and NV (but I think I like the FO4 implementation more))

The first thing will be to implement a targeting system. I'm imagining it a be a bit like the lock-on system of Ocarina of Time on the N64. (I guess this is quite similar to VATS as well) This gives 4 basic operations:

If there's going to be pausing of play or anything like that, I'm probably going to be looking at using gamestates (probably a little wrapper to alter the speed of the wrapped state)

The actual work of making one entity face another will need to be done at the controller.

This also digs at a deeper issue of how to get game entities to "see" other entities. For example, for the player's entity to gather targets, its going to need a way to find out what objects the player is (or can possibly be) actually aware of.

jasonrobot commented 8 years ago

So what I've got so far is a TargetLocator object that a controller can use to target other entities. Seems to be a good way of going about things. Still WIP, but so far it is able to list other objects on the screen that are visible and can be targeted.

jasonrobot commented 8 years ago

Hey its actually working! Right now I've got it so that the player entity is drawing a line between itself and its target. It can target both the player follower entity and the static object.

Switching targets and changing out of targeting mode are not implemented yet, but that shouldnt be too hard (we'll see about that).

Can't push my branch because of this shitty coffee shop wifi.

jasonrobot commented 8 years ago

This is all wrapped up now. A controller can handle targeting by having a TargetLocator object. It can be given a locator strategy that will decide how to prioritize targets. Changing between multiple target options is another problem for another time, but this issue is resolved.