SRL Archive - Reflection Development

Reflection 2.2 Discussion


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
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


mormonman

2011-09-11 23:23:07

From: Drakan
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


It's spelled funsies.

Drakan

2011-09-11 23:23:41

From: mormonman
It's spelled funsies.


hush, it was a long post :P

Jakkle

2011-09-11 23:48:33

Very VERY nice :) Really sounds good what you've wrote there, grate ideas to. I'm glad you've pointed out that no1 should release any scripts for it, it was a bit mayhem with ref 2. I will look over things tomorrow as I cba right now :p and look forward to it and the 'Open Objects' especially.

So glad your a Ref dev here along with the others. lots of <3 to you all :spot:

Flight

2011-09-12 00:38:10

This question isn't directly related to all of the OP, but it has alot to do with your reference to Models.

How exactly will we be able to click an on-screen model? Will there need to be a conversion function made (similar to TileToMS) to convert the model's location to actual points on the screen? (Also returning a nifty little TPA we could use for debugging?) Will there be a function that tells us if the model is on screen, and will that also return the same result if only part of the model is visible on-screen?

mormonman

2011-09-12 01:33:23

From: Flight
This question isn't directly related to all of the OP, but it has alot to do with your reference to Models.

How exactly will we be able to click an on-screen model? Will there need to be a conversion function made (similar to TileToMS) to convert the model's location to actual points on the screen? (Also returning a nifty little TPA we could use for debugging?) Will there be a function that tells us if the model is on screen, and will that also return the same result if only part of the model is visible on-screen?


That stuff is undecided/unwritten at this point…sorta.
It would be inefficient for you to debug a model. Most likely we will give a couple different functions for returning model points. If you knew how runescape models worked I could explain a little more. Basically they are made up of triangles and each vertex on the triangle is a 3D point. We already have the World3DToScreen method that converts a runescape point to an onscreen point.

Drakan

2011-09-12 02:22:20

From: mormonman
That stuff is undecided/unwritten at this point…sorta.
It would be inefficient for you to debug a model. Most likely we will give a couple different functions for returning model points. If you knew how runescape models worked I could explain a little more. Basically they are made up of triangles and each vertex on the triangle is a 3D point. We already have the World3DToScreen method that converts a runescape point to an onscreen point.


quite the contrary, it is all decided exactly how it will work. What mormonman said is correct: The models are made of lots of triangles. However each point on each triangle will be held in a TPA, which will be used to calculate exact screen positions of the model. It will be as simple as Model_GetMiddlePoint or GetRandomPoint or something to the effect. If you wanna read over the model class I made for my little Titan Reflection project, just visit here: https://github.com/Drags111/Kronos/blob/master/lib/wrappers/Model.scar

This has a fully functional and tested model system, as it's not very hard to do when you have the right setup. All of the math will be handled in the wrapper plugin I made so it should be very efficient and easily debugged using Simba's painting methods. Everything is laid out in Kronos on how I will be handling things in 2.2. (everything meaning models and open objects etc).

Flight

2011-09-12 02:33:58

From: Drakan
quite the contrary, it is all decided exactly how it will work. What mormonman said is correct: The models are made of lots of triangles. However each point on each triangle will be held in a TPA, which will be used to calculate exact screen positions of the model. It will be as simple as Model_GetMiddlePoint or GetRandomPoint or something to the effect.


So the explains why Iamadam's model debugging was done with triangles.

nielsie95

2011-09-12 04:50:08

Sounds useful!

mormonman

2011-09-12 04:59:45

From: Drakan
quite the contrary, it is all decided exactly how it will work. What mormonman said is correct: The models are made of lots of triangles. However each point on each triangle will be held in a TPA, which will be used to calculate exact screen positions of the model. It will be as simple as Model_GetMiddlePoint or GetRandomPoint or something to the effect. If you wanna read over the model class I made for my little Titan Reflection project, just visit here: https://github.com/Drags111/Kronos/blob/master/lib/wrappers/Model.scar

This has a fully functional and tested model system, as it's not very hard to do when you have the right setup. All of the math will be handled in the wrapper plugin I made so it should be very efficient and easily debugged using Simba's painting methods. Everything is laid out in Kronos on how I will be handling things in 2.2. (everything meaning models and open objects etc).


I wasn't sure if you were bringing the Kronos "proof of concepts" over to 2.2 which is why I said "sorta" :P

I'll be the one handling what you guys want added to ref 2.2(not including basic stuff that is already in reflection) so just hit me up on msn: [email]the_dog_hunter@hotmail.com[/email] or skype: smith.trenton and I will try to get the things you need added ASAP(unless it isn't possible).

kingarabian

2011-09-12 05:17:32

I like that. I like this, thinking ahead.

Wizzup?

2011-09-12 05:27:58

Cool. Don't forget that the Simba source code may include a lot of helper functions. If you guys feel the need to some serious TPA sorting, you could just include the Simba tpa.pas, etc.

masterBB

2011-09-12 19:35:32

From: Flight
So the explains why Iamadam's model debugging was done with triangles.


Hehe, all 3d engines(except maybe a few odd) are done with triangles. It's an very easy way to draw any complex shape. The only big cons of triangles are drawing spheres cause you need a lot of them and some effects(which are mostly 2d planes in an 3d world anyway).
*Remembers working on small personal 3d engine project*…

On topic. Looks nice. Can't wait! You guys seems to be very productive.

Gu3st...

2011-09-12 20:17:55

From: masterBB
Hehe, all 3d engines(except maybe a few odd) are done with triangles. It's an very easy way to draw any complex shape. The only big cons of triangles are drawing spheres cause you need a lot of them and some effects(which are mostly 2d planes in an 3d world anyway).
*Remembers working on small personal 3d engine project*…

On topic. Looks nice. Can't wait! You guys seems to be very productive.
Polygons*

They work with Polygons, not (only) Triangles. And a lot of 3d engines use voxels or point cloud data or other forms of 3d calculating

ry0240

2011-09-19 17:07:46

Is there a estimated/planned time for this new update? Or is to early in development to say?

mormonman

2011-09-19 17:16:09

From: ry0240
Is there a estimated/planned time for this new update? Or is to early in development to say?


It is too early.

Yago

2011-09-19 20:19:55

I LOVE YOU GUYS!!!!!


From: mormonman
It is too early.


So like 6 months - 1 year

or sooner?

Drakan

2011-09-19 23:25:35

About 10 years is what I'm planning for.

Coh3n

2011-09-19 23:36:35

From: Drakan
About 10 years is what I'm planning for.
I like that. Absolutely no rush. :)

Nava2

2011-09-19 23:50:19

It'll be ready next quarter.

mormonman

2011-09-20 02:55:07

From: Drakan
About 10 years is what I'm planning for.


Or 20. Maybe we should decide tomorrow. Or the next day.

Nava2

2011-09-20 08:43:29

No one got my reference :(

Gu3st...

2011-09-20 12:14:52

From: Nava2
No one got my reference :(
I did :p
Just didn't want to post

DeSnob

2011-09-24 09:41:27

Wow, open objects? It's gonna be amazing! My sorc bot will love you for this! :D

Is there any way we can do model clicking? (Would be helpful in certain situations)

Yago

2011-09-24 13:21:03

From: DeSnob
Wow, open objects? It's gonna be amazing! My sorc bot will love you for this! :D

Is there any way we can do model clicking? (Would be helpful in certain situations)


Yes models areplanned for this release.

Harry

2011-10-08 05:59:59

I'm really tired of my scripts crashing with JNI errors. Can anything from this be ported into Ref2? It's terrible that 6 out of 7 of my clients are exited by the time I wake up.

Edit: the plugin is in main branch now of r2 I think, yay. Let's see how it rolls.

Bixby Sayz

2011-10-11 10:00:45

Just downloaded this to have a look and have a question already. Can reflection 2.2 be used in the same script with SRL?

With just the reflection 2.2 include it compiles fine.
program new;

//{$i srl/srl.scar}
{$i reflection-2.2/reflection.simba}

begin
ClearDebug;

Smart_Server := 157;
Smart_Members := FALSE;
Smart_Signed := TRUE;
Smart_SuperDetail := FALSE;
SetupReflection;
end.
If I include SRL then Reflection 2.2 (in that order) I get:
[Error] C:\Program Files\Simba\Includes\reflection-2.2\Modules\Core\SMART.simba(11:10): Duplicate identifier 'ISKEYDOWN' at line 10
Compiling failed.


Going the other way and including reflection, then SRL I get:
[Error] C:\Program Files\Simba\Includes\SRL/SRL/core/globals.scar(79:3): Duplicate identifier 'MMX1' at line 78
Compiling failed.

Heavenzeyez1

2011-10-11 10:03:32

From: Harry
I'm really tired of my scripts crashing with JNI errors. Can anything from this be ported into Ref2? It's terrible that 6 out of 7 of my clients are exited by the time I wake up.

Edit: the plugin is in main branch now of r2 I think, yay. Let's see how it rolls.


^This!

~Eerik.

mormonman

2011-10-11 11:50:57

From: Bixby Sayz
Just downloaded this to have a look and have a question already. Can reflection 2.2 be used in the same script with SRL?

With just the reflection 2.2 include it compiles fine.
program new;

//{$i srl/srl.scar}
{$i reflection-2.2/reflection.simba}

begin
ClearDebug;

Smart_Server := 157;
Smart_Members := FALSE;
Smart_Signed := TRUE;
Smart_SuperDetail := FALSE;
SetupReflection;
end.
If I include SRL then Reflection 2.2 (in that order) I get:


Going the other way and including reflection, then SRL I get:


We haven't added any support for including srl yet. We actually aren't working on that version anymore.

Bixby Sayz

2011-10-11 14:05:39

From: mormonman
We haven't added any support for including srl yet. We actually aren't working on that version anymore.


Ah, okay.