Comments (6)
Possibly related to issue #19 since I was leaning on the 'Z' key in the battles to speed up reproduction of the issue. I can't remember if the first time I saw it was using the mouse or the 'Z' key.
I will replace the AttackCurrentMonster code with that suggested in #19 and report back.
from soscsrpg.
Thank you for sharing that (along with providing all those details).
from soscsrpg.
Thanks Scott. I'm actually a software tester by trade so I tend to throw in detail where I can.
Unfortunately the issue is still present with the modified AttackCurrentMonster code but can take a long time before it presents itself (my character has 195 experience points - that's 39 snake kills haha).
from soscsrpg.
I have tested around a little bit with this issue. One dirty fix is to clear the GameMessages textbox every now and then, to stop it from growing too large in size.
Doing so, seems to completely stop the issue from happening.
Code snippet from MainWindow.xaml.cs if you want to test it on your machine:
private void OnGameMessageRaised(object sender, GameMessageEventArgs e)
{
GameMessages.Document.Blocks.Clear();
GameMessages.Document.Blocks.Add(new Paragraph(new Run(e.Message)));
GameMessages.ScrollToEnd();
}
Furthermore I've tried creating a unit test to emulate the player behavior of holding down the attack-button (it does not crash):
[TestMethod]
public void TestALoadOfMonsterKillingForCrashing()
{
GameSession gameSession = new();
// Move player to Herbalist's Garden
gameSession.MoveNorth();
gameSession.MoveNorth();
// Set weapon to rusty sword.
gameSession.CurrentPlayer.CurrentWeapon = ItemFactory.CreateGameItem(1002);
// Check if the weapon was equipped correctly, and make sure there are enemies at this location.
Assert.IsTrue(gameSession.CurrentPlayer.CurrentWeapon.ItemTypeID == 1002);
Assert.IsTrue(gameSession.CurrentLocation.MonstersHere.Any());
// Attack an absurd amount of monsters, to see if it crashes.
// Furthermore; ensure the player moves back to the Herbalist's Garden.
for (int i = 0; i < 10000; i++)
{
while (!gameSession.CurrentLocation.MonstersHere.Any())
{
gameSession.MoveNorth();
}
gameSession.AttackCurrentMonster();
}
// If the player has more than 100 experience points (in reality, it should be in the thousands), the test is concluded.
Assert.IsTrue(gameSession.CurrentPlayer.ExperiencePoints > 100);
}
And one last thing I want to add, if you use a weapon that one-shots the monsters, the issue doesn't seem to appear at all, no matter how much text fills up in the RichTextBox.
Also thanks for the tutorials, Scott!
from soscsrpg.
Thanks @FrejGMNielsen
I might check that code out this week. I just started a new project for a client last week, and haven't had much time to look at anything except their code.
In one of the later changes to the code, I added a change that limited the number of messages allowed to bind to the display. I also changed the UI control from a RichTextBox to a FlowDocument. Were you seeing the error with that change, or was it happening with the RichTextBox?
private void OnGameMessageRaised(object sender, GameMessageEventArgs e)
{
if (GameMessages.Count > 250)
{
GameMessages.RemoveAt(0);
}
GameMessages.Add(e.Message);
}
from soscsrpg.
Were you seeing the error with that change, or was it happening with the RichTextBox?
private void OnGameMessageRaised(object sender, GameMessageEventArgs e) { if (GameMessages.Count > 250) { GameMessages.RemoveAt(0); } GameMessages.Add(e.Message); }
It was indeed on an earlier lection using RichTextBox. I imagine your change would've eliminated the issue, but I can't confirm it myself since I am still early on in the lections.
from soscsrpg.
Related Issues (20)
- Lock down locations
- Add skills and skill levels
- Add armor
- Add jewelry
- When saving game, also save Trader inventory (in case they've bought or sold anything)
- Re-add saved game file versioning/automatic upgrading
- Control game actions through gamepad/joystick
- Add character customization
- Add audio
- Quest chains
- Faction friendliness level
- Better conversations with NPCs
- Put string literals into resource file, for easier internationalization
- Crafting over time (turns)
- Add spells
- Add buy and sell prices to items
- Add enchantments to
- Add DamageOverTime action
- Add HealOverTime action
- Add buffs/debuffs (increase/decrease chance to hit, damage dealt, etc.)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from soscsrpg.