• Content count

  • Joined

  • Last visited

  • Days Won


Gefferz last won the day on April 19

Gefferz had the most liked content!

Community Reputation

16 Neutral

About Gefferz

  • Rank
  1. Thanks for the positive comments. Of course I will share in due course. Hit a bit of a problem in the last week with palettes. It all started when I realised I had no Tumeroks, the capture had rejected them. Looking into it, I found the 3d model for Tumeroks must have changed from the old days. The new model number wasn't in the original portal.dat This led me to ascertain which models were not being used, and by forcing them onto creatures with a similar build, searched for the Tumeroks, and other extinct creatures. Many seemed to be variations on zombies and skeletons, and I found the Tumerok model. Then when I started looking closely at the values for the palettes, to see why the Tumerok types all looked the same, I realised that the new capture data referenced palettes that didn't exist in the old portal.dat file. I then took a step backwards, and looked closely at the capture data for palettes and realised that the original UAS2 and its companion capturing program were in error, but that a workaround somehow made it work. The original capture program did a weird thing when it loaded up the palettes, and made a field called Unknown-1 which it stored and presented when it was time to show that creature (or item). Each palette where it exists consists of a palette file number (in the portal file) and an offset and length, which overlay into the working palette. The values captured looked weird... I realised that the offset, length pairs were in fact actually palette file numbers misplaced in the data, so 6D for length of F was really palette file F6D. Because of the botched way UAS2 used the palette values, these somehow still came out correctly in most cases. In fact there is no need for an "unknown1" field. If a palette is present, it has a count of at least 1. What follows the counts of palette, texture and model is something that looks like a base palette, or a palette for part of the 3d model. This does not have an offset and length value, but is immediately followed by sets of palette overlays that do. These are often a value, and offset and length of 0. The length of 0 means 256. I played around for ages with a drudge ravener's palette. It seems some of the palette values come from that first palette, so it's not entirely that the subsequent palette(s) just overlay. So I have gone back to the original data, and applied various fixes to the data. We now have at least a correct set of data, and unknown-1 is replaced with BasePalette. I am now writing similar code for items. Of course I had to go through and put the base palette code into every class that presented palettes rather than the unknown_1 field. The big digression was trying to match the TOD palettes to the old palettes. This was like the old days for me, doing colour matching algorithms. And I think the results are pretty good.... but haven't helped me get Tumeroks looking correct! It seems that the old Tumerok model does not use the palette at all. The only thing I can do is make them slightly bigger or smaller! So onwards.. and then I need to get back to what I was doing last week.
  2. Here's a video of where I'm at today. A few problems note the empty slot - some kind of duff item is in the database, or something I've overlooked. Sorry low quality video, capturing video is not working properly with 3D mode on. Nice to see doors working, isn't it? Little things like that are pleasing.
  3. Now adding monsters into my data capture program. It's hugely faster than the old buggy capture program. Runs against the large capture files that were previously taking hours, and takes a few minutes to do a whole folderfull. But it's only doing items or monsters... so that's partly why. Found it was adding NPCs, but can be eliminated by ignoring records with dwUnknown_V2 = 32. Was pleased to see my first Tusker Guard, and mite scion. Fixed nasty bug in generating bogus corpse item that show up with a black square. It needs to animate bending over when looting, and it's also not updating weight. I added healing kits as a treasure item. Something horrendous is wrong with level gaining. It tells me that I need 4 billion experience to get to the next level, at level 12, I guess it's calculating -1 or something as a DWORD, but I've not even looked at that code yet. I need to find a way to share the Exe and database. But I don't want a cease and desist order on me from WB!
  4. Looking at the monsters tables today. Monsters_type defines critters that can be spawned. It had the wrong linker value, was the ID of monsters_templates records, not dwLinker. Knocked up some quick C++ to fix, and zeroed records that weren't there. Now there are 100's of creatures that can be spawned, hurray.
  5. This week I was very happy to find and fix a horrible bug in UAS2. In case anyone doing the modern emulators needs to know what it is, I will describe. Some armor was coming up as corrupted, it basically made the entire avatar black. I traced through a routine that loaded data from portal.dat, "LoadItem". This routine assumed that each palette entry occurred only once. When it poked in the palette code, using the colour set, it used the index of the set of colours (xIndex) which was 0, then 1 for the first four palette values (offset and lengths) and the last three palette values. This meant it poked in colour codes for indexes 0 and 1 only, and left the remaining 5 zero. The one that was poked into index 1 is meant for palettes at index 4, 5 and 6. The index needs to be saved and the palette codes stored in a little loop so that the new index keeps match with the one that is used in storing the offsets and lengths. There's also another bug, more an oversight, in the coverage code. This meant, when I eventually worked it out, that the order of items in the inventory, that is the order in the items-Instance-Inventory, changed how clothes and armour overlaid each other. After mucking around with all sorts of ideas, I realised that the trick is to sort the inventory first, in a temporary array of objects, in order of coverage. A second problem with this code is that then the palettes are not right. A higher coverage item might have an overlapping palette range, because say the palette codes for arms are included in the palette codes for coats. The correct way is a bit fiddly. (I have code if anyone needs). You need to make an array of 100 entries, one for each palette slot. This is populated as each item's palette offset and length is dealt with. As the items are now sorted in coverage order, the later items will overlay the palette slots as needed. When all items equipped are done, the array is read through to determine a master palette list, that is of offset and length values, where the array is not zero. Armour and underwear now correctly appear, irregardless of inventory order. The method faster because it no longer does a zillion matches against each inventory item to work out coverage. Oh and you can spawn items with colour. Colour is only partially implemented, but I can do SpawnItem NN,Colour. My item grabber code makes a list of what colours are possible (I made a table of each item code, against each colour, and icon). This is complicated! Generating an item of a particular colour, if that colour exists, makes it change the icon for that item. I had to make the colour get stored against the inventory. A load more stuff needs to be stored too per item. It should also have a shading value, which is a number between 0 and 1. This works like this - when an item's palette is loaded, it finds a palette file. This palette file can contain many palettes for that given colour, say if it's 20, the shading value is timed by that count, so a shade of .25 would make it pick colour index 5. I had some fun putting weight into the game. UAS already had burden in per object. Sometimes it was called weight. It just meant keeping track of the weight of items picked up and dropped and feeding out the right message. Making shields and weapons stay wielded when logging out and in was a major headache. I fairly easily had it restoring that state, but they would not show up in the slots. I created a wielded flag per item... I made a lot of changes to get this to work and I still have to do the same for bows and wands. I created a primitive loot system. Now you can kill monsters and their corpses include random loot. I revised this a bit, especially as the very first set of loot included a focussing stone - and made it give more emphasis to junk rather than top notch armour. At this stage, armour and other things are still not randomised - they are just direct copies of the templates. It amused me to make it drop random pyreals, although there's a 100 things wrong with how those are handled (stacking etc). And gems aren't working for me, they don't appear at all. So now you can hunt, find weapons and armour and equip those items, and they all appear and work, sort of. Except all melee attacks are currently reported as bludgeoning! Doing all this made me realise I've a lot wrong with the items as they've been acquired and due to a fault in my own capture program, I'm missing many types of things, jewellery for instance. On the other hand I've changed the items grabbing code to check for duplicates properly.. so I've not filled the database with duplicate stuff - but more work to do there, and that's what I'm doing next. Then it's back to the monsters to work out why only some of them work.
  6. Well, I know people are working on other things. But UAS is a bit more like my dinosaur-way of programming than this modern .NET/C# stuff people are heading towards. I've been trying to get some understanding of how things hang together, and it's a lot of fun, especially as I can now melee fight things. So I thought I would create one thread with changes and observations about UAS2 and the capture program, and perhaps these might be useful if anyone's still playing with it. I don't feel I've made enough progress to upload a whole new version. Firstly, the capture program has a number of bugs, at least the one I had. It has "vetors" instead of "vectors", and its bad way of building an insert line means that it often creates dud lines. Actually there's a dozen or more other problems with it, with the fields it captures But I've put this to one side. For one thing, it's generating too many records, and this slows down the server launch time. I've had to create a few scripts like ones to remove duplicates. I also created a file splitter on pcap files. The capture program already can deal with a whole folder, so this means instead of reading one file, and often skipping through and missing half the stuff, it deals with the individual thousands of packets, and this generates more data. One problem and this is me understanding things wrong is that you cannot run the capture program without then applying the SQL straight away. If you run two captures, the second one will have duplicate Linker numbers, which will screw up the database. One problem which was annoying me was that the inventory wasn't being saved. Yet there's code there to do it... it turns out the inventory is being saved, but not loaded back. Actually to be precise it's more the announcement back to the client of the inventory, it happens as far as I can see too early. I added a function to delete the inventory (an internal store of objects), and a delayed second calling of create inventory in WorldServer: thus# int DelayedInventory = 0; (at top) [Before switch ( m_bWorldState )] if (DelayedInventory > 0) { DelayedInventory--; if (DelayedInventory <= 0) { // erase the last botched attempt.... m_pcAvatar->DeleteInventory(); cMasterServer::CreateInventory( this ); //Send create packets for inventory contents } } switch ( m_bWorldState ) { case 0: //First login ------------------ and this is set up here if ( pcRecvPacket->GetFlags( ) == 0x400 ) //400 message acknowledged { m_bWorldState = 4; DelayedInventory = 3; cMasterServer::CreateInventory( this ); //Send create packets for inventory contents cMasterServer::SendLoginData( this ); //Send login data (uses CreateInventory information) ---------------- and in avatar void cAvatar::DeleteInventory() { while ( !m_lstInventory.empty( ) ) { SAFEDELETE( m_lstInventory.front( ) ) m_lstInventory.pop_front( ); } return; } defined in avatar.h function prototype void DeleteInventory(); ------------------------- In TreasureGen.cpp there's a line needed for each CreateXXXXX( function) at the end something like cDatabase::AddToInventoryDB(who->m_pcAvatar->GetGUID(), aWand); or whatever the aXXXX is I made spawnitem take a name as a parameter, which makes it easier to spawn things I added a random distance to monster spawning. This was necessary as monsters attack now! MonsterServer needs quite a bit of work, but now a creature sees nearby enemies and goes for them. It also returns to base after. It's more or less right. Combat animation for melee wasn't working at all, and it was driving me nuts. In the end I went back to the earlier UAS1 and found it did work there, so I stole the "combat animation" code, and somehow that worked! But it's hardcoded for one attack. It needs to do low/medium/high. It's possible I mucked this up myself earlier. But I mention this in passing. Here's a question someone might know. I found a good many of the animations (by modifying !animation to default to the last number++ and working through) - the attack ones are 98-106 - but I didn't find ALL of them. In particular I can't find a stabbing animation, just more of a sweeping one. I'll make a list some time. For instance 106 is low kick. And another question: where are the female sounds? Ugh's and Arghs, etc? Looking at the way certain things are loaded - like monster spawns, NPCs, and permanent objects - I think it would be better to either load things up in a non-database way. Or a second program might do the load, and can just sit there in the background, and use shared-memory to supply whatever is needed. Oh and various hard-coded Maximum are too low once you start loading in captured objects. One big problem I can't get to the bottom of is a CLIENT crash that occurs once in a while. When it happens, the client restarted won't then connect to the server, so it's something the server has done to cause the client to crash. I might have to put some kind of a debug in that I can trap on demand in some way. The XP level code caused me to suddenly go from level 1 to level 126! I can't make sense of this line, so I fed in the XP table into a bit of code, it needs to be written properly, but it works now. Here's the line that was there - how was that ever supposed to work? 6 Xor 5? What's that all about? int level = floor( ( pow( (double)(9 * m_dwTotalXP + 6^5),(double)(1 / 5.0) ) - 6) + 1 ); That's all for now. Will post again.
  7. I found the pcap capture tool was missing quite a lot of data, the bogus stuff was making it skip past great lumps of data. It was also crashing a lot with array bounds errors. I can't wrap my brain around the C# code in order to fix this sensibly. So instead I knocked up a tool to split up any cap file into one file per AC packet. Then you can feed a whole directory of these captures (numbered sequentially), and boom this processes every one of them. I had to knock the exception message box on the head right at the end of the code. This is now making large amounts of SQL against the various captures people have kindly made available. There are errors in this SQL.. which I guess needs sorting too. But anyone, here's the tool for anyone who needs it. It's fast, but it might appear to lock up because it's doing so many files. Use a simple output folder for ease of use, like c:\1 It might make it easier for people to look for particular packets. I knocked it up in an hour and a half so don't expect too much! It's old school, so it's fast and small.