Hint & question about rules engine.
Continuing Development of MicroProse's Magic: The Gathering!
Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins
Hint & question about rules engine.
by 0rion79 » 15 Feb 2011, 09:11
Since we have experimented that Rules Engine is the lesser evil, responsible of game slowdowns, I have tried to disable it by default, using the related notepad file within Magic directory and everything is running GREAT.
In case of need, I just have to "recognize" the deck (pretty easy) and use the cheats to place it in the game, as if it were a red enchantment.
Now, this brings a question: the slowdown troubles is caused by the fact that R.E. keeps count of the number of casted spells or cards in graveyard and stuff, so what using one of the following options?
1 - split it into 2 cards: one for Cycling and similar abilities that do not requires a full-time check, and the other one for everything thar requires the counting, to be activated on-demand.
2 - change cards' code to make Rules Engine to pop up only when such cards are inside a deck
3 - change Rules Engine to work as a Vanguard Avatar, to be manually placed in a deck by the player, only when required.
What do you think about?
In case of need, I just have to "recognize" the deck (pretty easy) and use the cheats to place it in the game, as if it were a red enchantment.
Now, this brings a question: the slowdown troubles is caused by the fact that R.E. keeps count of the number of casted spells or cards in graveyard and stuff, so what using one of the following options?
1 - split it into 2 cards: one for Cycling and similar abilities that do not requires a full-time check, and the other one for everything thar requires the counting, to be activated on-demand.
2 - change cards' code to make Rules Engine to pop up only when such cards are inside a deck
3 - change Rules Engine to work as a Vanguard Avatar, to be manually placed in a deck by the player, only when required.
What do you think about?
-
0rion79 - Posts: 1520
- Joined: 24 Feb 2009, 18:33
- Location: Italy
- Has thanked: 94 times
- Been thanked: 61 times
Re: Hint & question about rules engine.
by aww1979 » 15 Feb 2011, 10:17
Depending on whether this has already been done or not, there are coding tricks to do things more efficiently. I suspect there might be a lot that can be done here, just because we've had multiple coders contribute.
I'd think that a modification of #2 would be the best solution, though potentially a lot of work. The RE could check whether the cards needing it are ingame or not, and flag bits 1 or 0 depending on whether that card is present. After that, in the RE, any code that is used for a card not present in the deck can be skipped by doing a bit check before executing that code. (dunno if you are a coder orion79, but jatill should know what I mean there)
It would look roughly something like this:
At beginning of game:
IF dredgecards are in either deck, THEN dredge=1
ELSE dredge =0
IF cycling cards are in either deck, THEN cycling=1
ELSE cycling =0
etc etc for all the different RE things
That would only be done when you start the game, and would be quick in computer time anyway; you wouldn't notice this at all.
Then in the code that it's presumably looping through all the time, you'd have:
IF dredge=1 {do all the dredge stuff}
ELSE {don't do any dredge stuff}
IF cycling=1 {do all the cycling stuff}
ELSE {don't do any cycling stuff}
etcetc
This would work as long as you didn't introduce cards outside your deck into the current game after beginning it. This could happen through debug mode, or the wish cards.
The amount of processing time this would save depends entirely on what the code looks like right now. This might already be done for all I know :p
I'd think that a modification of #2 would be the best solution, though potentially a lot of work. The RE could check whether the cards needing it are ingame or not, and flag bits 1 or 0 depending on whether that card is present. After that, in the RE, any code that is used for a card not present in the deck can be skipped by doing a bit check before executing that code. (dunno if you are a coder orion79, but jatill should know what I mean there)
It would look roughly something like this:
At beginning of game:
IF dredgecards are in either deck, THEN dredge=1
ELSE dredge =0
IF cycling cards are in either deck, THEN cycling=1
ELSE cycling =0
etc etc for all the different RE things
That would only be done when you start the game, and would be quick in computer time anyway; you wouldn't notice this at all.
Then in the code that it's presumably looping through all the time, you'd have:
IF dredge=1 {do all the dredge stuff}
ELSE {don't do any dredge stuff}
IF cycling=1 {do all the cycling stuff}
ELSE {don't do any cycling stuff}
etcetc
This would work as long as you didn't introduce cards outside your deck into the current game after beginning it. This could happen through debug mode, or the wish cards.
The amount of processing time this would save depends entirely on what the code looks like right now. This might already be done for all I know :p
Re: Hint & question about rules engine.
by stassy » 15 Feb 2011, 10:33
It has been discussed in the past I think, unfortunately I couldn't find it with the search engine, but if I remember well jatill was faced with several options for the Rule Engine and we ended with the current version as it is.
- stassy
- Moderator
- Posts: 5274
- Joined: 25 Feb 2009, 07:06
- Has thanked: 471 times
- Been thanked: 337 times
Re: Hint & question about rules engine.
by 0rion79 » 15 Feb 2011, 15:58
Guys, can't believ it: right now I was playing a game without Rules Engine and Sylvan Library was working fine again!!!! I've made some test, and Rules Engine somehow interfers with that old green card, since it prevents the player from choosing if to keep & loss life or place back the extra cards. I'm sure you may confirm that even if I can't guess the reasons of such relationship: I'm not a coder, just a lucky man! 

-
0rion79 - Posts: 1520
- Joined: 24 Feb 2009, 18:33
- Location: Italy
- Has thanked: 94 times
- Been thanked: 61 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 29 guests