Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI: Segfault when killing its temple #56

Closed
Bertram25 opened this issue Aug 9, 2014 · 7 comments
Closed

AI: Segfault when killing its temple #56

Bertram25 opened this issue Aug 9, 2014 · 7 comments
Assignees
Labels
Milestone

Comments

@Bertram25
Copy link
Contributor

I killed the AI's rooms in the single player small map. I was finishing its temple and this made the game crash.
[bt]: (1) ./OpenDungeons.bin : KeeperAI::buildSleepRoom()+0x58 [0x59e4c8]
[bt]: (2) ./OpenDungeons.bin : KeeperAI::buildSleepRoom()+0x58 [0x59e4c8]
[bt]: (3) ./OpenDungeons.bin : KeeperAI::doTurn(double)+0x30 [0x59ea70]
[bt]: (4) ./OpenDungeons.bin : AIManager::doTurn(double)+0x30 [0x54d760]
[bt]: (5) ./OpenDungeons.bin : ODServer::startNewTurn(double)+0x105 [0x5d57e5]
[bt]: (6) ./OpenDungeons.bin : ODServer::serverThread()+0x135 [0x5db805]
[bt]: (7) /usr/lib/x86_64-linux-gnu/libsfml-system.so.2 : +0x6508 [0x7f387223a508]
[bt]: (8) /lib/x86_64-linux-gnu/libpthread.so.0 : +0x80a4 [0x7f38726580a4]
[bt]: (9) /lib/x86_64-linux-gnu/libc.so.6 : clone+0x6d [0x7f387153404d]

@Bertram25 Bertram25 added this to the 0.4.9 milestone Aug 9, 2014
@Bertram25 Bertram25 added the bug label Aug 9, 2014
@hwoarangmy
Copy link
Contributor

I have already seen that but did not search a fix yet. I've seen at least 2 ways which seems to have the same root. The problem comes from KeeperAI.cpp.
When the dungeon temple has no tile, Tile* central = mAiWrapper.getDungeonTemple()->getCentralTile();
return NULL. But there are some cases where it is used without testing (I remember having seen the segfault while the AI was trying to build a room).

@hwoarangmy
Copy link
Contributor

Before fixing that, I think we should decide what to do when the dungeon temple gets killed. Game Over for concerned player ? Stopping AI if it is AI player ?

@Bertram25
Copy link
Contributor Author

Game Over for concerned player ?

In the end, yes. As soon as the temple is destroyed, the player should get a pop-up (or just an info text) to tell him that he has lost the game. Also, he shouldn't be able to drag/drop creatures anymore, build rooms, cast spells, ...
But he should still be able to watch the game and chat, IMO.

Stopping AI if it is AI player ?

Agreed.

@hwoarangmy
Copy link
Contributor

Yes, I also believe he should see the game. When it will be possible to have allies, if one player looses, it doesn't mean that his team looses.
But so far, in the code, team is handled by color but we need another thing to differentiate the owner from the team (are we would need to have sevral persons on a seat). For both, color has been used. We should do something better when teams will be properly defined (the most important question being : can the alliances be changed in game ?)

@Bertram25
Copy link
Contributor Author

Ah, you meant teams handling.

IMHO, let's not mix Seats/Slots, Players, Colors and Teams. To me, they are all distinct things.

To me, the red and blue players should be able to team up officially (per map or lobby settings), but they should still have separate colors, creatures, and so on. This would be much easier to differenciate one from another (even between themselves.)
This would be a nice first step, btw in team support. :D

As a second step, why not adding players who share a color and thus gold, creatures, ...

I'm also rather against support to change alliances during the game as it usually leads to losers joining winners before the actual and inexorable ending. ;)

EDIT: Anyway, isn't this a goal for after 0.4.9?

@hwoarangmy
Copy link
Contributor

Yes, I guess it is not top priority but I think it is good to keep that in mind to not code something making difficult to handle teams later.
Concerning teams, I also prefer when it is not possible to change alliance.

@Bertram25
Copy link
Contributor Author

Yes, I guess it is not top priority but I think it is good to keep that in mind to not code something making difficult to handle teams later.

Sure. :)

@Bertram25 Bertram25 changed the title AI: Segfault when killing its last room or temple AI: Segfault when killing its temple Aug 12, 2014
@hwoarangmy hwoarangmy self-assigned this Aug 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants