pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.63k stars 377 forks source link

Cargo pods spam RAM #4119

Open macksting opened 7 years ago

macksting commented 7 years ago

Observed behaviour

For dubious definitions of "observed." I cheated up a bunch of funds from a Sol start, bought a Deep Space Miner (after a lot of hunting for one), a multi-scoop, a shield generator, and a blast-mining pulse cannon. I positioned myself Gliese 172 c 1, an asteroid. When I say "near," I mean 66 meters, held in place with the benefits of the f5 key (maintain speed of 0 m/s.) I began firing my cannon, creating a massive debris cloud one tiny "badoom" at a time. I adjusted my position a few times, but eventually I was pretty happy with the ratio of cargo hitting my ship and the ratio flying out into nowhere. (It was a pretty bad ratio, but I was in a dsminer, I wasn't chasing them down.) Then I held down my spacebar with a safety pin and went to lay down in the bedroom. My son burst in to tell me the game crashed!

SY-3271 enters frame Gliese 172 c 1
CreateCollisionMesh for : (cargo)
*** stack smashing detected ***: src/./pioneer terminated
Aborted (core dumped)

Expected behaviour

Infinitely large slowly expanding cloud of rubbish, precious metals, metal ore, water, and other debris receding into the distance until you get bored enough to leave the system.

Steps to reproduce

Cheat for funds, mostly all 9s. Get a dsminer, shield generator, autopilot, four space crew members, laser cooling booster, trade computer, multi-scoop, and bespoke engines. Fly to 66 m from Gliese 172 c 1, an asteroid in orbit around Gliese 172 c Hold down the fire button with a safety pin. Occasionally jettison huge piles of rubbish and/or adjust position to catch a different ratio of cargo. Leave the room and stop paying attention. Should yield a core dump eventually.

My pioneer version (and OS): git (941c68b) on lubuntu 16.04

impaktor commented 7 years ago

Well, cargo self destruct after 24 h in space, so if you generate them faster than your RAM can handle...

I'm guessing @fluffyfreak is the best to answer how to graciously handle when hardware runs out of specs, if at all.

Also, just the other day:

<nozmajner> and I suspect the cargo container doesn't have LODs
<nozmajner> yup, no LoD for it. I might want to do one, there's room for it
fluffyfreak commented 7 years ago

Some thoughts: 1: I've always liked how our mining lasers can spawn cargo pods rather then just chunk of rock... 2: why would they last 24 hours and not 5 mins? 3: oh my god why is it calling CreateCollisionMesh after spawning each one!?! 4: I dread to imagine how may cargo pods you had flying around... many I'd imagine!

impaktor commented 7 years ago
  1. Implemented in #3168, which removed infinite cargo life. Default is 24h, to allow player to pick up stuff he accedentally dropped, or see his jettisoned cargo bounce against planet surface, or whatever. Even with 5 minute self destruct, I wonder if it really fixes the "problem" of a computer not being able to have infinite RAM.
macksting commented 7 years ago

Is there a log I could post that'd indicate what was going on at the time?

impaktor commented 7 years ago

Is there a log I could post that'd indicate what was going on at the time?

Yes, please see FAQ on wiki.

However, I'm not sure it would add anything, as we know what the problem is. Infinite objects can not fit into finite hardware.

macksting commented 7 years ago

Fair enough. I'll just add the git build up top, then. I couldn't find an output.txt anyway; need to change a config setting for next time.

jaj22 commented 7 years ago

3: oh my god why is it calling CreateCollisionMesh after spawning each one!?!

Ancient misfeature. Collision mesh BVH trees are generated per ModelBody instance, not per model. IIRC generating these is the vast majority of the Earth start time. Not sure if you'd rather put these in a separate cache or in the scenegraph code.

A 5 minute lifespan seems too short for many purposes, notably post-battle scavenging, although I don't think we have the tools for that yet. Ideally there's something like a per-system cargo body limit, with the older objects being purged beyond that limit.

ecraven commented 7 years ago

A 5 minute lifespan seems too short for many purposes, notably post-battle scavenging, although I don't think we have the tools for that yet. Ideally there's something like a per-system cargo body limit, with the older objects being purged beyond that limit.

I'd agree with that, we should just keep them all, and only throw them away on-demand, when resources get tight.

fluffyfreak commented 7 years ago

I dug into it a little bit...

joonicks commented 3 years ago

make it possible to set lifetime of a cargo pod differently depending on what created it.

laser blast vs roids = 600s or so