The Daily Click ::. Forums ::. Klik Coding Help ::. Initiative and turns
 

Post Reply  Post Oekaki 
 

Posted By Message

Lönnemyr



Registered
  30/06/2008
Points
  69
10th December, 2008 at 10:29:11 -

I have a rough idea of what I want but I find it rather hard to actually create such an battle engine. It`s a turnbased battle engine were the player can meet more then one foe at the same time, to make sense out of this battle I want to give everyone an initiative (if possible, I would like it to be impossible for two combatants to have the same initiative). When the initiative is decided I want an avatar of each monster+the player to appear IN THE CORRECT order in the top left corner of the screen. The one with the highest initiative first, then the one with the second highest etc.. and (to make it even more complicated) I want them to switch place so the one with the current initiative is always on top and the one who just did his/hers turn is at the bottom.

I`ve worked a few hours on this, mostly thinking and so far I´ve come up with this.. but it`s not really what I want/complete;

I have a battle frame in which the player will face a random numer of foe`s 1-5. The player have different "stuff" which will enchant his initiative value and at the start of frame all these modifications will be added and subtracted to a "total player initiative counter" then the engine will "roll a dice" and add that number to the "total player initiative counter" as well. All monsters will also have a fixed initiative+a dice roll.
After this I have a numer of event were everyone involved in the fight compare their "total initiative" to all the others; If "A`s" initiative is greater then "B`s" then add 1 to "A`s turn counter". And since I don`t want anyone to have the numer "0" I`ll end it with adding 1 to everyones "turn counter". The idea is to give everyone an order which would be easy to follow (if there is 3 foes+player then it could look like this; foe1(1) player(2) foe3(3) foe2 (4)).

The problem is this is becoming really complicated, and I still have no idea how I can make sure no one get`s the same initiative, how to place the avatas and so on.


Any ideas, examples or thoughts are more then welcome, if you think you have a better/more simple idea which would get the job done and feel like sharing.. SHOT!

 
-

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
10th December, 2008 at 15:26:21 -

I don't understand completely. Why are you giving them all random initiatives? Is your aim to just mix up the order every turn? And if so, why give them fixed initiative + a dice roll?

- If the player has 3 values that combine to form initiative, he/she is almost certainly going to be placed first.
- If you balance out the above so that the player could be anywhere, (lowering what he may get, or raising monsters initiative) it still just creates a random turn order.

It is less work to create an engine which forms a random turn order rather than trying to factor in all these fixed initiatives and enchants and dice rolls. Or if you want possible influences on initiative, (eg low initiative due to being a big, heavy slow monster, or wielding a very heavy weapon) why not just used fixed values and adjust from there, rather than adding a random number from 1-6 on top of that?

Just my thoughts on your process. In any case, I see the problem is not how to get this initiative, but how to convert these initiatives you end up with into a turn order. Sorry but I can't help you out with that one, I'm not a genius with the MMF/TGF expression editor, but what you want to do seems like something that requires a little higher thinking.. of course once someone provides that crucial answer, everything else in the battle engine would come quite easily

 
n/a

Lönnemyr



Registered
  30/06/2008
Points
  69
11th December, 2008 at 15:09:46 -

"of course once someone provides that crucial answer, everything else in the battle engine would come quite easily" - I sure hope so

The reason why I want a fixed value plus a random value for the initiative is because the player will be able to wield 3 types of armor and 3 types of weapons which will all have unqie settings (to give the player the freedom to decide his playstyle), Either he could go for the big weapon and the big armor, which would give him a nice defence and alot of dmg.. or, the light armor and the small weapon, giving him faster initiative but less armor. Something like that.

But it would be a bit stiff if the player always gets ahead of his foe`s when he meets.. say goblins (becuase his fixed value is higher), thats why I also wanted a random value. If you ever played any oldschool paper and pen roleplaying games I´m sure you would recognize the setup becuse they often work this way. Each player has their own initiative but the DM (dungeonmaster) roll a die or two to add a random numer, so everything would`t be set in stone right from the start. I know it is alot of work compared to doing it the easy way but I hope the result will be better. I`m not thinking of mixing up the values each turn, that would be to much



The biggest problem at the moment though is that I don`t want anyone to get the same initiative (that could happen even if I only used a random value).



 
-

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
11th December, 2008 at 16:17:50 -

Oh okay, I'm not too familiar with old school D&D's, but I do have an idea of what the game mechanics are. Makes more sense to me now

I've never had to code something like that before, but I would imagine that each time initiative was calculated, before moving onto the next player it would check any initiatives rolled beforehand and then re-calculate and re-check before moving on. Are you using fast loops? I'm no genius at them, but if you knew how to use them correctly, it could speed up the process and also save memory by using less events.

 
n/a

Lönnemyr



Registered
  30/06/2008
Points
  69
12th December, 2008 at 16:54:09 -

I`m no fastloop genius either, but I use them ocationally. Yeah, only thing I can think of is to first calculate player initiative, then calculate foe1 initiative. If it is equal to players initiative, reroll the die. Then move on to calculate foe2 initiative, if equal to players initiative OR foe1`s initiative, reroll the die.. something like that might work with fastloops.

Thanks I`ll try that idea.

Still have`t done anything about tha avatars which are supposed to switch place though..



 
-
   

Post Reply



 



Advertisement

Worth A Click