View Single Post
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-25-2006 , 15:38   Re: New AMXX Menu System
Reply With Quote #18

Quote:
Originally Posted by BAILOPAN View Post
Hawk: you're being ignored because what you're saying has no relevance to the tutorial. Whatever design flaws you think it has aren't relevant to teaching how to use it.

In general, menus are static. For menus that are dynamic, they're usually short lived, which means it's appropriate to destroy them and create a new one. This was an efficiency trade-off since the data structure used to store menus is O(1) lookup but O(n) for mid-insertion/deletion.

For the sake of argument, let's consider your world where you can delete items on a menu:

1. Menu broadcasts to all players.
2. Player 1 selects something on the menu.
3. Menu handler deletes item N in response to action #2.
4. Player 2 selects an item that is now keyed to the wrong slot.
5. Menu handler passes the wrong item # and screws up internal bookkeeping in your plugin.

Solving a problem like this is expensive - you need to reshuffle the entire items pool, and then create a temporary data structure on each player which re-maps the old keys to the new ones. All of this takes memory, CPU, and man-hours to test and debug, when all you had to do was start a new menu (which is what you'd do with an old menu anyway, if you look closely).

You can't just say an API is deficient at something without understanding why certain decisions were made. As soon as you add unnecessary complexity, someone will abuse it, and then you're stuck supporting it for backwards compatibility.

You're historically mostly right about newmenus. They were introduced for www.esportsea.com a while ago with extra features (the menu system there allows menus to timeout). At the same time I wrote the system for CSDM. However I thought it had too much potential to stick around there and merged it into AMX Mod X.

Note that if you're getting hung up on the dynamicness of newmenus, you've missed their entire point. The point of newmenus is abstracting menu termination and pagination, the former which is vital to state-oriented plugins (the kind I am wont to write).
Sorry if I came off as bashing it, what I meant is that it's just undeniably easier to use the old menu system when you need to dynamically add and remove items.

Anyway, I don't think the tutorial has anything to do with me being ignored - I was responding to k007's questions of implementation, since I think for what he's doing it would be much easier to use old style menus.

But as for the system itself, it does accomplish the paging, colors etc. with flying colors, but IMO it is very very far from being the be-all end-all.

As for the design decisions, I see what you mean, but you have to remember that I'm looking at it as someone that has never used it before (although I have) and I see that there are a number of things that are very confusing (as I said before, changing items). While the implementation may be fast, it's harder to learn. Since I'm starting to repeat myself, I'm just going to leave it at old menus being better for dynamic changes, and new menus being better for more static implementations.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552