Return to “Dev Logs”

Post

Re: Monday, February 6, 2017

#31
Dinosawer wrote:Might or might not be useful, but there exists and implementation for shared memory dictionaries in LUA (which seems to support LuaJIT too):
https://github.com/openresty/lua-nginx- ... shareddict

Might wanna take a look in their source and see how they did it, and expand it for tables/whatever you need to share
Interesting, thanks for the link...if indeed it works well, that'd really be all I need (or at least a large step in the right direction). Everything's a table in LUA, and table / dictionary are synonymous so if it works I might be able to just drop it in and let the threading solution I've already got do the rest :)
afasthorse wrote:Here's a github repository containing what I believe is The One True LuaThread: https://github.com/jjensen/luaplus51-al ... /luathread

Unfortunately it's no longer maintained and this repo is just holding the source of the original project, but maybe it gives you something to work from.

Alternatively you could try contacting the author directly, pretty sure this is him: http://w3.impa.br/~diego/

Good luck.
Ah thank you thank you, it does look like the right LuaThread. And the source is small so even if it's not maintained, if it does what I need I should be able to learn pretty quickly how it does it.
Flatfingers wrote:Thank you for keeping us (so to speak) in the loop, Josh.
If that was the intentional pun I think it was, nicely-played sir :lol:
Freezin4aReason wrote:Turns out you aren't the only one to build a Threadpool: :ghost: :ghost: :ghost:
Very cute :lol: Good movie too :D
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Monday, February 6, 2017

#32
Hey Josh,

Can the LT universe be simulated?. ((Without graphics or time constraints (ship A takes 10 minutes to mine and 10 minutes to transport goods to station B...ETC.....) ) How fast can you sim all the NPC activities? Say: 24 hours of NPC mining/fighting/trading compressed into _ seconds? ?

You could have 2 programs. One running LT gameplay(LTGP) and one simulating(LTSIM) the thousands/millions/billions of NPC star systems.

When I re-visit a system...LTSIM has kept it updated...(The prices have changed...my empire has crumbled..ETC.......)

Just like a baseball sim can generate a seasons worth of stats in seconds/minutes...LTSIM could do the same. See what happens to your empire in a million years! :D

I'm sure this has been thought of before...but I'd like to rekindle it. :)
Post

Re: Monday, February 6, 2017

#33
Yes, I'm thinking in similar lines. Wouldn't it help performance significantly to thread all none time critical simulations and most AI?

In a universe such as LTs 99.9% of the game simulations should happen outside of the actual system the player is in and as such does not require frame by frame runtime updates, but can probably be updated once a second or even less frequent then that if further away.


I think there might be a way to do this without actually sharing memory, by just updating it infrequently with "simulation job results".

What if each level of simulation precision (as you move further away from active starsystem) is assigned it's own thread? This should also mean that only the neighboring levels of precision (for example all adjacent starsystem simulations) needs to communicate with the active runtime (active system) thread, and that communication overhead is minimized since each thread only needs to communicate directly with the "adjacent" 1-2 threads.


It should then be possible to let the main runtime thread have a "master copy" of the entire gamestate in it's memory, and have the other threads do performance heavy simulations to update "their parts" of the geographical responsibility area or layer, but do this update increasingly infrequently.

If you have for example 4 threads the outermost layer/thread "4" needs to keep only it's own area state in it's own memory, which is updated back layer 3 to very infrequently (due to long distance from player), say each 30 seconds. Layer/thread 3 then keeps layer 3+4 in memory and sends updates every 10 seconds in the direction of the player. Layer/thread 2 which are handling simulation in systems adjacent to the player system then keeps state of layer 2+3+4 in it's memory and updates the main thread and memory every second.

This way the player has information available from the entire LT universe, but the age of the information differs by distance (runtime for same system, up to 1 second for adjacent, 10 sec for far away systems and 30 sec for the rest of the universe ).


Just some rambling thoughts from someone who is by no means a skilled programmer, but got some experience elsewhere in IT.
Post

Re: Monday, February 6, 2017

#34
RedDwarfMining wrote:Hey Josh,

Can the LT universe be simulated?. ((Without graphics or time constraints (ship A takes 10 minutes to mine and 10 minutes to transport goods to station B...ETC.....) ) How fast can you sim all the NPC activities? Say: 24 hours of NPC mining/fighting/trading compressed into _ seconds? ?

You could have 2 programs. One running LT gameplay(LTGP) and one simulating(LTSIM) the thousands/millions/billions of NPC star systems.

When I re-visit a system...LTSIM has kept it updated...(The prices have changed...my empire has crumbled..ETC.......)

Just like a baseball sim can generate a seasons worth of stats in seconds/minutes...LTSIM could do the same. See what happens to your empire in a million years! :D

I'm sure this has been thought of before...but I'd like to rekindle it. :)
*Cough*

:wave:
- The Snark Knight

"Look upward, and share the wonders I've seen."
Post

Re: Monday, February 6, 2017

#39
Talvieno wrote:I don't see why not. If one program (LT) can read/write the data, another program could certainly be written to read/write it as well.
Cool. I hope..... Dominating a galaxy takes time :twisted: .......playing 2 hours a night is probably not gonna' do it! :lol:

I'd like to sim it out a billion years and see how my faction did... "You own 33 trillion ships. 76 billion systems under your control...You own 345 trillion billion goats that have devastaed half the galaxy..." :D

Online Now

Users browsing this forum: No registered users and 1 guest