loblao / libotp-nametags Goto Github PK
View Code? Open in Web Editor NEWReverse-engineered libotp nametags
License: MIT License
Reverse-engineered libotp nametags
License: MIT License
In certain scenarios, multiple nametags may be created for one object in game. Currently, these nametags are able to all show at the same time. However, this does not work in scenarios where there is intended to be one nametag showing for a building such as Toon HQ.
Here is how this looks currently:
In Toontown Online, Toon HQ only occupied a single margin cell and the nametag popup switched between the doors as you got closer to one door or the other:
It appears this behavior has been overlooked while writing margins. This behavior seems to depend on the object code of the nametags. For example, for the doors (Toon HQ has two doors):
self.nametag.setObjectCode(self.block)
I know this might be a Panda3D-related crash but i have tried everything...
File "libotp\ChatBalloon.py", line 61, in scan_balloon
self.m_copy_node = node.copySubgraph()
AttributeError: 'panda3d.core.NodePath' object has no attribute 'copySubgraph'
Press any key to continue . . .
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000000000006c
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [25180]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libpanda.1.11.dylib 0x0000000108941ed1 Nametag::update_region(int) + 17
1 libpanda.1.11.dylib 0x0000000108947c5f NametagGroup::update_regions() + 111
2 libpanda.1.11.dylib 0x000000010893e539 MarginManager::cull_callback(CullTraverser*, CullTraverserData&) + 57
3 libpanda.1.11.dylib 0x00000001085a7326 CullTraverser::do_traverse(CullTraverserData&) + 502
4 libpanda.1.11.dylib 0x00000001085a77d1 CullTraverser::traverse_below(CullTraverserData&) + 1153
5 libpanda.1.11.dylib 0x0000000108b37a53 PGTop::cull_callback(CullTraverser*, CullTraverserData&) + 531
6 libpanda.1.11.dylib 0x00000001085a7326 CullTraverser::do_traverse(CullTraverserData&) + 502
7 libpanda.1.11.dylib 0x00000001085a77d1 CullTraverser::traverse_below(CullTraverserData&) + 1153
8 libpanda.1.11.dylib 0x00000001085a7336 CullTraverser::do_traverse(CullTraverserData&) + 518
9 libpanda.1.11.dylib 0x00000001085a6b1c CullTraverser::traverse(NodePath const&) + 268
10 libpanda.1.11.dylib 0x00000001087c4a0e GraphicsEngine::do_cull(CullHandler*, SceneSetup*, GraphicsStateGuardian*, Thread*) + 158
11 libpanda.1.11.dylib 0x00000001087d6341 GraphicsEngine::cull_to_bins(GraphicsOutput*, GraphicsStateGuardian*, DisplayRegion*, SceneSetup*, CullResult*, Thread*) + 305
12 libpanda.1.11.dylib 0x00000001087d59dd GraphicsEngine::cull_to_bins(ov_set<PointerTo<GraphicsOutput>, IndirectLess<GraphicsOutput>, pvector<PointerTo<GraphicsOutput> > >, Thread*) + 2141
13 libpanda.1.11.dylib 0x00000001087d0b85 GraphicsEngine::WindowRenderer::do_frame(GraphicsEngine*, Thread*) + 485
14 libpanda.1.11.dylib 0x00000001087cf18e GraphicsEngine::render_frame() + 2190
15 core.cpython-37m-darwin.so 0x00000001079bcdd4 Dtool_GraphicsEngine_render_frame_517(_object*, _object*) + 52
16 org.python.python 0x000000010716950b _PyMethodDef_RawFastCallKeywords + 583
17 org.python.python 0x000000010716dcdd _PyMethodDescr_FastCallKeywords + 81
18 org.python.python 0x00000001071fd402 call_function + 782
19 org.python.python 0x00000001071f632a _PyEval_EvalFrameDefault + 6742
20 org.python.python 0x000000010717445f gen_send_ex + 244
21 org.python.python 0x0000000107169118 _PyMethodDef_RawFastCallDict + 595
22 org.python.python 0x00000001071686fb _PyCFunction_FastCallDict + 41
23 org.python.python 0x000000010716a1ba object_vacall + 267
24 org.python.python 0x000000010716a379 PyObject_CallFunctionObjArgs + 128
25 core.cpython-37m-darwin.so 0x0000000107d26589 PythonTask::do_python_task() + 921
26 libpanda.1.11.dylib 0x0000000108814676 AsyncTask::unlock_and_do_task() + 342
27 libpanda.1.11.dylib 0x00000001088190fb AsyncTaskChain::service_one_task(AsyncTaskChain::AsyncTaskChainThread*) + 507
28 libpanda.1.11.dylib 0x0000000108817ebe AsyncTaskChain::do_poll() + 414
29 libpanda.1.11.dylib 0x000000010882055c AsyncTaskManager::poll() + 76
30 core.cpython-37m-darwin.so 0x00000001079ef6d4 Dtool_AsyncTaskManager_poll_138(_object*, _object*) + 52
31 org.python.python 0x000000010716950b _PyMethodDef_RawFastCallKeywords + 583
32 org.python.python 0x000000010716dcdd _PyMethodDescr_FastCallKeywords + 81
33 org.python.python 0x00000001071fd402 call_function + 782
34 org.python.python 0x00000001071f632a _PyEval_EvalFrameDefault + 6742
35 org.python.python 0x0000000107168e0c function_code_fastcall + 106
36 org.python.python 0x00000001071fd3d5 call_function + 737
37 org.python.python 0x00000001071f632a _PyEval_EvalFrameDefault + 6742
38 org.python.python 0x00000001071fdbc9 _PyEval_EvalCodeWithName + 1698
39 org.python.python 0x0000000107168a00 _PyFunction_FastCallKeywords + 212
40 org.python.python 0x00000001071fd3d5 call_function + 737
41 org.python.python 0x00000001071f632a _PyEval_EvalFrameDefault + 6742
42 org.python.python 0x0000000107168e0c function_code_fastcall + 106
43 org.python.python 0x00000001071fd3d5 call_function + 737
44 org.python.python 0x00000001071f632a _PyEval_EvalFrameDefault + 6742
45 org.python.python 0x00000001071fdbc9 _PyEval_EvalCodeWithName + 1698
46 org.python.python 0x00000001071f4831 PyEval_EvalCode + 51
47 org.python.python 0x00000001071f22bb builtin_exec + 563
48 org.python.python 0x00000001071694ac _PyMethodDef_RawFastCallKeywords + 488
49 org.python.python 0x0000000107168a38 _PyCFunction_FastCallKeywords + 41
50 org.python.python 0x00000001071fd368 call_function + 628
51 org.python.python 0x00000001071f63de _PyEval_EvalFrameDefault + 6922
52 org.python.python 0x00000001071fdbc9 _PyEval_EvalCodeWithName + 1698
53 org.python.python 0x0000000107168a00 _PyFunction_FastCallKeywords + 212
54 org.python.python 0x00000001071fd3d5 call_function + 737
55 org.python.python 0x00000001071f63de _PyEval_EvalFrameDefault + 6922
56 org.python.python 0x00000001071fdbc9 _PyEval_EvalCodeWithName + 1698
57 org.python.python 0x0000000107168678 _PyFunction_FastCallDict + 444
58 org.python.python 0x000000010723a578 pymain_run_module + 147
59 org.python.python 0x00000001072395e4 pymain_main + 4091
60 org.python.python 0x000000010723a19c _Py_UnixMain + 56
61 libdyld.dylib 0x00007fff641483d5 start + 1
Per a cProfile taken on a TLOPO client, I have discovered that libotp is significantly impacting frame-rates. Disabling the cull callback code results in an immediate 20-30FPS improvement.
70379804 function calls (70361083 primitive calls) in 217.404 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
614319 2.773 0.000 37.996 0.000 /libotp/Nametag3d.py:41(cullCallback)
614012 19.277 0.000 31.569 0.000 /libotp/Nametag3d.py:195(adjustToCamera)
10984 0.021 0.000 16.343 0.001 /libotp/MarginManager.py:92(cullCallback)
10984 2.672 0.000 16.322 0.001 /libotp/MarginManager.py:190(update)
libotp contains multiple mathematically intensive tasks which run every frame, and Python is not great at these kind of operations - especially when they need to run every frame. Disney had originally written this system in C++, I suspect this was the reasoning behind that decision.
@loblao and I have been working on this for the past week. We will be committing our progress soon.
I'm genuinely impressed by the reverse engineering done here. I thought i was the only person reverse engineering libotp but i'm glad to see this wasn't the case. You did a good job and i'd say keep up the good work.
The headers are missing definitions for three structures. The three structures are vtable_generic_typed, vtable_generic_refcount, and __string.
Removed due to profanity.
Removed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.