Comments (8)
Need to let copied list elements behave as if BspLump classes are real lists
Changes can be made at any time to any touched return value
Slices should return copies
__setitem__(self, index, value)
should allow insertion when index
is a slice
Tracking insertions with minimal changes stored would be ideal (track insertions and offset indices for __getitem__
)
each BspLump type will need a test for this, do not have RespawnBsp bsp_lumps to test
Titanfall2 repo has r2 mp_lobby so use that
from bsp_tool.
Changes can be made at any time to any touched return value
This wouldn't work with bytes
objects, as they are immutable, but allowing changes to RawBspLump
would be nice
from bsp_tool.
should really address this before tackling #15 as making small edits & seeing their affects in-engine is very powerful for research
but when the bsp_tool implementation differs from user expectations you're gonna see a lot of bugs & wacky workarounds
gotta love writing my own kernel to handle big data
from bsp_tool.
gotta love writing my own kernel to handle big data
No, really, we need to do garbage collection of some kind here
Each reference to an object collected will need to feed back into the changes
attribute of the BspLump
it came from
bsp.VERTICES[0].z += 1 # doesn't work rn. but should
{print(v) for v in bsp.VERTICES[:64]} # makes a copy and deletes it within scope; no changes possible
Maybe we could override the __del__
method of each LumpClass
instance to remove itself from changes
if unchanged?
We would also need to accurately mimic how Python creates copies & deep-copies
Ideally we hook existing Python memory management systems to handle all of this for us.
Some people smarter than us may have already tackled this, idk.
Could be a bunch of talks on messing with memory management & working with large files, I haven't found them yet tho.
The odds someone smarter than me has already tried this are quite high.
Research time should be put into finding examples tackling this problem.
from bsp_tool.
BspLump
s could use a pretty serious refactor at this point tbh.
They're not the list
analogue I was hoping, & RawBspLump
needs to be more like bytearray
In #80 & #68 I've planned to use BspLump
to defer translating StaticPropClass
es
The best way to do this would be with an alternate __init__
(@classmethod
from_struct_and_count
)
Generic __init__
methods w/ alternate @classmethod
.from_
__init__
s are nice for testing anyway
Maybe we could even rethink inheritance & external lumps enough to simplify lumps/__init__.py
down to lumps.py
from bsp_tool.
Setting a read-only flag on BspLump
s could be useful (checked when getting & setting)
That way anything like extensions.diff
/ decompile
, which only care about parsing can have minimal memory impact
IMO the best way to set this would be as a kwarg when opening a .bsp
bsp_tool.load_bsp("filepath/maps/filename.bsp", read_only=True)
bsp_tool.ValveBsp(bsp_tool.branches.valve.source, "filepath/maps/filename.bsp", read_only=True)
The read_only
flag could lock updates to BspLump._changes
(though enforcing could be difficult)
Dealing with read_only
changing dynamically seems pretty complicated...
But still, I would like to avoid creating entries in _changes
when the user promises that they will only read
Otherwise, any loop called over a lump will load the entire lump into memory in it's bloated python object form
Whatever path we take, I want to give the user some control about how much RAM they use, and have good default behaviour.
from bsp_tool.
Rather than worrying about potential performance impacts, test & measure different implementations
Some manual garbage collection on cached changes could be nice, idk if automation is possible
from bsp_tool.
616f08d needs more tests
Don't 100% understand when _changes
caches the bulk of a lump when we don't want it to
In the case of [x for x in bsp.LUMP]
, mutating x
shouldn't update bsp.LUMP._changes
Also undecided as to whether or not slices are copies or not
Not to mention copy vs. deep copy
Behaviour should match:
RawBspLump
->bytearray
BasicBspLump
->List[int]
BspLump
->List[LumpClass]
from bsp_tool.
Related Issues (20)
- `RespawnBsp.save_as` dumps `.bsp_lump` copies in working directory HOT 1
- `RespawnBsp.save_as()` test cases HOT 1
- Quake II Rerelease increased lightmap resolution HOT 2
- Usage of ContentsMask in source.py HOT 3
- Need integer vectors to preserve accuracy
- (extensions.convert.respawn) r1 -> r2 for `.ain` generation HOT 2
- (MegaTest) download & catalogue dukeworld maps
- Standardising geometry extraction & processing HOT 9
- extensions should add new methods to branches HOT 2
- how use x360.py? HOT 9
- Consider `sprp` version part of "branch id"
- Split related files handler out of `BspClass._preload`
- cannot load CS:O2 `aim_dust.bsp` with `nexon.cso2_2018` HOT 1
- Catalogue Genesis3D Engine HOT 1
- Need a common Image LumpClass base type
- [Test Maps] `genesis3d`
- Configure `pytest` to remove naming convention HOT 2
- Create a `utils` submodule to pull tools out of `branches` HOT 1
- (extensions.editor) `.save_as(filename: str)` method for all `MapFile` classes
- (extensions.editor) MetaPattern string conversion is an ugly mess
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bsp_tool.