Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 5 6 [7] 8 9

Author Topic: Dwarf fortress multiplayer  (Read 61850 times)

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #90 on: October 03, 2017, 04:14:14 pm »

hmm wonder if it possible to code to set sparring to increase tiredness on hit than from sparring someone.
so you could set up fights where 2 players can duke it out without killing each other and run an arena where it's first to be knock out loses.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #91 on: October 04, 2017, 02:16:41 pm »

hmm wonder if it possible to code to set sparring to increase tiredness on hit than from sparring someone.

yes, definitely

Code: (modtools/putnam_events.lua) [Select]
-- A few events for modding.

--[[
    The eventTypes table describes what event types there are. Activation is done like so:
    enableEvent(eventTypes.ON_RELATIONSHIP_UPDATE,1)
]]

onUnitAction=onUnitAction or dfhack.event.new()

local actions_already_checked=actions_already_checked or {}

things_to_do_every_action=things_to_do_every_action or {}

actions_to_be_ignored_forever=actions_to_be_ignored_forever or {}

local function checkForActions()
    for _,something_to_do_to_every_action in pairs(things_to_do_every_action) do
        something_to_do_to_every_action[5]=something_to_do_to_every_action[5]+1 or 0
    end
    for k,unit in ipairs(df.global.world.units.active) do
        local unit_id=unit.id
        actions_already_checked[unit_id]=actions_already_checked[unit_id] or {}
        local unit_action_checked=actions_already_checked[unit_id]
        for _,action in ipairs(unit.actions) do
            local action_id=action.id
            if action.type~=-1 then
                for kk,something_to_do_to_every_action in pairs(things_to_do_every_action) do
                    if something_to_do_to_every_action[1] then
                        if something_to_do_to_every_action[5]>1 or (unit_id==something_to_do_to_every_action[3] and action_id==something_to_do_to_every_action[4]) then
                            things_to_do_every_action[kk]=nil
                        else
                            something_to_do_to_every_action[1](unit_id,action,table.unpack(something_to_do_to_every_action[2]))
                        end
                    end
                end
                if not unit_action_checked[action_id] then
                    onUnitAction(unit_id,action)
                    unit_action_checked[action_id]=true
                end
            end
        end
    end
end

function doSomethingToEveryActionNextTick(unit_id,action_id,func,func_args) --func is thing to do, unit_id and action_id represent the action that gave the "order"
    actions_to_be_ignored_forever[unit_id]=actions_to_be_ignored_forever[unit_id] or {}
    if not actions_to_be_ignored_forever[unit_id][action_id] then
        table.insert(things_to_do_every_action,{func,func_args,unit_id,action_id,0})
    end
    actions_to_be_ignored_forever[unit_id][action_id]=true
end


onRelationshipUpdate=onRelationshipUpdate or dfhack.event.new()

current_relations_checked=current_relations_checked or {}

local function checkRelationshipUpdates()
    for k,v in ipairs(df.global.world.units.active) do
        local histfig=df.historical_figure.find(v.hist_figure_id)
        if not histfig or not histfig.info or not histfig.info.relationships then return end
        current_relations_checked[v.hist_figure_id]=current_relations_checked[v.hist_figure_id] or {}
        for kk,relationship in ipairs(histfig.info.relationships.list) do
            current_relations_checked[v.hist_figure_id][relationship.histfig_id]=current_relations_checked[v.hist_figure_id][relationship.histfig_id] or {}
            local thisHistFigRelations=current_relations_checked[v.hist_figure_id][relationship.histfig_id]
            for relation_type_index,relation_type in ipairs(relationship.anon_3) do
                thisHistFigRelations[relation_type]=thisHistFigRelations[relation_type] or relationship.anon_4[relation_type_index]
                if thisHistFigRelations[relation_type]~=relationship.anon_4[relation_type_index] then
                    onRelationshipUpdate(v.hist_figure_id,relationship.histfig_id,relation_type,thisHistFigRelations[relation_type],relationship.anon_4[relation_type_index])
                    --onRelationshipUpdate.example=function(histfig1_id,histfig2_id,relationship_type,old_value,new_value)
                    thisHistFigRelations[relation_type]=relationship.anon_4[relation_type_index]
                end
            end
        end
    end
end

local df_date={}

df_date.__eq=function(date1,date2)
    return date1.year==date2.year and date1.year_tick==date2.year_tick
end

df_date.__lt=function(date1,date2)
    if date1.year<date2.year then return true end
    if date1.year>date2.year then return false end
    if date1.year==date2.year then
        return date1.year_tick<date2.year_tick
    end
end

df_date.__le=function(date1,date2)
    if date1.year<date2.year then return true end
    if date1.year>date2.year then return false end
    if date1.year==date2.year then
        return date1.year_tick<=date2.year_tick
    end
end

onEmotion=onEmotion or dfhack.event.new()

last_check_time=last_check_time or {year=df.global.cur_year,year_tick=df.global.cur_year_tick}

setmetatable(last_check_time,df_date)

local function checkEmotions()
    for k,unit in ipairs(df.global.world.units.active) do
        if unit.status.current_soul then
            for _,emotion in ipairs(unit.status.current_soul.personality.emotions) do
                local emotion_date={year=emotion.year,year_tick=emotion.year_tick}
                setmetatable(emotion_date,df_date)
                if emotion_date>=last_check_time then
                    onEmotion(unit,emotion)
                end
            end
        end
    end
    last_check_time.year=df.global.cur_year
    last_check_time.year_tick=df.global.cur_year_tick
end

eventTypes={
    ON_RELATIONSHIP_UPDATE={name='relationCheck',func=checkRelationshipUpdates},
    ON_ACTION={name='onAction',func=checkForActions},
    ON_EMOTION={name='onEmotion',func=checkEmotions}
}

function enableEvent(event,ticks)
    ticks=ticks or 1
    require('repeat-util').scheduleUnlessAlreadyScheduled(event.name,ticks,'ticks',event.func)
end

function disableEvent(event)
    require('repeat-util').cancel(event.name)
end

knock yourself out or, uh, something

Cathar

  • Bay Watcher
  • Competent Engraver
    • View Profile
    • My shit
Re: Dwarf fortress multiplayer
« Reply #92 on: October 17, 2017, 04:13:38 am »

I am very, very, very interested by the fort mode. Please make it a reality. You'd make a couple people extatic on my side of the globe.

Vi Et Armis

  • Bay Watcher
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #93 on: October 17, 2017, 05:28:37 pm »

What you've done already looks amazing! Love that road map, don't give up!
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #94 on: October 18, 2017, 12:12:47 am »

Just to update people on what is happening: i've accidentally remembered that i've done the rendermax so i've been experimenting with running light calculations on opencl for the last week, but i'm thinking of this too.

MoonyTheHuman

  • Bay Watcher
  • I think the DEC VAX hates me.
    • View Profile
    • hellomouse
Re: Dwarf fortress multiplayer
« Reply #95 on: October 24, 2017, 02:16:50 pm »

Wait. This exists? Time to revive DF Together, just with less work.
I mean, i'd still have to do fort mode code and general work, but thats about it. I can just steal the renderer from here :P
EDIT 5million: Oh. Already part of DFHack. That helps.
« Last Edit: October 24, 2017, 02:20:23 pm by MoonyTheHuman »
Logged

spazyak

  • Bay Watcher
  • Imagine a working link to Rickroll here
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #96 on: October 25, 2017, 08:17:32 am »

I don't know if posting here counts as necro-ing a thread but wanted to see if this is still a thing and perhaps how I could set this up and host it for some friends and I to play.
Logged
GENERATION 31:
The first time you see this, copy it into your signature on any forum and add 1 to the generation. Social experiment.
Ravioli Ravioli, the old broad died so now I play a Demon Loli.
Sig-texts!

KittyTac

  • Bay Watcher
  • Impending Catsplosion. [PREFSTRING:aloofness]
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #97 on: October 25, 2017, 08:18:51 am »

I don't know if posting here counts as necro-ing a thread but wanted to see if this is still a thing and perhaps how I could set this up and host it for some friends and I to play.

Only Warmist has the code. Fortmode is being developed. Or so I sincerely hope.
Logged
Don't trust this toaster that much, it could be a villain in disguise.
Mostly phone-posting, sorry for any typos or autocorrect hijinks.

spazyak

  • Bay Watcher
  • Imagine a working link to Rickroll here
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #98 on: October 25, 2017, 08:25:18 am »

Ooh I will have to keep an eye on this then.
Logged
GENERATION 31:
The first time you see this, copy it into your signature on any forum and add 1 to the generation. Social experiment.
Ravioli Ravioli, the old broad died so now I play a Demon Loli.
Sig-texts!

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #99 on: October 25, 2017, 09:17:00 am »

I don't know if posting here counts as necro-ing a thread but wanted to see if this is still a thing and perhaps how I could set this up and host it for some friends and I to play.

Only Warmist has the code. Fortmode is being developed. Or so I sincerely hope.
https://github.com/warmist/df_multiplay
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #100 on: October 25, 2017, 09:59:01 am »

I don't know if posting here counts as necro-ing a thread but wanted to see if this is still a thing and perhaps how I could set this up and host it for some friends and I to play.

Only Warmist has the code. Fortmode is being developed. Or so I sincerely hope.
https://github.com/warmist/df_multiplay
Just to update people on what is happening: i've accidentally remembered that i've done the rendermax so i've been experimenting with running light calculations on opencl for the last week, but i'm thinking of this too.
Also people that understand some dfhack-ines everything you need (without compilation) on windows is in first post.

Sanctume

  • Bay Watcher
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #101 on: October 25, 2017, 01:12:36 pm »

PTW, because coding.

Brother Muttonchops

  • Escaped Lunatic
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #102 on: December 06, 2017, 10:51:00 pm »

I just made an account on Bay 12 to follow this post and want to say, it is really awesome what you are doing here!

I saw the other 3rd party applications like dfterm, WebFort, and DFeverywhere and I was really disappointed to see that most of them fell to the wayside; I just recently got into Dwarf Fortress and never really got to try them at all. However, I would love to see where this could potentially go and from the prior posts, it seems it worked well enough to be enjoyable.

So thank you Warmist for your hard work and I am posting to follow this project!  :)

Logged

Dunamisdeos

  • Bay Watcher
  • Duggin was the hero we needed.
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #103 on: December 08, 2017, 07:29:42 pm »

I am still watching with great interest.
Logged
FACT I: Post note art is best art.
FACT II: Dunamisdeos is a forum-certified wordsmith.
FACT III: "All life begins with Post-it notes and ends with Post-it notes. This is the truth! This is my belief!...At least for now."
FACT IV: SPEECHO THE TRUSTWORM IS YOUR FRIEND or BEHOLD: THE FRUIT ENGINE 3.0

tranquilham

  • Bay Watcher
  • [TRANSLATION:OWO]
    • View Profile
Re: Dwarf fortress multiplayer
« Reply #104 on: December 10, 2017, 07:23:01 am »

posting to watch as well; looks very promising.
Logged
Pages: 1 ... 5 6 [7] 8 9