Jump to content


Member Since 10 Aug 2007
Offline Last Active Aug 22 2015 01:50 PM

#5133442 Render directx in only a portion of a window

Posted by andur on 21 February 2014 - 09:35 PM

Just add a smaller control that is the portion of the window you want to render to and use its HWND instead of the main window's HWND.

#5082131 Non-random evasion in turn-based games?

Posted by andur on 01 August 2013 - 12:05 AM

You can add a delay to every action (or at least to slower actions), giving you a natural opportunity to evade it (provided you have enough time).


Say you are going to act next in 5 ticks of game time, and your opponent begins an attack that takes 6 ticks to land. Your turn will come up before the attack connects, letting you either move out of the way of the attack or perform a guarding action. Hitting someone is then a matter of either timing your attack right so they don't have time to evade it, or positioning yourself such that they cannot physically move to evade it.


Then like a fighting game, you can have different amounts of hit/block stun on moves, or punish someone for missing an attack provided you can move and attack while they are recovering from missing their attack.


This would work best in a team based game, otherwise it would be too easy to just pick the optimal move at all times and avoid everything. You'd also want area of effect and other such wide angle attacks to limit evasion and be able to be used to position your opponent where you want them. Same with attacks that push your opponent around, being able to shove a blocking opponent into the path of another of your character's attacks would make for an interesting mechanic.

#4822261 Light Trails

Posted by andur on 11 June 2011 - 08:56 PM

Thanks for reply. I attached screenshots. As you can see it just looks like point array :D. I want something like beam.

If you want to create a beam, you'll want to create a continous strip of triangles instead of using particle effects. Each frame, add on a new quad that joins onto the quad from the previous frame. When you reach the maximum number of segments that you want, start removing the old ones. To make it fade off, you can set an alpha value on the vertices that fades to 0 as they approach the end of the beam.

#4800628 is movement in fighting game scripted?

Posted by andur on 19 April 2011 - 09:51 PM

In my fighting game engine, a move is just a big list of timings/properties. Each move has a number of start up frames till the active frames in which they become active, at which point a hit box becomes active that defines an area in which it'll hit your opponent (properties like damage, hit stun frames, block stun frames, mana/meter cost, knockback, what animation to use, etc are defined here too). In a 2D fighter this would just be a rectangle on the screen, in a 3D fighter it would be an arc. Then each move has a set of moves that it can transition into after it hits, depending on what inputs you've entered in (to enable multi-hit attacks or changing to different stances [which can be thought of as moves that don't deal damage and might loop into theirselves]).

Being entirely data driven, lets me build a nice editor for defining moves, and gives me a set of data that the ai can use to play with (it can analyze the move list and know what each move will do and thus decide what an appropriate/optimal move to use would be, without having to be scripted to decide what moves to use). It also lets me run automatic analysis on the movesets of characters finding all of the combos (its hard to account for every stage position, so, some wall-dependent stuff might be missed), so I can hopefully find all of the infinites and anything unbalanced and adjust accordingly.

This is probably the best explanation on fighting game frame data out there: http://virtuafighter...tack_properties Everything in here you'd define as a property of each move.

The character's themselves are made out of hitboxes or some other collision primitives, that change frame to frame on a move.

If you look on youtube, you can find various videos where the hitboxes are made visible for various games.

As an example, a quick horizontal high sword swing can be represented in my game as:
Input: A
Active Frame: 13
Damage: 5
Attack Height: High
Move Duration: 26
Block Stun: 10     (your opponent recovers: 26 - 13 - 10 = 3 frames faster than you if they block it)
Hit Stun: 20         (your opponent recovers: 26 - 20 - 10 = -4 so 4 frames slower than you if they get hit)
Counter Hit Stun: 22
Attack Range: 1
Attack Angle Left: 45
Attack Angle Right: 45  (so an even arc on both sides of you)
Stance Moves: A (a second attack can be activated by hitting A again during this swing)
Default Next Move: Idle stance (goes back to the idle stance if you input nothing, this is usually the case unless its a stance move that leaves you in the stance afterwards)
Tracking: Yes  (move will realign your character with your opponent when it begins)

A vertical stab could be represented as:

Input: 6B
Active Frame: 18
Damage: 15
Attack Height: Mid
Move Duration: 46
Block Stun: 15     (your opponent recovers: 46 - 15 - 18 = 13 frames faster than you if they block it)
Hit Stun: 35         (your opponent recovers: 46 - 35 - 18 = -6 so 6 frames slower than you if they get hit)
Counter Hit Stun: 45 (your opponent recovers: 46 - 45 - 18 = -16 so 16 frames slower than you if they get hit, so you could combo the fast horizontal attack above on a counter hit with this move)
Attack Range: 2
Attack Angle Left: 5
Attack Angle Right: 5  (so an very narrow arc in front of you, making it vulnerable to being sidestepped)
Stance Moves: None
Default Next Move: Idle stance
Tracking: No  (move will not realign your character with your opponent when it begins)

There are a bunch of other properties other than these, but, this should give you the general idea. This ends up working well for me, and I can represent any move in my game with it.

<Edit Apologies for the wall of unformated text, for some reason gamedev is throwing away all of my new lines>

#4774812 DirectX 9 Effect framework and XNA math problem

Posted by andur on 15 February 2011 - 10:41 PM

You should be able to use SetValue to pass in the bytes directly.

Something like: mFX->SetValue(mhP, &mProj, sizeof(mProj));

#4653979 C++ Default value for bool

Posted by andur on 27 May 2010 - 03:17 AM

There are no default values in C++ for primitive types. You are just getting whatever happened in be in memory at that location. Debugger's will usually initialize stuff to default values.