Author | Thread: Updating resource/motivation after using new resource areas. |
HalfteaPosts: 1307 Location: Darghelm Magus Age: 139 years old Clan: ADV | Message #2266 Posted: May 8, 2008, 12:45 am |
Anyway, I've notice that after I use the resource area (Specifically, for gold bars) My resource window and the motivation counter do not update after using the area. The changes catch up after I switch to a new page however. Mozilla Firefox 2.0.0.14 Window XP SP 2 Although I also noticed it in my version of IE 6 at work as well, but put it down to IE 6 quirkiness. Not a serious bug, but since the motivation counter and resource window on the side update in combats, thought it should be the same with these new areas. |
|
Shagie Posts: 12 Location: Broukendale Magus Age: 132 years old
| Message #2284 Posted: May 8, 2008, 6:13 am |
There are other incarnations of this bug. For example. You have 1 new message, go to messages and click on it, and the navbar still shows 1 until you click again. Most likely this is because the read message, update motivation, and similar calls are not done until after the navbar loads (and that part of the page is generated). |
|
Yamikuronue Posts: 1288 Location: Mottonsborough Magus Age: 122 years old
| Message #2316 Posted: May 9, 2008, 12:03 am |
It's like that in other games I play, too - in F*P, the header loads first, so when you first log in, it still says "Log in here" across the top, and when you change your nick, it says the old one up top but the new one later down the page. It's gotta be because the php script that adds resources doesn't run until after it includes the script that calculates the header and sidebar. |
|
Shagie Posts: 12 Location: Broukendale Magus Age: 132 years old
| Message #2365 Posted: May 10, 2008, 8:34 am |
Thinking in a model of having a 'do this' block/function call at the very beginning of the page (before any html is rendered) which does all the work and database write, and sticks results of that being done into a variable, and then has the rest of the page being rendered using the results variables. In the servlet/JSP model, one often has the servlet do all the work, reads all the data, and then forwards this on to a jsp which then renders the page. A very clean separation between business logic / computation and presentation layers. A white paper [java.sun.com/developer/technicalArticles/javaserverpages/se rvlets_jsp/] on best practices with this model (note Figure 3). This also makes language localization and skinning a bit easier - you don't have to refactor the code later or have multiple copies of what should be the same logic |
|
[ADMIN] ArkhamPosts: 902 Location: Mallow Magus Age: 130 years old Clan: AGOMC | Message #2410 Posted: May 12, 2008, 6:28 pm |
The game is structured similar to how Shagie has theorized. There are certain "blocks" that set up a basic page for the game, and then additional "blocks" that get used for combat, or golem updates, etc. For small systems like the resource gather pages, it's easier to just handle it all in the page itself since that system isn't used on any other page. I could set it up so that it still updates the appropriate fields, but that'd require ajax (like the slot machine uses) or a set of sub pages (which is what combat uses). Honestly, it's just a bit of laziness on my part not to modularize the small systems, too, but it saves me from having to add special "blocks" to the main library just for that one purpose. Eventually I'll go through and make the page behaviours consistent. Kep |
|
HalfteaPosts: 1307 Location: Darghelm Magus Age: 139 years old Clan: ADV | Message #2412 Posted: May 12, 2008, 7:14 pm |
Meh. Don't rush on my account. The end effect is the same anyway. Although I guess it would result in a more 'polished' look. Honestly, stuff like that is for when everything else is good to go. Even with all the pre-tweaks and testing involved for Clans , I'm certain we intrepid beta-testers will find more significant problems for you to code around. |
|
| |
| |