Construct 2 (J)/RPG-Design

Discuss game development design and post your game ideas

Post » Mon Jun 23, 2014 11:04 am

So, I personally try to use a single or a few trigger events in order to push the battle turn to its next state. In my latest prototype, I basically use "on tween finished" or "on MoveTo hit target position" to check who arrived where, and tell a given character what he should do next. Also, I work with the "on animation finished" trigger to change the animation state of each character.

This way, there is only a few triggers which call the battleManager function, directly or through another function (like characterMove("attack", targetUID, combo) calls the battleManager if the attack combo ends for whatever reason). Each aspect of the system I could separate from the others is split into its own function and/or even group.

Can't help much more without seeing your code. But, if you're interested, I'll make an "advanced" tutorial based on the work for my latest project. Some kind of postmortem. I'm wrapping up the prototype itself today or tomorrow (got a bit delayed).

Cheers,
Nathan
B
77
S
22
G
4
Posts: 311
Reputation: 12,634

Post » Fri Jun 27, 2014 5:25 pm

@Valerien An "advanced" tutorial I'm sure will help out many others that are also interested in making an RPG with Construct 2. The more methods people know that they could potentially use for certain things can help them grow. Using your advice earlier with the "id = Self.UID" I had created a new layout and event sheet, since I figured I could probably work better in setting up the pieces together with it going from the beginning.

There has been two issues I've ran into somewhat in the battle system remaking it. I've done some a work around for both of them at the moment. One of them the work around can hold fine, the other one I'm going to need to actually find a better way to do it for future additions.

One of them is something you've completed for your prototype Dan the Rabbit. Which is the Attack buttons that pop up above his head. Now I'd tried a part where "Turn = Character.ID. Trigger Once" for the spawning of my BattleAction Icons, Watching it in just Run Layout it looks fine. But watching it in Debug Layout it's actually ignoring the trigger once and constantly spawning them on the character.ID who's turn it is. So modified it to an Opacity and Start of Layout set up that works. Which isn't too bad for a turn based menu atm for me, also changed the amount of events it used from 22 in my old system to 7 now. Works yes, but probably not the most ideal.

This is the way my current one for the BattleActions are for players being run:
BattleActions.png


So my question for you though are you using an opacity type for your Actions or were you able to come up with a way to actually get them to stop spawning rapidly?


The other thing that I've been having some issues with that I've tried a few different things is setting up something in the Families for the Rotation of Turns. While using a single avatar for the character and setting it as the following:
CharacterTurn.png


It works perfectly fine. It will set up PlayerLowest and PlayerHighest on each instance of CharacterMage. But if I have it spawn the other Characters as well from the spawn script with it set to the Family Character, and then change it from CharacterMage to Character in the setting the PlayerLowest it will only set the lowest ID with the Lowest ID and the Highest ID with the Highest ID. If I set it for each it sets the Lowest and Highest as the current ID. Hmm while typing and still thinking just had an epiphany so going to set up a method I just thought of.

Yup it works. Before when I had it set up and it was working fine I only had Characters on both sides. Earlier today I had added Enemy on the opposite side and then started getting the issues I described above. But I've done the change I had an epiphany on and it works the way I wanted it to with the variables.
For those that might run into an issue like this for their event set up, and want to see what I did to solve it:
NewCharacterTurn.png
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
1
Posts: 44
Reputation: 817

Post » Fri Jun 27, 2014 6:22 pm

Thanks, If I was to discover that by myself (Taking UID send it to function) it may took months..
B
10
S
1
G
1
Posts: 22
Reputation: 848

Post » Fri Jun 27, 2014 8:56 pm

@daehawk : seeing your code, it seems like you use many events to do the same thing. Also, the way your events are setup, everything is being evaluated on every single tick. It may cause issues later not only as far as performances are concerned (on lower end devices), but it can also provoke bugs.
I've been taking rest this week, was quite tired. But I'll be sure to continue making commented capx, and start a series about rpg-related systems. I'm launching a website on which I'll publish articles about game design and C2 in the first half of July.

A quick thing about the turns: I use two group of events (playerTurn and enemyTurn) which are being toggled on and off based on the flow of the battle. I'd have to go on everything in greater details, and show some example code to convey the idea properly I think. I'll do this in an article/tutorial.
B
77
S
22
G
4
Posts: 311
Reputation: 12,634

Post » Fri Jun 27, 2014 9:49 pm

Valerien wrote:@daehawk : seeing your code, it seems like you use many events to do the same thing. Also, the way your events are setup, everything is being evaluated on every single tick. It may cause issues later not only as far as performances are concerned (on lower end devices), but it can also provoke bugs.


While running some events every tick can cause performance problems on some platforms if the events are intensive enough (collision detection is more intensive than checking a variable, for example), running events every tick, by itself, will not cause bugs. There's a misconception going around that using every tick is bad, but it's really not.
Moderator
B
94
S
33
G
33
Posts: 3,006
Reputation: 27,744

Post » Sat Jun 28, 2014 7:30 am

@Arima : the reason it can cause trouble further down the road is that everything is evaluated in a line, always -> variables have to be set in the right order and daehawk will need to put booleans in many places to check if the event can be run or not. When the event list will start growing, bugs are more likely to suddenly appear in the game, because of the lack of event hierarchisation. I've put it in an expeditive and ambiguous way, I guess. I should rephrase. @daehawk -> the way your events are written, if all of your code is setup like that, may give you trouble debugging your game later in the development process. It's easier to track problems down if you have clear, separated code groups and functions called at specific moments into your code loop.
B
77
S
22
G
4
Posts: 311
Reputation: 12,634

Post » Thu Jul 03, 2014 3:54 pm

@Valerien Not everything is set up to where it's evaluated on every tick. Granted I could of added the section at the end that turns off that group, but was posting the information within a group targeting the code that I was having an issue with since had already narrowed down the issue. Yes I do have a few things that do call on every tick atm in a main section, but that's just group activity checking mainly turning some other things off at the moment. In Debug Layout atm highest I've gotten for CPU usage using popout mode for Inspect and Profile is 3-4% CPU Usage and that's on Layer Start up While going through the attacks and AI side peak has been 1% CPU Usage.

Yes I am aware that on low end devices performance could become an issue. I do have a friend that has an IPad that I send her an uploaded version to test the touch controls if they are working as well. And have her tell me if she's having any lag issues with the touch. Since on my desktop and laptop I can only test the Gamepad, Mouse, and Keyboard controls. On a mobile device like a cellphone could be even bigger issue than the ipad.

Things that I have added since last time I checked this post is the Enemy AI's turn. Current battle set up is a 6v6 for testing purposes. Left side is player controlled you can choose between Attack, Magic, or Special, After all player characters have gone the right side which is Enemy AI controlled will then go through their turns of "For Each(ordered) based on the Enemy.ID" and do their sequence of them choosing Attack, Magic, or Special then play the function for the one that the AI choose. After all the Enemies have had their turn the system turns off the enemies side and reactivates the player side starting with the first player and then goes back through their turn. Going back and forth this way.


Debug Menu:
Debugmenu.jpg
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
1
Posts: 44
Reputation: 817

Post » Fri Jul 04, 2014 9:32 am

@daehawk : ok that's great then. I wasn't concerned as much by your game's performance as by your code organisation actually. But yep, I shouldn't extrapolate too much from just a sample! Anyway, keep it up, I'm looking forward to seeing where you can push this project ;) !
B
77
S
22
G
4
Posts: 311
Reputation: 12,634

Previous

Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 0 guests