Jump to content

Odd NPC behavior...


Xenithar

Recommended Posts

Best of luck! ;)

I have duplicated the steps on my end and the merge of movemaps into my working directory with the master went very smoothly with no reported errors. Just in case, I exported the results to a ZIP archive, ready for compiling.

I have some other things to do, so I'll be offline for a while, but I'll check back this evening and, hopefully, see that you've had success.

Link to comment
Share on other sites

Problem. It all went smoothly, even building. However, I get the following when I start the server.

 [A] You have: --> `z1809_xxxxx_01_mangos_spell_affect_event.sql`

 [b] You need: --> `z1765_xxxxx_01_mangos_spell_affect.sql`

Somehow mmaps is degrading something in zero so I am unable to use my database. I don't want to downgrade. Is there a way to just tell the server to use the latest version? I fail to see how the movement maps should care about my database version. I assumed the data I spent a day generating was all the mmaps stuff needed. So why is it requiring outdated stuff and how can I fix it?

Link to comment
Share on other sites

Alright, I'm about worn out with all of this building and rebuilding, no errors but nothing works mess. How can I integrate mmaps without reverting to old code? Also, couldn't I setup the working branch to track origin/master instead of adding another remote entry?

Link to comment
Share on other sites

Without taking the drastic measure of actually setting up a Zero server of my own, I'm at a loss as to why your server is complaining about your database version.

Unless you are absolutely [em]sure[/em] working started with a current copy of the Zero master, it is entirely possible you instead had movemaps copied into working. [em]This means you merged movemaps into itself[/em], which is one possible explanation why your server expects an older database update.

This is why I advised creating a remote that links working to the master repository. I know it's redundant, but I'm trying to avoid having to wade into the more advanced Git plumbing to keep confusion to a minimum.

Here's a link to download my copy of MaNGOS-Zero merged with mmaps... Zero_mmaps_01-02-2012.zip hosted at MediaFire

Try compiling that and see how it works. That ought to get you up and running so you can return to figuring this all out after relaxing for a time in Azeroth.

Link to comment
Share on other sites

I did it your way. I once again delete the entire directory-tree, recreated, initialized, and went down your list. I was sure (I checked prior to switching to working) I was on master. I then switched to working, merged mmaps with no problems, configured, built, and got the database issue. If you merged them the same way as in your guide, it will expect the old version. However, if you compile the mmaps by itself it expects an even older version (14xx I believe). So it boils down to this for me.

  • MoveMaps by itself wants 14xx
  • MMaps merged into master expects 17xx
  • Zero by itself uses 1809, which my server and characters live on

I may try yours, but before I waste another hour, is it possible for us to check whatever source file contains the database version to see which version it expects? This may save me another hour if it wants that 17xx version. I don't know which file has that info though, do you?

*EDIT*

By the way, don't I have to add something for scriptdevzero? I used to get an sd0 configuration file upon installation. I don't get one now. Am I missing something?

*UPDATE*

Yes, we need sd0. I added remote as follows:

git remote add -f -t master sd0 git://github.com/mangos-zero/scriptdev0.git

I will do the obligatory "git branch sd0 --track sd0/master" once it finishes the initial download. I assume that then I must switch to working, merge mmaps, then merge sd0?

*UPDATE*

Done!

<hidden>@WoW01:~/wow-src$ git remote add -f -t master sd0 git://github.com/mangos-zero/scriptdev0.git
Updating sd0
warning: no common commits
remote: Counting objects: 35567, done.
remote: Compressing objects: 100% (6137/6137), done.
remote: Total 35567 (delta 27805), reused 35518 (delta 27764)
Receiving objects: 100% (35567/35567), 7.87 MiB | 46 KiB/s, done.
Resolving deltas: 100% (27805/27805), done.
From git://github.com/mangos-zero/scriptdev0
* [new branch]      master     -> sd0/master
<hidden>@WoW01:~/wow-src$ git branch sd0 --track sd0/master
Branch sd0 set up to track remote branch master from sd0.
<hidden>@WoW01:~/wow-src$ git branch
* master
 mmaps
 sd0
 working
<hidden>@WoW01:~/wow-src$

Should be good now. Will try a build soon. I did download your zip however, and may try it if I get aggravated enough to give up. I am a VERY persistent, gun-toting, mad-man! Wait, I mean programmer, yeah, programmer...

*UPDATE*

Alright, I changed from master to working and tried to merge sd0. Got four conflicts. Two I can ignore (LICENSE.mdown and README.mdown), but the other two are .gitignore and CMakeLists.txt. These are not C/C++, so I haven't a clue how to fix them. What should I do?

Link to comment
Share on other sites

Just so you know...that ZIP file does not have scriptdev0. Here is a newly uploaded version, that includes ScriptDevZero, which you should be able to compile right out of the box, so to speak:

Zero_mmaps_SD0_01-02-2012.zip hosted at Mediafire

As for your merge errors with sd0...

You do not merge the ScriptDev0 repository with your MaNGOS-Zero repository.

Instead, create a directory, labeled ScriptDevZero, inside of src/bindings/ of your master. Then cd into that ScriptDevZero folder, use git init, and then fetch the sd0 source and create the branch the same way as you did for Zero master and movemaps.

Once that is done, you the must apply the patch, MaNGOSZero-ScriptDevZero.patch, found inside the patches folder of the scriptdev0 source so Git will play nice with having the sd0 repo inside your MaNGOS-Zero repo.

To patch your sd0 repo:

git checkout ScriptDevZero

copy the patch into your ScriptDevZero root directory /src/bindings/ScriptDevZero/

git apply MaNGOSZero-ScriptDevZero.patch

[EDIT]: Seems the patch is corrupted with errors and my brain is too tired to solve it at this hour. You can instead manually edit the CMakeLists.txt file inside /src/bindings.

Replace this line:

# add_subdirectory(universal)

with this text:

add_subdirectory(ScriptDevZero)

notice there is no hash symbol because the line [em]should not[/em] be commented out.

Then you're ready to merge your master (with ScriptDevZero inside it), into working

git checkout working

git merge master

and then merge movemaps

git merge mmaps

Alternatively, you can create an entirely separate repo for ScriptDevZero, copy your merged master and movemaps to a temp directory for compiling, copy the ScriptDevZero files into the /src/bindings/ directory there, and then compile. This eliminates the need to have the sd0 repo nested inside your MaNGOS-Zero repo.

If you followed my guide exactly, then you should not have any errors regarding database versions, unless there is an error in the source code or you obtained your database from a source other than the MaNGOS-Zero repository located at git://github.com/mangos-zero/database.git

When you deleted the old repository, I assume you wiped all files and directories, including the .git folder, and then created a new directory and initialized it?

Link to comment
Share on other sites

git checkout -f working

git reset --hard origin/develop

git merge feature/movemaps

git checkout feature/movemaps -- contrib/extractor/ad.exe

git add contrib/extractor/ad.exe

# resolve remaining conflicts (all easy)

# use git add to mark the conflicts resolved

git commit

I leave fixing the merge conflicts as an exercise for the reader, as well as learning what those commands do (eg, man git-reset or git help reset)

This should get you in working shape.

Link to comment
Share on other sites

Thank you for sharing your method of dealing with a failed merge and fixing things, faramir.

The guidance I've offered so far is how I handled things when first starting with Git, and it worked for me without fail over dozens of server versions with multiple patches merged each time. Maybe there's some quirk to the Zero repository that has eluded my comprehension such that this simplified method isn't working?

If the way I've outlined things fails yet again, faramir's proposal would guarantee you'll properly fetch and merge the code you need, Xenithar.

Link to comment
Share on other sites

Well my problem is in resolving conflicts. For one, I didn't write the code. For another, the conflicts always seem to be git files and cmake files while I am a C++ guy. They may be easy to you two, but I am lost in cmake format files and git files. I never had conflicts while working with svn. Add this to the pile of issues with git that need to be sorted. I wouldn't expect a .NET UI designer to be able to fix a C++ DLL issue in a Windows project, and this cmake stuff is as alien to me as Daerdric text is to you.

What I am getting at is that it tells me there's a conflict, but I haven't a clue what I am looking for because I do not understand the cmake format or what the file is telling cmake to do. It would be like me asking you to rebuild a 500hp Cat truck engine, assuming you are not a diesel tech! I don't know what I am looking for, so my only option is to start cutting lines of code until it works or breaks, then pasting back what is needed if it breaks.

Link to comment
Share on other sites

If you take it slow, read the error output carefully, and apply some knowledge of the source code structure, you'll find most errors are obvious, especially if you are used to programming. Git is merely the tool used to get the code and then patch or merge it, just like other VCS tools like SVN.

In post #30, the errors Git spit back out were due to the simple mistake of trying to merge ScriptDevZero with MaNGOSZero when what you wanted to do was get the sd0 code and put it inside the MaNGOS source tree. ScriptDevZero is an add-on module and not intended to be merged with the server source.

Just remember that, once you have compiled the MaNGOSZero source, you must then follow up with compiling ScriptDev0. This is because sd0 uses its own library files in place of the default MaNGOS files for the scripting engine that plugs into the server executable. Only then will you have a working ScriptDev that allows you to use their database updates.

Link to comment
Share on other sites

Tell you what... I'll make up a new Zero repo and dig around in the code to see why the database and server versions are not matching up. It will take me a few days to get back to you with some sort of answer. My schedule is a bit tied up for the next couple of days.

Keep chipping away at it in the meantime. Have you tried that latest source I provided for download in post #31? It is Zero master, with movemaps merged in and ScriptDevZero added in its proper place.

Link to comment
Share on other sites

What is with the sudden attack of retards, err spammers? I see three new spam posts and now they're infesting our legit threads also!

I will keep at it, but I will also say that everything went flawlessly last night. No merge errors or build errors. That leads me to believe that something in the mmaps sources is either requiring 1765 or is overwriting something in zero that it shouldn't be. If I compile plain zero and sd0, no issues, but mobs like to bounce around and fall through bridges. If I knew where the code to check the database revision was, I would simply manually set it to 1809 and then compile to see if it would run properly using 1809. I will keep looking at it in the evenings after work. Thanks for your support!

Link to comment
Share on other sites

Okay, I unexpectedly had some free time early this afternoon so I did some digging into the Zero repository after fetching my own fresh copy.

If I'm reading things right, you and I did everything correctly and you should have had a working, fully updated server. The fault is with the Zero master repo itself.

Instead of Git showing HEAD as being 0721d0dc1584cb674d8b7fbe96ea9aea2a721b54, it is set to 204f9a9cdf1775e00606365ff6deed5c4788f3fc.

This explains why the SQL updates in the source tree only go as high as z1765_xxxxx_01_mangos_spell_affect.sql instead of z1809_xxxxx_01_mangos_spell_affect.sql.

It turns out there is now no master. The new main HEAD for the Zero repo is now called develop so who knows where the heck the code we pulled came from. I wish people would stick to the more standard style for branches to save the rest of us headaches.

So, when you create your local copy, set master to point to develop and everything should work as intended now.

To summarize:

git remote add -f -t develop master git://github.com/mangos-zero/server.git

git branch master --track master/develop

git remote add -f -t feature/movemaps mmaps git://github.com/mangos-zero/server.git

git branch mmaps --track mmaps/feature/movemaps

git checkout master

git branch working

git merge master <---if necessary

git merge mmaps

Of course, don't forget to create a ScriptDevZero folder (must be named exactly so to work with their patches and code), copy the sd0 files there, and patch the Cmake file as specified in my earlier post, EXCEPT to note that the scriptdev0 repository also has switched to using develop as its new master branch so make sure when creating your remote alias for your local ScriptDevZero to point it to develop.

When merging mmaps into working, Git should report back with this:

warning: Cannot merge binary files: contrib/extractor/ad.exe (HEAD vs. mmaps)

Auto-merging win/VC90/game.vcproj

Auto-merging win/VC100/game.vcxproj.filters

Auto-merging win/VC100/game.vcxproj

Auto-merging src/shared/revision_nr.h

CONFLICT (content): Merge conflict in src/shared/revision_nr.h

Auto-merging src/game/World.cpp

Auto-merging src/game/Unit.h

CONFLICT (content): Merge conflict in src/game/Unit.h

Auto-merging src/game/Unit.cpp

CONFLICT (content): Merge conflict in src/game/Unit.cpp

Auto-merging src/game/SpellEffects.cpp

CONFLICT (content): Merge conflict in src/game/SpellEffects.cpp

Auto-merging src/game/SpellAuras.cpp

Auto-merging src/game/Player.h

Auto-merging src/game/Map.cpp

Auto-merging src/game/Level3.cpp

Auto-merging src/game/Level2.cpp

Auto-merging src/game/GridMap.cpp

Auto-merging src/game/CreatureAI.h

CONFLICT (content): Merge conflict in src/game/CreatureAI.h

Auto-merging src/game/Chat.h

Auto-merging src/game/Chat.cpp

Auto-merging contrib/extractor/ad.exe

CONFLICT (content): Merge conflict in contrib/extractor/ad.exe

Automatic merge failed; fix conflicts and then commit the result.

Just fix the conflicts and you should be ready to FINALLY compile a working server. You can use faramir's method for avoiding the ad.exe conflict. I've never run into that issue when working with MaNGOS main, so I haven't looked into other methods to avoid this since the mergetool does not handle binaries.

Link to comment
Share on other sites

Oh God, I was about to try that. I figured the "stable/master" was lagging behind and the development tree would be more modern. You just solved it. I will do a reset and setup the develop branch now. Thanks!

*UPDATE*

Thought I would share my reset script with you guys. Enjoy!

#!/bin/sh

clear

cd

rm -rf ~/wow-src

sleep 3

mkdir ~/wow-src

cd ~/wow-src

git init

git remote add -f -t develop origin git://github.com/mangos-zero/server.git

git remote add -f -t feature/movemaps mmaps git://github.com/mangos-zero/server.git

git remote add -f -t master working git://github.com/mangos-zero/server.git

git branch master --track origin/master

git branch mmaps --track mmaps/feature/movemaps

git branch working --track working/master

git checkout master

git checkout working

git merge master

git merge mmaps

cd ./src/bindings

mkdir ./ScriptDevZero

cd ./ScriptDevZero

git init

git remote add -f -t master sd0 git://github.com/mangos-zero/scriptdev0.git

git branch master --track sd0/master

git checkout master

cp ./MaNGOSZero-ScriptDevZero.patch ~/wow-src

cd ~/wow-src

git apply ./MaNGOSZero-ScriptDevZero.patch

cd

Link to comment
Share on other sites

Glad I could help. We're all in this together! ;)

Edited my above post with notes about similar changes to the ScriptDevZero repository and to correct myself on resolving the merge conflicts with ad.exe. My method didn't work as I anticipated. :/

With the Zero devs monkeying around with the repository structure, it's a good thing there's no such thing as a virtual angry mob bearing e-torches and digital pitchforks to storm their castle. :lol:

Link to comment
Share on other sites

Same problem. Still wants 1765. No merge errors or anything, just wants 1765...

*UPDATE*

Modified my script and am starting over... again. I took out the remote for the working branch and the patch code since I just add the line myself. I will update you when I get done again.

#!/bin/sh

clear

cd

rm -rf ~/wow-src ~/wow-server/bin ~/wow-server/include ~/wow-server/lib

sleep 3

mkdir ~/wow-src

cd ~/wow-src

git init

git remote add -f -t develop origin git://github.com/mangos-zero/server.git

git remote add -f -t feature/movemaps mmaps git://github.com/mangos-zero/server.git

git branch master --track origin/develop

git branch mmaps --track mmaps/feature/movemaps

git branch working

git checkout master

git checkout working

git merge master

git merge mmaps

cd ./src/bindings

mkdir ./ScriptDevZero

cd ./ScriptDevZero

git init

git remote add -f -t master sd0 git://github.com/mangos-zero/scriptdev0.git

git branch master --track sd0/master

git checkout master

cd

*UPDATE*

That worked. I got the merge errors you said I would get. Now, how do I fix said errors? I mean are these physical errors (such as null pointers) or what? What am I looking for in these files and once I fix the problems, how do I tell git that it can merge them?

*UPDATE*

Alright, I found the following in "CreatureAI.h". I assume that between "HEAD" and "=======" is the original code and between "=====" and "mmaps" is the proposed change. My big question is whether or not git commented out the lines and I need to uncomment them or what? Do I delete the old code and leave the new code as-is? I need more info to make an informed decision and git isn't helping.

<<<<<<< HEAD

/**

* Called at any heal cast/item used

* @param healer Unit* who healed the creature

*/

virtual void HealBy(Unit* healer, uint32 amount_healed) {}

=======

// Called at any heal cast/item used (call non implemented)

// virtual void HealBy(Unit * /*healer*/, uint32 /*amount_healed*/) {}

>>>>>>> mmaps

Link to comment
Share on other sites

You guessed correctly, <<<<<<< marks the start of the merge conflict, ======= separates the two conflicting pieces of code, and >>>>>>> marks the end of the conflict (this is the same way SVN and others mark conflicts)

Resolving merge conflicts in code you are unfamiliar with can be very challenging, but there are some useful tools that can help:

  • git blame
    annotates each line of a file with information that describes when that line was last edited
    alternatively, use git gui blame in a graphical environment
  • gitk (graphical environments only)
    gives easy access to history graph, commit diffs, staged changes, unstaged changes (including merge conflicts)
    experiment with right click in gitk - there are a lot of shortcuts to other useful features

Once you have resolved the merge conflicts, use git add to mark them resolved before git commit, which completes the merge (I also recommend compiling before you commit, because it is easy to miss/skip conflicts)

PS: for the conflict you posted, you want to keep the HEAD version (see 8ca6876fef015833fa50949adca0c442861f9501)

Link to comment
Share on other sites

Thanks faramir. Since this is a server, I only have a shell which is accessible only through SSH. I will check it out tonight, fix the issues, and build the new executeables. I will post back tonight if I run into anything else. Also, I will make a guide for this once I get it working properly.

By the way, what timezone are guys in?

*EDIT*

One more thing. How do I do this? Do i simply edit the files in vi, or do I do something with git?

Link to comment
Share on other sites

If you have a diff/merge utiility installed on your system, you can invoke it using git mergetool, and then resolve the conflicts as you normally would with the diff/merge.

Git should automatically detect any such utilities you have and present you with a choice of which you wish to use. Git is programmed to work out-of-the-box with these diff/merge utilities:

araxis, bc3, diffuse, ecmerge, emerge, gvimdiff, kdiff3, meld, opendiff, p4merge, tkdiff, tortoisemerge, vimdiff and xxdiff.

If you manually resolve the conflicts, notice something about the structure of the conflict shown:

<<<<<<< HEAD <--- These arrows denote the code from the branch into which

/** you're merging. Called "Mine" in some merge utilities

* Called at any heal cast/item used

* @param healer Unit* who healed the creature

*/

virtual void HealBy(Unit* healer, uint32 amount_healed) {}

======= <--- The double dashes separate between "Mine" and "Theirs"

// Called at any heal cast/item used (call non implemented)

// virtual void HealBy(Unit * /*healer*/, uint32 /*amount_healed*/) {}

>>>>>>> mmaps <---these arrows denote the code is from the branch which

you're merging into "Mine".

This is called "Theirs" in some merge utilities.

Most of the conflicts are simple white space differences. People have the bad habit of using spaces where they think looks the prettiest. You could use git merge -Xignore-space-change to tell Git to ignore white space differences and use the lines from "Mine" where the only changes are spaces.

The same printout above is also reflected in the specified files of the branch you're working on. If you then open CreatureAI.h in your favorite editor, you can jump to the lines marked with the arrows, manually fix the conflicts, save the file, and move on to the next file Git reports having conflicts.

After you're done, use git status to view a list of the files that have changed and need to be committed. You can commit them all in one go with git commit -a. Git will then ask you to type in a commit message, a short comment on why you made changes. You can leave it blank, unless you're committing the code to a repository on which other people are working. Otherwise, you'll become unpopular. lol

After jumping through all those hoops, you should be ready to compile MaNGOS-Zero, then ScriptDevZero. Hopefully, you'll be the proud owner of a 1.12 server with movemaps support.

Link to comment
Share on other sites

How do I know which revision to keep, head or mmaps? I am looking at "SpellEffects.cpp" right now and the head has nothing while mmaps has a small case section in a switch block. In this case I am assuming that it is OK to use the mmaps version since nothing is being changed, only code added, but I would like to be sure and I would like to know how to determine which revision to use.

*UPDATE*

The other differences were where a space was deleted in a function prototype and in the implementation. The final one was the revision. The mmaps version set it to 1765 and of course the zero version was at 1809. I kept 1809, committed, made sure sd0 was set to compile, and have just started my compilation. Now I must send the tools over to my Latitude laptop to build for Windows, then send those executeables to one of my lab PCs to pull out the stuff from WoW. Fun...

*UPDATE*

The server built and started with the mmaps, vmaps, etc I extracted and built when using the straight mmaps branch. Already tested with my hunter and the mobs do not act like they're high enough to float anymore, and they can now cross bridges. Thanks for all of the help!

Now, when an update for zero and/or mmaps comes out, how would I go about updating the sources and rebuilding?

Link to comment
Share on other sites

Unfortunately, the only way to be 100% sure which code sections to keep and which to use from "Theirs" is to familiarize yourself with the source codes for both the core and the patch you're merging.

...or you could do like most of us and use common sense with a healthy dose of educated guessing. It can help a great deal to do a diff between the patch branch and the master, then read through the code so you have some idea of the structure before merging.

A typical merge will consist of white space and actual code changes. White space is simple to deal with. You can just choose to keep the code sections from the core, or "Mine", without any impact to function. You'll run across this quite often because patch developers seem to have the bad habit of not actually reading the official MaNGOS coding standards, which describes use of things like spaces and indents.

Actual code changes vital to the correct functioning of the patch can usually be identified by the function names. For something like movemaps, the key word here is move. This means that lines dealing with things like movement, move, path, pathfind, coordinates, and other similar labels most likely should be used in place of any missing or differing lines in the core source.

When the time comes that you want to update your sources for compiling a newer server to take advantage of fixes and improvements, just use git checkout to switch to the branch you wish to update and then do git pull <remote name> to fetch and merge the latest source into your own. If you recall, your two branches have the remote labels, origin/develop, and, mmaps/feature/movemaps. So you'd do it like this:

git checkout master

git pull origin

git checkout mmaps

git pull mmaps

If you wish to, you can use git rebase on your working branch to sync it up with the master develop branch. Then all you have to do is merge the latest changes in mmaps with working to have an updated server source. What [em]rebase[/em] does is to fetch the latest commits from the repository you specify and apply them to your local branch while trying to keep any changes you have made, like merging in a patch.

Of course, the simple way is to just delete the working branch, using git branch -D <branchname>, create it again, then merge the master and mmaps code back in, like you have done before.

Now that you've gotten the basics of using Git to fetch the sources and merge patches, I highly recommend you take a look at the Git man pages and the wealth of information in our Source Code Management section. Aside from information and tutorials provided by our members, you'll also find links to other, free online tutorials and books. Git can seem complex at first, but it truly is the most flexible and powerful VCS utility I've ever had the pleasure to use, in spite of some quirks.

I'm very glad you finally have gotten things sorted out! :cool:

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use