ArcEmu: AIINTERFACE Rewrite Thread - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

AIINTERFACE Rewrite Thread Post feedback and suggestions to improving arcemu's ai.

#1 User is offline   paroxysm 

  • Chatty Cathy
  • Group: Retired
  • Posts: 320
  • Joined: 25-June 08
  • Gender:Male
  • Server OS:Windows

Posted 17 October 2010 - 06:03 PM

Please post any crashes/unusual change in ai behavior/bugs. The sooner I can weed out those issues, the sooner it will be live.
Also, please feel free to make suggestions for what new features you would like to see in DB scripting.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Lua Engine Overhaul

The Lua engine is also going through a massive overhaul completely changing the model to use a automatic Lua to Cpp framework called luabridge.
Due to this overhaul, alot of the already established Lua conventions are going to change(unfortunately) meaning alot of scripts will have errors when converting to this new engine.



A short and general list of changing things are:

- Alot of function names(since luabridge now handles exposing of C++ functions to Lua automagically.)

- More classes/structures are being exposed to Lua such as struct SpellEntry and dbcSpell object(allowing you to use code such as
dbcSpell:LookupEntry(...)
, and the Database class accompanied with 2 global instances of it being WorldDB and CharacterDB(the previous code
WorldDBQuery(...) 
will now change to
WorldDB:Query/Execute(...) or CharacterDB:Query/Execute(...)
enforcing some object oriented concepts.
- Gossip feature has also been changed to be an object rather than methods of the core classes.(You would now use code such as
local g_script = GossipScript() //takes advantage of the Lua __call metatable event to simulate C++ constructors 
to create an instance of a GossipScript, then fill it up with your menu items and then pass the 'g_script' to a method that takes a GossipScript object.)

- BIGGEST(and upsetting) CHANGE SO FAR -
The Lua engine has been changed to operate using small engines which are created for every MapMgr object that is.
Meaning that every map instance created will have a unique engine that will not have any variables declared by other engines contained in other maps.
This means that INSTANCE VARIABLE COLLISION WILL NO LONGER BE AN ISSUE and you can now carelessly use globals(preferrably prefix your variables with local to keep the global namespace clean :( ) as you wish since they are localized to the engine of that map instance.
Since the engine is now spawned per map instances, apart from the main thread that does the initial Lua engine loading, every engine will have a global 'MapMgr' that will point to the MapMgr object that that engine is operating on.
So the previous methods such as
someobj:GetMapID and someobj:GetZoneID
will need to be invoked from that MapMgr object like so
MapMgr:GetMapID()
.
As a nice side effect, you can use such code to conditionally load lua files(by renaming the file extension from .lua) based on map ids rather than having them loaded by the core several times over. Ex
//In your main .lua file loading script
//Ignore the initializer thread
if(MapMgr == nil) return end
local map_id = MapMgr:GetMapID()
local my_scripts = {
[1] = { //insert files to load for mapid_1 only here },
[2] = { //insert files to load for mapid_2 only here },
// MAKE SURE TO RENAME THE FILE EXTENSION OF THESE FILES FROM .lua TO SOMETHING ELSE OTHERWISE THEY WILL GET LOADED ON STARTUP
}
if( my_scripts[map_id] ~= nil) then
 for k,v in pairs( my_scripts[map_id] do
  dofile(v)
 end
end


These changes are for the best because they are preparing Lua to be used to massively script content much faster and even better than before.
By having each engine run on it's own thread reduces lock contention meaning the scripts will perform better.

It's time for Lua to make a comeback.
0

#2 User is offline   kjanko 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 171
  • Joined: 10-August 09
  • Gender:Male

Posted 05 November 2010 - 04:52 PM

Suggetsions for the database side scripting:
-Support for Events like:
*OnDied
*OnEnterCombat
*OnLeaveCombat
*OnPlayerKill
*OnParry and so on.
-Phase transition support
-Ability to phase the creatures during a battle
-Ability to script gossips (If possible?)
-Ability to script Gameobjects
-Ability to send Text Messages/Sounds while the battle lasts.
-Enable scripting creatures by using their guids: for example I have npc1 with entry 1 and guid 1234 spawned on location x, I have npc2 with entry 1 spawned on location y with guid 123. With "guid scripting" enabled, we should be able to make different script for npc1 and different script for Npc2.

That's all for now, I'll try to give more feedback in future. No creativity for now :\
Posted Image
0

#3 User is offline   salamanda 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 161
  • Joined: 10-July 08

Posted 17 November 2010 - 01:16 PM

View Postkjanko, on 05 November 2010 - 04:52 PM, said:

Feedback for the database side scripting:
-Support for Events like:
*OnDied
*OnEnterCombat
*OnLeaveCombat
*OnPlayerKill
*OnParry and so on.
-Phase transition support
-Ability to phase the creatures during a battle
-Ability to script gossips (If possible?)
-Ability to script Gameobjects
-Ability to send Text Messages/Sounds while the battle lasts.
-Enable scripting creatures by using their guids: for example I have npc1 with entry 1 and guid 1234 spawned on location x, I have npc2 with entry 1 spawned on location y with guid 123. With "guid scripting" enabled, we should be able to make different script for npc1 and different script for Npc2.

That's all for now, I'll try to give more feedback in future. No creativity for now :\


All of this is already possible and is more suggestions than feedback. Unless I'm much mistaken, this is a rewrite not a entirely new base.

Anyway, keep up the great work paroxysm. :) You actually implement useful things rather than yet more trivial functions.
0

#4 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 17 November 2010 - 01:39 PM

View Postsalamanda, on 17 November 2010 - 01:16 PM, said:

rather than yet more trivial functions.

Could you make an example?
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#5 User is offline   salamanda 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 161
  • Joined: 10-July 08

Posted 17 November 2010 - 02:51 PM

View PostSaintJamesApostle, on 17 November 2010 - 01:39 PM, said:

Could you make an example?


Perhaps I used the wrong word, I mean in the commits all I see is more and more functions being added for the most mundane things often (things that will only be used for one specific thing, not that useful on a whole, often already possible but just simplified) and bug fixes within boss/quest scripts, and while I appreciate that this is useful for a lot of people, I think time could be better spent optimising the Lua engine as it is far from perfect. This new implementation of LuaBridge is a prime example of what can be done to the Lua engine, as it not only improves performance but also removes the common issues of variable collision. I'm thinking long-term benefits rather than boss-scripts that nobody will care about in a few months. :)
0

#6 User is offline   paroxysm 

  • Chatty Cathy
  • Group: Retired
  • Posts: 320
  • Joined: 25-June 08
  • Gender:Male
  • Server OS:Windows

Posted 17 November 2010 - 07:36 PM

Also this per instance engine will allow heavy use of Lua coroutines w/o great performance losses.
0

#7 User is offline   paroxysm 

  • Chatty Cathy
  • Group: Retired
  • Posts: 320
  • Joined: 25-June 08
  • Gender:Male
  • Server OS:Windows

Posted 19 November 2010 - 02:32 PM

I'll get around to writing a tutorial of how to approach such things.
0

#8 User is offline   Saew 

  • Member
  • Pip
  • Group: Members
  • Posts: 10
  • Joined: 11-June 08

Posted 07 December 2010 - 08:48 AM

I'm encountering quite a lot of problems when using the AIInterface with ~40 mobs at the same time.

Waypoints aren't always set (or empty?).
Video of what it looks like: http://www.youtube.c...h?v=9S5sXaL8quo
Script which causes problem to occur: http://pastebin.com/Dny31Sqh

When this problem occurs I get the following warning messages:

Quote

...
[21:25][Arcemu]ScriptMgr has registered a dummy handler for Spell ID: 28730 ( Arcane Torrent ), but spell has no dummy effect!
[21:25][Arcemu]ScriptMgr is trying to register a gossip for Creature ID: 45002 even if there's already one for that Creature. Remove one of those gossips.
[21:25][Arcemu]ScriptMgr is trying to register a script for Creature ID: 45001 even if there's already one for that Creature. Remove one of those scripts.
[21:25][Arcemu]Spell ID: 33391 ( Journeyman Riding ) has a dummy effect ( 0 ) but no handler for it.
[21:25][Arcemu]Spell ID: 34090 ( Expert Riding ) has a dummy effect ( 0 ) but no handler for it.
[21:26][Arcemu]WayPoint ID 1 wasn't added to Unit ID c9000004 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 2 wasn't added to Unit ID c9000004 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 3 wasn't added to Unit ID c9000004 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 1 wasn't added to Unit ID c9000005 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 2 wasn't added to Unit ID c9000005 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 3 wasn't added to Unit ID c9000005 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 1 wasn't added to Unit ID c9000006 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 2 wasn't added to Unit ID c9000006 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 3 wasn't added to Unit ID c9000006 due to an error occurred in AIInterface::addWayPoint()
[21:26][Arcemu]WayPoint ID 1 wasn't added to Unit ID c9000007 due to an error occurred in AIInterface::addWayPoint()


After a bit of debugging I found out that the error message is caused by this line (in AIInterface.cpp, 'addWayPointUnsafe', line ~2680)
	if((*m_waypoints)[wp->id] == NULL)
	{
		(*m_waypoints)[wp->id] = wp;
		return true;
	}
	return false;                          // <=== This is the 'return false' which is executed

0

#9 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 07 December 2010 - 10:27 AM

  • this thread is for issues/feedback related to the AIInterface rewrite branch http://sourceforge.n...terface_rewrite . It doesn't mean that trunk http://sourceforge.n...u/browser/trunk has not AIInterface

    Quote

    [21:25][Arcemu]ScriptMgr is trying to register a gossip for Creature ID: 45002 even if there's already one for that Creature. Remove one of those gossips.
    [21:25][Arcemu]ScriptMgr is trying to register a script for Creature ID: 45001 even if there's already one for that Creature. Remove one of those scripts.
  • If you are wondering why Creature 45001 doesn't do what your script is supposed to do and Creature 45002 doesn't show the gossip supposed to show up, these errors are the answers.
  • the code you posted assigns the waypoint wp passed at parameter only if m_waypoints doesn't have already a waypoint with the same id. Are you sure your database has not already waypoints for Creature spawns with Creature Id 45001? Why don't you use
    void CreateCustomWaypointMap(Creature* creat);
    void WaypointCreate(Creature* pCreature , float x, float y, float z, float o, uint32 waittime, uint32 flags, uint32 modelid)
    found in trunk\src\scripts\src\Common\EasyFunctions.h ? It makes use of m_custom_waypoint_map, so waypoints loaded from the database will be ignored. Even better, if you want to script only Creatures with spawns saved in the database, use the creature_waypoints table.

Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#10 User is offline   Saew 

  • Member
  • Pip
  • Group: Members
  • Posts: 10
  • Joined: 11-June 08

Posted 07 December 2010 - 10:48 AM

1. Ahh.. Sorry. I didn't realize this thread was for issues/feedback related to the rewrite branch. I saw "AIINTERFACE Rewrite" and "Please post any crashes/unusual change in ai behavior/bugs." So I thought this was the place to post my problem. Would you like me to move this post?

2. It's strange, creature 45001 and 45002 do exactly what I want them to do for 90% of the time. And now that I recompiled the server, I don't get that warning anymore. I must've messed up somewhere and accidentally have fixed it? :)

3. Thanks, I'll try that. I was simply re-using code from the trunk/src/scripts/src folder.
0

#11 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 17 December 2010 - 06:53 AM

http://pastebin.com/QkagsYRC
broken build on nix. poor nix :(
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#12 User is offline   paroxysm 

  • Chatty Cathy
  • Group: Retired
  • Posts: 320
  • Joined: 25-June 08
  • Gender:Male
  • Server OS:Windows

Posted 18 December 2010 - 12:28 AM

fixed
0

#13 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 18 December 2010 - 05:12 AM

http://pastebin.com/gwy3phFU
there are still a lot of warnings and the Lua Engine doesn't build (which is not always a bad thing ^^ )
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users