2Moons icon indicating copy to clipboard operation
2Moons copied to clipboard

OPBE compatibility

Open Para0234 opened this issue 6 years ago • 20 comments

Hi,

I'm trying to install OPBE on my server (local for now, multiplayer if it works) because the cmbat system seems really messesd up.

But the problem is that when I install it, I get a blank page instead of a combat report.

The problem seems to lie in the fact that I use 2Moons 1.8.

So, I wonder if there's any way to make OPBE compatible with 2Moons 1.8, and if there is, how can I do it?

Thanks in advance

Para0234 avatar Aug 22 '17 20:08 Para0234

Did you look into the folder that has a 2moons sub directory....its pretty straight forward from their

wrath76 avatar Aug 22 '17 20:08 wrath76

Well, in the library, there's an "1.7.2_injection_mode", so at first I assumed it was OPBE 1.7.2 (I honestly am pretty new in server management, and my php knowledge is too limited), but after searching around, I fould out that it was for 2Moons 1.7.2.

So I wonder if there's a way to make it compatible again. I honestly hope so, because having a light fighter alone dealing more than 300k damages because of the presence of ~150 probes and solar satellites, while I had 7000 others ships, including a few handmade ones (while there was no loss at all, didn't understand why, despite the 300k damages) doesn't feel right, be it for me or the players.

Para0234 avatar Aug 22 '17 21:08 Para0234

Try to open the combat php and replace what's in their and see if it works...

wrath76 avatar Aug 22 '17 21:08 wrath76

the calculateattack, you mean?

It makes an error "files not found" because of the requires at the start of the file

Para0234 avatar Aug 22 '17 21:08 Para0234

I'll look at it in a bit and get back go u

On Aug 22, 2017 17:20, "Para0234" [email protected] wrote:

the calculateattack, you mean?

It makes an error "files not found" because of the requires at the start of the file

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jkroepke/2Moons/issues/325#issuecomment-324155029, or mute the thread https://github.com/notifications/unsubscribe-auth/AVE5aM_EAo-h_SOJ_J-FuzTFQIX91lGYks5sa0YXgaJpZM4O_KX4 .

wrath76 avatar Aug 22 '17 21:08 wrath76

Thanks a lot!

Para0234 avatar Aug 22 '17 21:08 Para0234

I'm interested, too. Drop a line if you need some help.

jkroepke avatar Aug 22 '17 21:08 jkroepke

so i spoke to someone who claims it works.....the changed ""

then in implementations\2Moons\1_7_2_injectionMode (changed to 1_8_) calculateAttack changed 1_7_2_ to 1_8_ and so on havent tested but says it works for him......good luck

wrath76 avatar Aug 22 '17 23:08 wrath76

did you follow this? https://github.com/jstar88/opbe/tree/master/implementations/2Moons/1_7_2_injectionMode

you also have to add the whole git repo with the folders and files to your server not just that one file.

You can change MissionCaseAttack.class.php (Click me to go to line) to something like

//you must add these two files!
include_once ( ROOT_PATH . PATH_TO_OPBE_CORE . 'utils/includer.php' );
include_once ( ROOT_PATH . PATH_TO_OPBE_CORE . 'utils/LangImplementation.php' );
//you can alster the config for OPBE in file https://github.com/jstar88/opbe/blob/master/constants/battle_constants.php
$combatResult = new Battle ( $fleetAttack , $fleetDefend );
$startBattle = DebugManager::runDebugged(array($combatResult, 'startBattle'), $errorHandler, $exceptionHandler);
$startBattle();
$report = $opbe->getReport();

for my serevr we are using XGP and we altered our attack.php to have

//Start of Battle ---------------------------------------------------------
$battle 		= new Battle ( $attackers , $defenders );
$startBattle 	= DebugManager::runDebugged ( array( $battle , 'startBattle' ) , $errorHandler , $exceptionHandler );
$startBattle();
//End of battle   ---------------------------------------------------------
$report 		= $battle->getReport();
$steal 			= $this->update_attackers ( $report->getPresentationAttackersFleetOnRound ( 'START' ) , $report->getAfterBattleAttackers() , $target_planet );
$report->setSteal($steal);
$this->update_defenders ( $report->getPresentationDefendersFleetOnRound ( 'START' ) , $report->getAfterBattleDefenders() , $target_planet , $steal );
$this->update_debris ( $fleet_row , $report );
$this->update_moon ( $fleet_row , $report , 'Moon' , $target_userID );

We have it so we can use the old attack engine as the base attack.php and the one that uses OPBE as attack_opbe.php and switch it in the ACP (admin control panel) so we have two attack engines. And it works fine.

I am not sure how will this will work for 2moons as i only look at the code for things like this, but it should be pretty much the same.

lilmnm-kamikaze- avatar Aug 23 '17 06:08 lilmnm-kamikaze-

The whole opbe is in my server, and has always been. It's in includes > libs, to be more exact

@lilmnm-kamikaze- , about the change in MissionCaseAttack.class.php , I did it, exactly the same way you did (of course, I changed the pathways), and I get the exact same result when I do a battle simulation. An about:blank page.

About the attack.php edit, I honestly fear that I'm far from good enough in php to be able to do this.

By the way, in order not to put harm to the server and to prevent a maintenance in my server, I tested on my computer (localhost and everything), and said computer is...well, not powerful at all. May this be the reason why?

Para0234 avatar Aug 23 '17 19:08 Para0234

What web browser do you use?

Do you get an about:blank page when trying to look at the battle report?

For the battle sim you have to format the battle report to show correctly. instead of whats in the ShowBattleSimulatorPage.class.php file

What you changed in MissionCaseAttack.class.php you need to change in ShowBattleSimulatorPage.class.php (go to Line)

Both use the same code but the sim doesn't change anything in the database.

lilmnm-kamikaze- avatar Aug 24 '17 03:08 lilmnm-kamikaze-

I use Google Chrome.

I tried to launch a combat against a random enemy on my local server. the fleet never arrives. There is no battle report, and the fleet seems to stay at one second before arrival, every time I refresh the "fleet" window. So there is no battle report to open.

I changed ShowBattleSimulatorPage.class.php, but there is no difference. Still an about:blank page.

Oh, and when I cancel the fleet, it never comes back either.

Para0234 avatar Aug 24 '17 08:08 Para0234

Do you see any error logs saved anywhere on your server. Maybe a default error_log or something at the root or in the OPBE location?

what server do you have the game on?

lilmnm-kamikaze- avatar Aug 24 '17 09:08 lilmnm-kamikaze-

The game is in localhost, and I use UwAmp for this. I don't want to try in my online server until I'm sure it works. I changed the path on the modifications you gave me to fit on my computer.

I've searched in the opbe library in the game folder, and I didn't find any battle report.

Para0234 avatar Aug 24 '17 10:08 Para0234

(and neither did I anywhere else)

Para0234 avatar Aug 25 '17 10:08 Para0234

Ill set up a 2moons server on my server and work look into it

lilmnm-kamikaze- avatar Aug 26 '17 05:08 lilmnm-kamikaze-

Thanks

Para0234 avatar Aug 28 '17 02:08 Para0234

Little update on that side.

I got a little fix, and after looking at the error, I got this:

[04-Jan-2018 02:31:54] NOTICE: "Undefined index: user"
File: /home/clients/c1c16394d51454455efdf59654091eb0/risistar/includes/libs/opbe/implementations/2Moons/1_7_2_injectionMode/calculateAttack.php | Line: 229
URL: https://risistar.com/game.php?page=research | Version: 1.8.git
Stack trace:
#0 /includes/libs/opbe/implementations/2Moons/1_7_2_injectionMode/calculateAttack.php(229): errorHandler(8, 'Undefined index...', '/home/clients/c...', 229, Array)
#1 /includes/libs/opbe/implementations/2Moons/1_7_2_injectionMode/calculateAttack.php(146): updatePlayers(Object(PlayerGroup), Array)
#2 /includes/classes/missions/MissionCaseAttack.class.php(181): calculateAttack(Array, Array, '30', '15')
#3 /includes/classes/class.FlyingFleetHandler.php(80): MissionCaseAttack->TargetEvent()
#4 /includes/FleetHandler.php(31): FlyingFleetHandler->run()
#5 /includes/common.php(127): require('/home/clients/c...')
#6 /game.php(24): require('/home/clients/c...')
#7 {main}

After looking around, I found this guy who had the same error message, and the creator answered that OPBE wasn't compatible with his version.

so I guess OPBE isn't compatible with that version either.

And I opened a new issue by the way in hopes to fix the battle system itself.

Para0234 avatar Jan 04 '18 01:01 Para0234

Sorry to bring this up so late but after a few years having OPBE on my game it seems that it has several bugs and one including a 0 attacker loss bug that has the attacker getting 0 losses if the battle ends in a draw.

I am currently looking to use a different battle engine thn OPBE or fixing the bug which could take some time.

lilmnm-kamikaze- avatar Jun 20 '18 08:06 lilmnm-kamikaze-

@lilmnm-kamikaze- hey take a look at SteemNova reworked combat engine https://github.com/steemnova/steemnova/pull/50 It is a fork of jkroepke/2Moons.

mys avatar Jun 20 '18 08:06 mys