Drakan
2011-09-11 23:16:22
Hey yall, I just want you guys to know I am taking in all of your feedback, problems, errors, questions, suggestions, and putting forth a plan for the next version of reflection! (Yes I know reflection 2 was just released and support is continuing for that, this is just a discussion for the future). The reason I wanna get a jump on this so soon is because there is such a high demand for models being put in, and with the current system, it just isn't viable. Possible, but in no way efficient or desirable. The next version of reflection will easily accommodate this and more. I will list some topics and try my best to describe what my goals are for each and leave it open for discussion.
A SMART Wrapper
So this SMART wrapper (I've actually already written it) will allow us to add some memory management that can be disabled or enabled on will. This will help with development not only on OUR side, but on the scripters side when they are dealing with Open Objects (Described below). This wrapper also has some basic error checking to make sure an invalid number isn't being passed to SMART resulting in a complete Simba crash. This however will NOT COVER THE ISSUE UP as it will raise an exception and terminate the script, forcing us to resolve the issue. This will help us find those rare random bugs that crash your simba and give you no explanation of what we as developers did wrong. The memory management system does not add any substantial speed decreases, but it is able to be disabled on demand. Having this wrapper, however, changes the way we will be loading SMART. Currently SMART is loaded through the SRL include. This will have to change, as to have the functionality I described, SMART must be loaded WITHIN the plugin. This will most likely be a simple {DEFINE} that will have to be added to SRL. That being said, we want reflection 2.2 to load on it's own as well bringing me to my next point of this incredibly long post…
(You can check out the SMART Wrapper I made here: http://pastebin.com/cAC9pvCH and yes, that was a pain in the but grind to get all of that in there >.>).
Include Independence
Yes, Reflection 2.2 will be completely independent of any other include (namely SRL). This is not an attempt to try and break away from our beloved SRL include and home, but we want to have more options for the users. So Reflection 2.2 will be able to be used separately, independent from SRL. We feel it's just a safe decision overall. That being said, I will be sure to craft it carefully so there will be no hiccups using SRL and Reflection together as a hybrid script (as I do whenever I make my private scripts). I assure you there won't be issues there.
"Open Objects"
One of the advantages java bots have over us is that they can retrieve an object and store it. This allows them to make sure they are retrieving information from the _same_ object, or tracking the _same_ NPC. With our current system, we have to run a search EVERY time we want updated information from an NPC. Sometimes an adjacent NPC will be returned, or one that's standing on our current NPC, or some other reason. We don't have a good tracking system. There was talk about using the NPC Index to search, but I find that hasn't been a fool-proof solution. However I got to thinking about how the java bots do it. Why can't we do it like them? We can, and it's very simple. In reflection 2.2 we will have what I call (and it's a terrible name IMO) "Open Objects". That means during an NPC search, only the object reference from SMART is grabbed and stored in the NPC record. When a user want's a piece of information about that NPC, they call a wrapper for that particular thing and pass the object reference. It sounds complicated but let me give you an example.
Sample NPC Wrapper
In this sample wrapper, you see how the functions will be laid out to be called on when in need of a specific piece of info.
Sample Searching Function:
I got lazy here and just wrote the pseudo of it, but you get the idea. So not all of the information is loaded at once, only the object. Once the correct NPC is found, it passes that object to the Result and the user can manipulate that as needed. This will lead to faster NPC finding since we don't have to load 20 pieces of information everytime we return an npc. It's kind of a messy explanation but I tried my best in the ~5 minutes I wrote it :P.
My goals for this are a few things: One, allow for better NPC tracking and object manipulation. Two: allow for easier addition and use of models. Three: maybe the user will gain some knowledge on how objects work and have a better understanding of memory management (since the scripter WILL be in charge of freeing their own grabbed NPC's).
Theres so much more I wan't to accomplish with this include but feel satisfied with the length of this post for now. I will of course keep discussion open for everything so we as a community can make the right decisions for the direction of SRL reflection. You can view my progress from https://github.com/Drags111/Reflection-2.2 but please, PLEASE do not use this include to make scripts. If any script using reflection 2.2 is released to public, I will ask to have it taken down. This isn't to try and keep secrecy or anything like that, but I really don't want confusions for our script users. Feel free to update your scripts to it when we get close to release time (which won't be any time soon), but do not release anything publicly as to avoid confusion. We made the mistake of encouraging use of reflection 2 before it was fully released and it caused many issues.
P.S. I also want to start codenaming includes for funises, and to keep in the spirit of Lion King, this include is code named Rafiki ;D
DISCUSS
A SMART Wrapper
So this SMART wrapper (I've actually already written it) will allow us to add some memory management that can be disabled or enabled on will. This will help with development not only on OUR side, but on the scripters side when they are dealing with Open Objects (Described below). This wrapper also has some basic error checking to make sure an invalid number isn't being passed to SMART resulting in a complete Simba crash. This however will NOT COVER THE ISSUE UP as it will raise an exception and terminate the script, forcing us to resolve the issue. This will help us find those rare random bugs that crash your simba and give you no explanation of what we as developers did wrong. The memory management system does not add any substantial speed decreases, but it is able to be disabled on demand. Having this wrapper, however, changes the way we will be loading SMART. Currently SMART is loaded through the SRL include. This will have to change, as to have the functionality I described, SMART must be loaded WITHIN the plugin. This will most likely be a simple {DEFINE} that will have to be added to SRL. That being said, we want reflection 2.2 to load on it's own as well bringing me to my next point of this incredibly long post…
(You can check out the SMART Wrapper I made here: http://pastebin.com/cAC9pvCH and yes, that was a pain in the but grind to get all of that in there >.>).
Include Independence
Yes, Reflection 2.2 will be completely independent of any other include (namely SRL). This is not an attempt to try and break away from our beloved SRL include and home, but we want to have more options for the users. So Reflection 2.2 will be able to be used separately, independent from SRL. We feel it's just a safe decision overall. That being said, I will be sure to craft it carefully so there will be no hiccups using SRL and Reflection together as a hybrid script (as I do whenever I make my private scripts). I assure you there won't be issues there.
"Open Objects"
One of the advantages java bots have over us is that they can retrieve an object and store it. This allows them to make sure they are retrieving information from the _same_ object, or tracking the _same_ NPC. With our current system, we have to run a search EVERY time we want updated information from an NPC. Sometimes an adjacent NPC will be returned, or one that's standing on our current NPC, or some other reason. We don't have a good tracking system. There was talk about using the NPC Index to search, but I find that hasn't been a fool-proof solution. However I got to thinking about how the java bots do it. Why can't we do it like them? We can, and it's very simple. In reflection 2.2 we will have what I call (and it's a terrible name IMO) "Open Objects". That means during an NPC search, only the object reference from SMART is grabbed and stored in the NPC record. When a user want's a piece of information about that NPC, they call a wrapper for that particular thing and pass the object reference. It sounds complicated but let me give you an example.
Sample NPC Wrapper
type
TNPC = record
Obj: Integer;
end;
function NPC_Create(Obj: Integer): TNPC;
begin
Result.Obj := Obj;
end;
procedure NPC_Free(NPC: TNPC);
begin
if not SmartIsNull(NPC.Obj)then
SmartFreeObject(NPC.Obj);
end;
function NPC_GetAnimation(NPC: TNPC): String;
begin
Result := -1;
if SmartIsNull(NPC.Obj)then
Exit;
Result := SmartGetFieldInt(NPC.Obj, hook_character_Motion);
end; In this sample wrapper, you see how the functions will be laid out to be called on when in need of a specific piece of info.
Sample Searching Function:
function FindNPC(ID: Integer): TNPC;
begin
Result := NullNPC;
for 0 to all the npcs do
begin
if(IsTheRightNPC)then
begin
Result := NPC_Create(TheObjectReference);
Exit;
end else
FreeTheWrongNPCObject;
end;
end; I got lazy here and just wrote the pseudo of it, but you get the idea. So not all of the information is loaded at once, only the object. Once the correct NPC is found, it passes that object to the Result and the user can manipulate that as needed. This will lead to faster NPC finding since we don't have to load 20 pieces of information everytime we return an npc. It's kind of a messy explanation but I tried my best in the ~5 minutes I wrote it :P.
My goals for this are a few things: One, allow for better NPC tracking and object manipulation. Two: allow for easier addition and use of models. Three: maybe the user will gain some knowledge on how objects work and have a better understanding of memory management (since the scripter WILL be in charge of freeing their own grabbed NPC's).
Theres so much more I wan't to accomplish with this include but feel satisfied with the length of this post for now. I will of course keep discussion open for everything so we as a community can make the right decisions for the direction of SRL reflection. You can view my progress from https://github.com/Drags111/Reflection-2.2 but please, PLEASE do not use this include to make scripts. If any script using reflection 2.2 is released to public, I will ask to have it taken down. This isn't to try and keep secrecy or anything like that, but I really don't want confusions for our script users. Feel free to update your scripts to it when we get close to release time (which won't be any time soon), but do not release anything publicly as to avoid confusion. We made the mistake of encouraging use of reflection 2 before it was fully released and it caused many issues.
P.S. I also want to start codenaming includes for funises, and to keep in the spirit of Lion King, this include is code named Rafiki ;D
DISCUSS