Thread: We need an API

Page 1 of 17 12311 ... LastLast
Results 1 to 10 of 164
  1. #1 We need an API 
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,606
    Thanks given
    242
    Thanks received
    979
    Discord
    View profile
    Rep Power
    1281
    The API's main use would be for scripts or anything not directly involved in the CORE of the server.

    I've only taken the time to plan out some events, but we should figure out useful methods to be exposed to

    scripts as well.


    All have base class of "Event," not sure what it should be.
    All methods should return booleans for if the action can continue.
    Scripts will have priorities so you can run them in a specific order.
    Not sure how Items in different Interfaces would work. Can items from one Interface be used with another's

    Items?

    "_" denotes that it's an abstract class

    Code:
    GroundItem:
    	_GroundItemEvent (what Tile and what Item)
    	GroundItemAddEvent (new ground item)
    	GroundItemUpdateEvent (item amount)
    	GroundItemPickupEvent (who, more specific version of GroundItemRemoveEvent)
    	GroundItemRemoveEvent (reason, Player)
    
    Movement: (Entities)
    	_MovementEvent (what Entity)
    	PathUpdateEvent (new path)
    	MoveEvent (where to, running or not, less specific version of walk and run events)
    	WalkEvent (where to)
    	RunEvent (where to)
    	
    Teleport: (Entities)
    	_TeleportEvent (what Entity, where to)
    	TeleportStartEvent (doing animation)
    	TeleportEndEvent (actually teleporting)
    
    Harvest: (Players, the "harvest success rate" formula will be applied in the core - events fired accordingly)
    	_HarvestEvent (what Object)
    	HarvestTreeStartEvent (these are for when the action is beginning, you can check requirements here)
    	HarvestFarmStartEvent
    	HarvestRockStartEvent
    	HarvestTreeEvent (these are actually when a resource is supposed to be collected)
    	HarvestFarmEvent
    	HarvestRockEvent
    	HarvestTreeEndEvent (what reason - manual stop, depleted, etc.)
    	HarvestFarmEndEvent (what reason)
    	HarvestRockEndEvent (what reason)
    
    Entity:
    	_EntityEvent (what id, what EntityType)
    	EntityInitializeEvent (very start of entity)
    	EntitySpawnEvent (what location, reason - death or first spawn)
    	EntityDamageEvent (reason: poison type, pvp, pvm, does actual damaging itself)
    	EntityAnimationEvent (what Animation)
    	EntityHealEvent (via prayer, food, or a special)
    
    Combat: (Entities)
    	_CombatEvent (what Entity, what Entity we are attacking)
    	CombatStartEvent (can we attack)
    	CombatSpecialEvent (what special)
    	CombatDamageEvent (does actual damaging)
    	CombatEndEvent (reason)
    
    Death: (Entities)
    	_DeathEvent (what Entity, where, and what cause)
    	DeathStartEvent (ex: doing animation)
    	DeathEndEvent (actually dying)
    
    Player: Entity
    	_PlayerEvent (what Player)
    	PlayerClickEvent (x, y, left or right mouse button)
    	PlayerPrayerEvent (on or off and what prayer)
    	PlayerLogoutEvent (reason)
    	PlayerReconnectEvent
    	PlayerDisconnectEvent (reason)
    
    NPC: Entity
    	_NPCEvent (what NPC)
    
    Interface: (Players)
    	_InterfaceEvent (what Player, what Interface)
    	InterfaceButtonClickEvent (what button)
    	InterfaceAnimationEvent (what animation)
    	InterfaceCloseEvent (reason - disconnect, x button, etc.)
    
    Poison: (Entities)
    	_PoisonEvent (what Entity)
    	PoisonStartEvent (cause, time it lasts)
    	PoisonDamageEvent (type, does actual damaging itself)
    	PoisonEndEvent (reason - food, prayer, or it ending on its own)
    
    Armor: (Player, NPC if implemented client-side)
    	_ArmorEvent (what Entity, what Item)
    	ArmorEquipEvent (can equip)
    	ArmorUpdateEvent (updating amount of arrows, charges, etc.)
    	ArmorRemoveEvent (removing armor)
    
    Inventory: (player, trade, bank, duel etc.)
    	_InventoryEvent (what Item, what slot, what Interface)
    	InventoryAddEvent (can add item to slot in interface)
    	InventoryUpdateEvent (reason - amount or id, new amount or new id)
    	InventoryRemoveEvent (reason - death, player removal, etc.)
    	InventoryUseEvent (reason - Item or Entity, on what instance)
    	InventorySwitchEvent (to which slot)
    
    Tile:
    	_TileEvent (what Tile)
    	TileEnterEvent (reason - walk into or log in, what Entity)
    	TileLeaveEvent (reason - walk away or log out, what Entity)
    
    Object: Entity
    	_ObjectEvent (what Object)
    	ObjectAddEvent (alias for EntitySpawnEvent)
    	ObjectRemoveEvent (alias for DeathEndEvent)
    	ObjectFaceUpdateEvent (to what Face)
    	ObjectStateUpdateEvent (to what State)
    .
    Reply With Quote  
     

  2. #2  
    Respected Member

    Join Date
    Jan 2009
    Posts
    5,694
    Thanks given
    1,107
    Thanks received
    3,514
    Discord
    View profile
    Rep Power
    5000
    There is a good few script engines on here already, use something like a PriorityQueue for the specific ordering, can eval each function into the engine so you can then overwrite the function in each script.
    Reply With Quote  
     

  3. #3  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,606
    Thanks given
    242
    Thanks received
    979
    Discord
    View profile
    Rep Power
    1281
    To be honest, that's not really a good implementation. Look at Bukkit if you want an example of what I'm trying to start here.

    It's better if we use Java for everything. No overhead of some shitty third party implementation of a scripting language too. You register callbacks for events and the server calls those methods. There's no marshalling involved either because it's all the same language. Compiled before running to eliminate any potential compilation errors once the script is running.

    TL;DR:
    "Scripting" systems in servers at the moment are shit because they use some bad third party scripting language implementations and aren't very defined or even useful and they need to be improved on.
    .
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Banned

    Join Date
    Dec 2008
    Posts
    2,098
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    Quote Originally Posted by Supah Fly View Post
    No overhead of some shitty third party implementation of a scripting language too.
    Some languages, such as lua, run just as fast as java on the jvm
    Reply With Quote  
     

  6. #5  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,606
    Thanks given
    242
    Thanks received
    979
    Discord
    View profile
    Rep Power
    1281
    Quote Originally Posted by Jimmy View Post
    Some languages, such as lua, run just as fast as java on the jvm
    But can never run as fast.

    Edit: Looking at LuaJ it has lua to java bytecode compiling. Why involve another layer when the solution is as easy as just using Java? What are the benefits of using Lua as a "script" or "plugin" language instead of using Java?
    .
    Reply With Quote  
     

  7. #6  
    Banned

    Join Date
    Dec 2008
    Posts
    2,098
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    Quote Originally Posted by Supah Fly View Post
    But can never run as fast.
    The difference wouldn't even be enough to worry about tbh. Have a look at Apollo, highly abstract design, uses jruby and still manages to perform fairly well. Not to put Graham's work down, but we have quite a few people around here perfectly capable of creating something to out perform it and still keep a nice flexible design.

    tl;dr performance isn't really an issue.

    Quote Originally Posted by Supah Fly View Post
    Edit: Looking at LuaJ it has lua to java bytecode compiling. Why involve another layer when the solution is as easy as just using Java? What are the benefits of using Lua as a "script" or "plugin" language instead of using Java?
    I never suggested the use of lua only that performance isn't an issue as stated above. But since you asked, lua, like many other scripting languages, gives the benefit of increased productivity because of it being dynamically typed. Not only does it provide that but it allows you to be able to change and reload content at run-time by simply reloading the scripts. And finally, imo, the syntax looks alot nicer than java's.

    I'm sure there are many other benefits of using such a language over java as well as some cons but that's all I'm listing.
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Mar 2012
    Posts
    186
    Thanks given
    16
    Thanks received
    10
    Rep Power
    25
    Quote Originally Posted by Jimmy View Post
    The difference wouldn't even be enough to worry about tbh. Have a look at Apollo, highly abstract design, uses jruby and still manages to perform fairly well. Not to put Graham's work down, but we have quite a few people around here perfectly capable of creating something to out perform it and still keep a nice flexible design.

    tl;dr performance isn't really an issue.



    I never suggested the use of lua only that performance isn't an issue as stated above. But since you asked, lua, like many other scripting languages, gives the benefit of increased productivity because of it being a dynamically typed. Not only does it provide that but it allows you to be able to change and reload content at run-time by simply reloading the scripts. And finally, imo, the syntax looks alot nicer than java's.

    I'm sure there are many other benefits of using such a language over java as well as some cons but that's all I'm listing.


    Syntax is preference.

    Not to put Graham's work down, but we have quite a few people around here perfectly capable of creating something to out perform it and still keep a nice flexible design.
    Was that really needed?
    Spoiler for Midgets:


    Quote Originally Posted by four View Post
    You aren't really... wrong, but you are retarded.
    Reply With Quote  
     

  9. #8  
    Community Veteran


    Join Date
    Jan 2008
    Posts
    2,666
    Thanks given
    494
    Thanks received
    627
    Rep Power
    980
    Quote Originally Posted by averykey View Post
    Syntax is preference.
    I reckon that's why he said "imo".

    Quote Originally Posted by averykey View Post
    Was that really needed?
    Well, I think the point is that it's not really difficult.
    ~iKilem
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Registered Member DestriX's Avatar
    Join Date
    Nov 2008
    Posts
    1,325
    Thanks given
    490
    Thanks received
    152
    Rep Power
    257
    I agree, I am pretty sure the simplicity of designing server content would be a lot more easier considering that no one would have to learn another programming language. Apollo has a fair chance, but not everyone wants to learn Ruby.
    Reply With Quote  
     

  12. #10  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,606
    Thanks given
    242
    Thanks received
    979
    Discord
    View profile
    Rep Power
    1281
    Quote Originally Posted by Jimmy View Post
    The difference wouldn't even be enough to worry about tbh. Have a look at Apollo, highly abstract design, uses jruby and still manages to perform fairly well. Not to put Graham's work down, but we have quite a few people around here perfectly capable of creating something to out perform it and still keep a nice flexible design.

    tl;dr performance isn't really an issue.



    I never suggested the use of lua only that performance isn't an issue as stated above. But since you asked, lua, like many other scripting languages, gives the benefit of increased productivity because of it being a dynamically typed. Not only does it provide that but it allows you to be able to change and reload content at run-time by simply reloading the scripts. And finally, imo, the syntax looks alot nicer than java's.

    I'm sure there are many other benefits of using such a language over java as well as some cons but that's all I'm listing.
    You can reload "plugins" in Java. Look at RSBot and Bukkit, they don't need a "scripting" language. Java works fine for that.

    I think that adding functionality beyond the core of walking, talking, items, objects, combat basics, multiplayer, NPCs, equipping, etc. right into a server is stupid. Any content beyond core functionality should be through an API that way you aren't bloating the server.

    I like the fact that with scripts on RSBot or plugins for Bukkit you don't have to recompile every time you make a change. You don't even have to turn the bot or in the case of Bukkit, the server, off.
    .
    Reply With Quote  
     

  13. Thankful user:


Page 1 of 17 12311 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Skills API?
    By Mister Maggot in forum RS2 Server
    Replies: 12
    Last Post: 08-24-2010, 01:17 AM
  2. What's the best API?
    By TriConnectivity™ in forum Help
    Replies: 12
    Last Post: 06-15-2010, 11:52 PM
  3. what API does RID use?
    By sylas in forum Application Development
    Replies: 17
    Last Post: 05-16-2010, 11:22 PM
  4. Networking Api
    By Karilz in forum Voting
    Replies: 6
    Last Post: 05-04-2010, 05:55 AM
  5. Which API?
    By Discardedx2 in forum RS 503+ Client & Server
    Replies: 35
    Last Post: 04-09-2010, 01:07 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •