State of the batle system

I was looking at the code and notice that the easy does have a batle system already, but seems that the person that was doing it, abandon the code and some one else edit it creating several errors and did not undertend the way it worked, I have been correcting the code to do what is suposed to do and it works … well some of the states, because the original code is not complete.

So why some one edit it ? and are you giving support to it ?

If you have RTP intalled for 2003 you can chek this demo already working.

Download it here

http://www.2shared.com/file/HrFERld6/Battle_system_fixed.html

The problems so far are, that some of the code used on 2003 battle system breaks the batle system on 2000. And some of the 2000 code does not work on 2003 =/.

Ghabry is still maintaining the battle system, take a look to his branches and recent blog posts for a demo video.

Good to read you fdelapeña long time no see, could you please add me to the project as contributor, for the old times ? =) if I recall it right a lot of the players code was originally designed by my self XD, and some of the code is still there, like the windows code.

So, Coul you plese add me to the project?

There has been lot of progress on the Code, after all these years =)

Yeah, I forgot to greet before, so long time, all the team worked hard on it and current progress is pretty promising. Since your first contribution most code has been almost totally rewritten too. Which name do you want to be added to the AUTHORS file? You can also add your name by yourself into this file and update your pull request.

You are already in the Player Team but it’s still not shown in your GitHub page, maybe needs website refresh or merging some pull request first.
Nobody do a push directly to EasyRPG/Player, all of us make pull requests for security and code reviewing/discussion before merging.

By the way, Ghabry is waiting for reply here to refresh your pull request: github.com/Lobomon/Player/commi … nt-4729498

Hi,

Please add me with my nick name, I still work for one of those restrictive Internacional Bussines Company so … I think using a nick name would be better.

By the way, I think we should separate the Scene Battle of 2000 and 2003, the main issue here is that the batle is basically an state machine, so the number of code that we will edit to set the full state machine all in one is considerable, and the complexity of the state machine will increase, ending with a no clear code and some what duplication for some parts that act diferently.

Also to do the fix we just need to get the code of Ghabry before he tried to give support of 2003 and set a new scene battle and game battle exclusive for 2000 this will easely works bebause the scenes are really flexible, have one more one make much diference. With those changes then add coditional depending on if the player is emulating 2000 or 2003 on the events that call the battle to push the right scene.

Edit,

Cheking the code … seems that a guy called Glynn Clements created the battle scene long time ago like 3 years ago and it is base on the code that Ieft like 5 years ago, (I know because I recognize some variable names and the way the animation is managed) so getting the 2000 battle wont be posible. I think we should create a new battle scene then =/.

[quote=“lobomon”]Hi,

Please add me with my nick name, I still work for one of those restrictive Internacional Bussines Company so … I think using a nick name would be better.
[/quote]
Adding only the nickname to AUTHORS should be fine.

[quote=“lobomon”]
Cheking the code … seems that a guy called Glynn Clements created the battle scene long time ago like 3 years ago and it is base on the code that Ieft like 5 years ago, (I know because I recognize some variable names and the way the animation is managed) so getting the 2000 battle wont be posible. I think we should create a new battle scene then =/.[/quote]

glynnc recycled old five year old code lobomon? Can you show me this?

I’m actually working on a new battle branch. But it didnt make progress for some months now because my freetime is quite limited.
I noticed, too, that glynncs code is not really usable, so I deleted actually most of it ;). Some parts of his code are still left (and in most parts unused), the reason is simple: C++ needs all referenced functions, otherwise you get compile errors. The code is also splitted in two different scenes (one for 2000 and 2003). I plan combining code they have in common when I’m finished, at the moment they are in most parts distinct. The 2000 battle scene is basicly finished (at least battle and skills work, event interpreter is filled with bugs). 2003 is not usable yet.

And that code uses a state machine ^^

2000 and 2003 battle are quite similiar, e.g. the menu (except that one special style for 2003) and what types of attacks are possible, 2003 only added a few. Hughest difference is the real time battle vs turn based…

[quote=“lobomon”]
Also to do the fix we just need to get the code of Ghabry before he tried to give support of 2003 and set a new scene battle and game battle exclusive for 2000 this will easely works bebause the scenes are really flexible, have one more one make much diference. With those changes then add coditional depending on if the player is emulating 2000 or 2003 on the events that call the battle to push the right scene.[/quote]

I’m doing this

EASYRPG_SHARED_PTR<Scene_Battle> Scene_Battle::Create() { if (Player::engine == Player::EngineRpg2k) { return EASYRPG_MAKE_SHARED<Scene_Battle_Rpg2k>(); } else { return EASYRPG_MAKE_SHARED<Scene_Battle_Rpg2k3>(); } }

Ha, curious how we think in the same solution,

By the way I got your battle branch and compile it and seems that it works fine for 2000 but on 2003 it gives several troubles, But I guess is a work in progress, hey why didnt you add this to the master code ? Seems playable, and that is better that nothing.

I know why the code on 2003 is crashing but I am not sure if should edit it =/.

Well, I have some experience in software design in the meanwhile. So this was probably the most obvious solution :wink:

Because I’m a perfectionist :wink:

I want to finish the RPG2k3 part before I push this to master.
On my todo list this year was: Battle System and more complete saving. At the moment I fail both, but I hope to finish the battle system before christmas. :wink:

Ok, so I guess I will have to do something else

there are some bugs in some event commands, download the testgame and check which are incomplete and the issues list. the bug #3 is still unresolved for example. i will be improving the savegames documentation

Do you refer to the bug that I left like 4 years ago and it still included on the easy interpreter ? I will start with that one since is preventing a lot of games from working.

The problem here it that the interpreter do not have stack calls !!! I make an statement on that bug on 2008 and explanation on how it could be fixed but is 2013 and is still not fixed =/

So the problem is that when you have a event on a map, then this even call a common event on the general game settings and the common event executes correctly finish, the actions that where after the common event call do not get executed, because the easy interpreter did not make an stack with the position after common event call so when the common event finish the easy believes all the commands are already executed.

2013 and not fixed yet =/, well I will fix it today !!

The report includes some pictures below: github.com/EasyRPG/Player/issues/3

Yes, I looked at the description and seems like similar if not the same issue, I was looking at the code and we use a list to set the order on the execute of commands and support 1 stack call in a child interpreter, but the code is quite bad implemented, and limited. I am quite concern if this will work on several calls, like and event that calls an other event that calls a third event etc, It could work but it does not =/

the call to the child interpreter goes right but, after the child interpreter ends, all the code from the first interpreter gets ignored.

Update:

Not all the code gets ignored but the next instruction after the call get ignored.

RPG Maker 2000 event system is really weird by design, for example you can run map events across maps if an event command is a teleport. The rest of lines will keep executing in other maps, even with more teleports are called in the same event command of the initial map. The event order is quite complex, and event execution priorities are mixed between lines and event types.

A complex test case example:

Event 1 in map 1 (push to activate):

message: I am the map event 1 and will teleport from map 1 to map 2 now
teleport to: map 2
message: I am the map event 1 after teleporting to map 2
message: I am the map event 1 after teleporting to map 2 yet
message: I am the map event 1 after teleporting to map 2 and before calling common event 1 yet
call common event 1
message: I am the map event 1 after teleporting to map 2 and after calling common event 1
teleport to: map 3
message: I am the map event 1 after teleporting to map 3
message: I am the map event 1 after teleporting to map 3 yet

Event 2 in map 2 (automatic activation):

message: I am map event 2 in map 2 with automatic activation
message: I am map event 2 in map 2 with automatic activation yet

Event 3 in map 2 (automatic activation):

message: I am map event 3 in map 2 with automatic activation
message: I am map event 3 in map 2 with automatic activation yet

Event 4 in map 2 (parallel activation):

message: I am map event 4 in map 2 with parallel activation
message: I am map event 4 in map 2 with parallel activation yet

Event 5 in map 2 (parallel activation):

message: I am map event 5 in map 2 with parallel activation
message: I am map event 5 in map 2 with parallel activation yet

Common event 1

message: I am common event 1 activated from event 1 from map 1 in map 2
message: I am common event 1 activated from event 1 from map 1 in map 2 yet

I guess this will fail to execute in EasyRPG Player in the same order as RPG_RT.exe does. You will see how events are processed, they have no sense but it should do the same.

There is also this document, however might not be accurate:
gist.github.com/take-cheeze/4406621

I just fix it, the code had a bug the creator knew it but did not fix it

	// FIXME?
	// After calling SkipTo this index++ will skip execution of e.g. END.
	// This causes a different timing because loop_count reaches 10000
	// faster then Player does.
	// No idea if any game depends on this special case.
	index++;

I set a condition that solves the issue, is a simple fix:

if (!child_interpreter->IsRunning()) {
child_interpreter.reset();
StateAftercall=index+1;
}

if((StateAftercall<index)&&(ExecuteCommand()))
	index=StateAftercall;

I will check how many bugs this fix on the Escalar XD

It works but there are other stuff that does not work, like several break cycles together. =/ I may need to add more fixes

That comment was added by me. The event interpreter points after e.g. breaking a cycle on the command after “END Cycle”. RPG2k/2k3 executes the “END Cycle” (which is a noop anyway).
My comment was about a timing difference in endless (=10000 commands executed) loops. Event execution stops after 10000 commands. When you do e.g.

a = 0
LABEL again
Cycle
a = a + 1
BREAK Cycle
[other commands here that are never executed]
END Cycle
GOTO again

“a” will have a different value in EasyRPG then in RPG2k, because next command in 2k after BREAK is END, in EasyRPG it’s GOTO. So the value in EasyRPG will be higher for “a”.

Did you implemented the code? tell me why it fails some times ?

I set a fix for it that works, but some times is not needed so I added additional code to check if it is actually need and it pass this complex test

Event 1 in map 1 (push to activate):

message: I am the map event 1 and will teleport from map 1 to map 2 now
teleport to: map 2
message: I am the map event 1 after teleporting to map 2
message: I am the map event 1 after teleporting to map 2 yet
message: I am the map event 1 after teleporting to map 2 and before calling common event 1 yet
call common event 1
message: I am the map event 1 after teleporting to map 2 and after calling common event 1
teleport to: map 3
message: I am the map event 1 after teleporting to map 3
message: I am the map event 1 after teleporting to map 3 yet

The changes were

	index++;
	
	// If you are a father and do not have child after an stack call 
	// reduce index
	if(((StateAftercall!=(-1))&&(!child_interpreter))&&((index)==(StateAftercall+2)))
	{
	index=StateAftercall+1;
	StateAftercall=-1;
	}
	//the setup got correctly set so remove the stack info
	if(((StateAftercall!=(-1))&&(!child_interpreter))&&((index)==(StateAftercall+1)))
	{
	StateAftercall=-1;
	}

Basically set the index correctly since some times it jumps one of the code execution steps.

After those changes everything works on Escalar (All the acting and complex calls) even most of the battle system works I will check why some minor stuff is still missing, If I fix the minor battle system issues all the game will work, and is a complex game, has several in map code and other stuff but is working on the easy.