RimWorld

RimWorld

ResearchPal - Forked
how to deal with prerequisites when reordering (theory)
hi VinaLx :)

from 2 Nov, 2019 and a bit more recently than that, i had some thoughts for fluffy, regarding how to re-order a bunch of queued tech.
(basically dealing with prerequisites when reordering)

i pasted the theory behind it here for you in this discussion page, in case useful at all, as it spanned several comments :)


"
part 1a:
hi fluffy, as far as i can tell, this is what seems to happen (from a basic point of view) :)

player brings up the research tab window.
player clicks on a research (and the mod adds it to the potentially-pre-existing queue)

if player clicks on a research requiring another research, the mod identifies it and adds that to a temp buffer, (and checks to see if that tech itself needs another mod too)
and if not, the temp buffer gets finalised, and then the required mod is added first, and the originally-clicked tech is added after that.
(an iterative loop might take place here too)


part1b
if this is the case, maybe the way for queue swapping could be as follows?

- if tech is queued up or existing...
the existing queue is noted down in a temp buffer somewhere (basically the mod would just record user clicks on the actual tech the player clicked on)

then, when player re-arranges queue, the mod could simply lookup that recorded set of clicks, and simply swap the ordering of the clicks based on what the drag and drop re-arrangement ended up with. (this would essentially take place after each drag and drop, so that only 1 re-arrangement process would take place at a time, and the operation of tasks would need to be completed before the mod allowed any other re-arrangement to take place.)


part2:
then, as past of the final step of this operation, the mod could simply blank out any existing queue, and then just refer to the "swapped ordering" of clicks, to simulate (and perform) all of the usual functions that the mod already does, as it pretends that the user had manually clicked on tech, (and any required tech simply would get automatically placed before it in the queue just like the mod already does when a user manually clicks on a tech that requires something.... this way, its the same as the user clicking on things, but the mod just changes the ordering, as it simulates the user clicks :)

well, i didnt actually have any cup of tea yet, but that is what came to mind just now :)

"

other small related coments 13 Jul, 2020, and 17 Jan, 2020 on research tree page
< >
Showing 1-3 of 3 comments
VinaLx  [developer] 8 Jan, 2021 @ 4:19pm 
Oh wow thanks, that's very considerate of you!

Although I don't particularly think the algorithm of doing the actual stuff (correctly rearranging the queue) is going to be challenging at all. The challenging part (to me) is going to be handling the mouse event correctly, drawing the nodes while they're being dragged etc etc, while not interfering other part of the event handling / drawing logic, and keeping the implementation relatively clean and maintainable, you get the idea.
pgames-food 8 Jan, 2021 @ 4:43pm 
ah thats ok, its cool that lots of modders care and share, to ultimately improve the game for all of us :) (but i wouldnt recommend sharing food with others like bags of popcorn and crisps with recent events) :)

actually i will use that as an excuse to not share my crisps with others, even after we all get a vaccine :lunar2019grinningpig:
pgames-food 2 Feb, 2021 @ 7:00pm 
hi you did a really good job with this mod :)
< >
Showing 1-3 of 3 comments
Per page: 1530 50