[TOT] Fading Lights 2 Concepts Page (Medievel Nerds Wanted and Welcome!)

Discussion in 'Civ2 - Scenario Creation' started by Konig15, Sep 7, 2021.

  1. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229
    Also while I have neglected on working on the map I have been doing research and it turn out Kings and Generals have been doing quite a the series on this time frame! and just been releasing videos so I got the wind in my back.

    Can you get units to spawn with no movement points on their first turn? Cause it's important for piracy patrol, If you're good at your job, you can intercept them before they can ravage your unit generators (and YES this makes patrol much more important). But I need both pirates and unit generators to not be able to move first turn so the logistics of a coast guard as well as a navy come into play. A huge part of the sapping of the Byzantine economy, and while the Niceans desperately needed a Navy to defend against the Italian Republics in order to throw off their economic dominance they also needed an anti-piracy force to not have to ask for Italian help in not being robbed by often Italian pirates. They needed time to do that and they ran out historically.

    But this requires spawning in units with zero movement first turn.
     
  2. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    3,833
    Location:
    Ontario
    The way TOTPP Lua works is that there are certain points "execution points" in the game where the Lua interpreter checks if there is any code to to run, and, if so, runs the code.

    The "goal" of an events.lua file is to register the code for an execution point. For most execution points, there is a command civ.scen.onTrigger to register a "function" (set of instructions), though some execution points in the Lua Scenario Template don't have their own register, but simply rely on another civ.scen register. Part of the reason for the template is to hide those details from the designer.

    In order to register a function for civ.scen.onTrigger, you have to have that function written. This will either be written before civ.scen.onTrigger, or within the civ.scen.onTrigger command, but not after (well, with some cleverness, it could be written after, but there isn't much point). We'll call this function the "onTriggerFunction".

    The onTriggerFunction is probably big and complicated, so it has "helper functions" to handle part of the code. These helper functions must also come before onTriggerFunction. In fact,importantHelperFunction might come far before onTriggerFunction, since it is also used for onOtherTriggerFunction, which has been defined in the events before onTriggerFunction.

    In some sense, what this means is that if the events are in a single file, the "big picture" stuff is towards the bottom, while a lot of disjointed details are closer to the top. If the events are spread out over multiple files, the "top of the file" is likely to include multiple other files.

    Why don't we start with a different real example? In my original lua lessons and the re-write I started I start with empty events and build up from there, explaining what I'm doing.

    I would hazard to guess that we didn't reject advice out of hand. I have written lessons attempting to explain how to program, starting from basics. Maybe I did a poor job, but you don't seem to have even tried to use the resource. At the very least, you haven't asked for an explanation/clarification on anything there. Instead, you're looking into scenarios which weren't written with teaching new people in mind (Boudicca's a bit of an exception, but still not a good place to start), and complaining you don't understand stuff. Just as Knigttime predicted:

    Sorry, but I'm not willing to give you personal audio lessons. I've suggested a video tutorial, and even a different programming environment when you had trouble installing the one recommended in the video. I think we're at the point that if you don't like my advice, you're going to have to find some way to learn some Lua on your own, and later we can talk about the specifics of Civ II Lua once you have the basics. Or, you can design your scenario in the macro system, and ask someone to do a couple of Lua events for it when it is otherwise complete.
     
    Dadais, Knighttime and Civinator like this.
  3. Knighttime

    Knighttime Prince

    Joined:
    Sep 20, 2002
    Messages:
    344
    I can't speak for anyone else, but personally I have taken quite a few semesters of college courses in computer programming, and writing scripts has been a major part of my job for years -- it's not just a part-time hobby. I had never used Lua until I learned it for Civ2, but it's far from my first programming language... maybe about the tenth or so?

    My point isn't to give myself an award, but to say that your expectation of being able to read through and understand the Napoleon events probably isn't reasonable at this point. That's OK, and this isn't an insult in any way whatsoever -- I'm just saying that you're not being fair to yourself, by tackling that as a first step.

    I think I could sit down with a second- or third-grader and explain Macbeth to them, line by line, and they would eventually understand most of it. But that doesn't mean it's appropriate reading material for them at that point in their education. Again, this isn't a put-down -- I'm trying to help you recalibrate your expectations so you end up less frustrated and begin enjoying the process of writing basic scripts, because that's the foundation you need. The Napoleon events will make a lot more sense to you later, if you follow the recommendations we keep repeating about starting with the lessons from Prof. Garfield, or seeking out other sources of material intended for people who are new to programming.

    If you're creating the units yourself in a Lua event, sure -- it only takes one extra line of code, inserted right after you create each unit, something like:
    unit.moveSpent = unit.type.move

    If you're talking about barbarian units that spawn automatically (driven by the default game engine) then this is still possible, but it's going to be a little trickier. The command you'll use is the same, but finding the right unit(s) to apply it to will be the bigger challenge.
     
    Last edited: Oct 29, 2021
    Dadais and Civinator like this.
  4. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    4,511
    I would just throw in there that even though I believe I was one of the first non-coding people to really embrace this system (I think 3 or 4 years ago at this point), I still routinely reach out here or privately for advice. I have reached a point where I can occasionally build something "from scratch" that isn't too complex, but I'm still an absolute novice in the grand scheme of things. This is not an easy thing to grasp. As Knighttime said, do not let yourself get discouraged. Really it wasn't until Cold War that I finally felt like I was getting the hang of things (and that was after working on Caesar, Midway, and OTR -- well, following along really with OTR and Caesar, but trying to "add value" and usually messing something up along the way). It's going to take you some time.

    I will admit, when I was first learning, I had to be gently reminded by Prof. Garfield that I should look at his lessons in more detail. I can be honest with everyone here - I wanted to jump right into the exciting stuff and not go through it. That was a mistake on two levels:

    1. The lessons actually are quite helpful, especially once you get two or three modules in.
    2. If I wasn't willing to utilize the resource folks had put considerable effort into before asking questions, why then should they put even more effort into answering other things?

    At one point (sitting at a boring kids party lol) I decided to crack open my phone and really start reading through them. This provided a good baseline and also gave folks confidence that I'd put in the effort on my end.

    I would definitely suggest you put yourself through the lessons before anything else. It may open doors for you.

    More importantly however, starting with lua is kind of putting the cart first. How is the scenario itself coming? They are not that easy to build in the first place! I'd start there and then on paper organize what you roughly want the events to look like and then after doing the lessons, if you gave us a blue print, we might be able to show you the template and give you a better idea of where to plug things in, as well as some examples from prior works to get you started. Most of your events (aside from turn/text I suppose) are going to be purely academic until you have an otherwise working scenario, anyway.
     
    Dadais and Civinator like this.
  5. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229

    Oh terrible. RL issues, namely a busted-ass mattress and back pain and constant sleep deprivation for months have screwed everything up! BUT the new Purple came last night and I see the Good Professor posted the first lessons so MAYBE I can make a go.

    I got that BEAUTIFUL map, I can't do anything with it on a first draft. I'm gonna have to "learn to code" and basically experiment on the pre-built Basil II map which I'm gonna have to tear down and rebuild from the ground up as far as units and tech tree but that's OK.

    See the thing is, I tried the Beyond Earth Demo and I loved it and I realized I halfway want to rebuild Civ 2 mechanics, and it's absolutely necessary to do the Fading Lights period justice. This is a society being cherry-tapped to death, and you can't have easy logistics and understand the fall of the Byzantine Empire. Short of making the AI extra pillage-y and it will pillage anything it comes across as top priority I need to build a logistics system dependent on a lot of harvesting units. And frankly, this is an important concept going forward the Fallout and World War II scenarios because of raiders and partisans respectively.

    A lot of this stuff would be easier to do in Civ 5, maybe Civ 4 but I haven't played it but here I have Lua, a guy who can make eath maps right quick and a four map structure. Also, a base that LIKES scenarios, which I'm not sure exists for Civ 5, but I know exists for Civ 4. But right now the four map structure is DEFINATELY the best selling point.
     
  6. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229
    Well here's the update:

    Over the last ten years, I've tried a lot of modding projects and I've come to a realization: I cannot learn except by handholding. I learn by intuitive leaps, not by reason or repetition, I need things explained to me as I'm doing them with real-time feedback, and thus tutoring, as I had in college or classroom instruction or apprenticeship is the ONLY way I learn basic skills structure. Intermediate and advanced stuff, sure I can learn on my own once I have the basics down.

    Because no one will handhold me in Lua, Lua is less than useless to me. I need to go back to the old scripting which I mostly understand. It's so basic it's hard not to. Now the question is, is there a link to the full list of capacities of the old scripting system, particularly in regards to effects on building city improvements?

    The central conceit I need to have on the decline of the empire is the pronoia system. so building the pronoia improvement which will probably be the supermarket improvement needs to give a pronoia unit, which has zero attack but can be disbanded for big production for expensive military units but it needs to give a BIG long term hit, preferably with a generated pollution marker within the city limits. I can mine other scenarios for the unit generation I think, but I'm not sure about a random terrain change or pollution change. Either would work.
     
  7. tootall_2012

    tootall_2012 King

    Joined:
    Feb 11, 2012
    Messages:
    802
    Hi Konig,

    I believe I may have already relayed this information to you in the past but in case you have forgotten here are the resources in particular that you want to acquire when it comes to the Macro language:

    In the Civilization II Test of Time manual, link below, you will find on pages 199 – 216 the ‘Appendix: Enhanced Scenario Macro Language’ section that covers all the triggers and actions related to the language, including the BestowImprovement action on page 207 (for ease of use, I’m also attaching a txt file version of the Macro language).

    https://forums.civfanatics.com/resources/civilization-ii-test-of-time-manual.3777/

    Furthermore, with regards creating events file, you should also review the following links from the Scenario League site, which will teach you how to use flags and masks:
    An Introduction to Flags
    Flags and Masks for ToT


    If you plan on using multiple maps in your scenario here is another necessary link on Map Transport Relationships:

    http://sleague.civfanatics.com/index.php?title=Map_Transport_Relationships

    As John has indicated on a number of occasions, it is totally premature to begin working on your event files, lua or macro, if you haven’t first laid down the foundations of your scenario. As such, have you created your map, placed your cities, created a functioning draft of your tech tree and rules file? Have you selected your units, improvements, wonders and their technological prerequisites? Have you prepared your first draft of the terrain, icon and improvement graphics? In essence, do you have a basic functioning scenario, minus your event file, that doesn’t immediately crash when you try to load it up?

    Without these elements in place, trying to write your events first is literally trying to put the cart before the horse.

    For your reference, I’m attaching a basic project plan that I use for all my projects and as you will notice events are number 14 on a list of 18 of the things to do.

    Finally, as you’re repeated past posts have indicated, you’re clearly discovering that there is a world of difference between commenting about other designers scenarios and actually creating one yourself. The former can take less time than a leisurely stroll in the park whereas the latter can take a lot of research, preparation, dedication and yes learning. But most of all it typically takes a great deal of patience and time.

    People on this forum are always willing to help when they can but if you’re unprepared to put in the basic effort yourself on your own projects, it’s unrealistic to expect others to do it for you.

    I hope this information proves useful to you.
     

    Attached Files:

    Last edited: Jan 26, 2022
    Knighttime, JPetroski and Dadais like this.
  8. Dadais

    Dadais King

    Joined:
    Oct 20, 2010
    Messages:
    611
    Location:
    France
    I'd advocate for what was said by these great designers.
    Considering months or even years spent building one scenario, when there's so much to do before writing lua, what are one or two month taking time to learn Lua ?


    Keep straight with your vision, build your scenario layout then make good use of Prof. Garfield gold-like Lua lessons.

    Once these few lessons are passed, learning little by little while testing stuffs, you'll get satisfied from beeing privileged, one discovering the possibles, and mature your vision to magnify a great "usual" ToT scenario into a great polished ToTPP Scenario.
     
  9. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    4,511
    I think I've been working on Hinge of Fate for about 4 years now and I only even "broke ground" on it (meaning: placed the first city) in 2020, I believe... Some unfinished maps I have are dated back in early 2019. And we're talking sustained effort, to the point where I would use some paid time off to just sit and go through excel documents before I even touched the rules. Granted, this is a huge, 4 map, 12 rules/units art scenario, but even small scenarios like Caesar or Germanicus took the better part of a year (and Caesar I had Grishnach helping with). Don't even get me started on how long Over the Reich was in production. I literally have PMs from 2011 on that one sitting in my inbox still LOL.

    It's not meant to discourage you but I have (and I imagine everyone has) at least 3 "projects" that I dreamt of for every one I've built, and frankly I've had a bad habit of not getting that last 3-5% done lately either with Midway and Cold War both being good examples. I don't think I've even uploaded Midway. Still, I've always said, when you ask someone for art or for help, you're asking them to invest their time in you and your project. While some are pure saints, many of us would prefer to spend that investment on stuff that actually has a chance of seeing the light of day.

    I have never had a problem getting help with some units but then I don't ask until I have a viable scenario, either. I use placeholders before that. Likewise, I don't ask our lua coders to do insane work on stuff I might do down the road - I ask them to help me with specific problems that I have on a project I intend to finish (unfortunately sometimes it's still insane work but you get the point).

    Basically, get going, use @tootall_2012 's guide to a t, start with something bite sized that you can hope to achieve within 6 months, and get started. Show us that you have that and then we can help...
     
    Knighttime and Dadais like this.
  10. Knighttime

    Knighttime Prince

    Joined:
    Sep 20, 2002
    Messages:
    344
    @tootall_2012 Your entire post is filled with great advice, and I don't mean to detract from any of it, but this part made me hesitate just a little bit, because of something Konig said:
    If this is a core concept within the scenario, and might determine what techs, units, or improvements are needed, it's probably worthwhile to write just enough events pretty early in the process to be assured that they can do what's necessary. For Medieval Millennium, I often wrote some test events just to try out something and see what was possible: for example, it didn't pay for me to designate 18 unit slots as projectiles until I was convinced that my entire approach to having ranged units fire projectiles would work. But I didn't have to finalize all that event code and get it working perfectly, I just had to sketch it in and make sure that the basic concept was possible.

    So @Konig15 I think it's perfectly reasonable to explore the limits of macro language and make sure it's compatible with your vision -- but at the same time, tootall_2012 and @JPetroski are absolutely right: there's a ton of work to do that is pretty foundational and has nothing to do with events. Those can be the icing on the cake of a great scenario, or even the glue that holds it all together, but they can't rescue a scenario which has basic design flaws or shortcomings. My two cents is that the tech tree is absolutely the hardest thing to get right, more so than units or improvements/wonders -- in MM I kept putting it off because I found it overwhelming.

    Yup -- I began building Medieval Millennium in earnest in 2016, after TNO released support for Lua events into TOTPP, but I have some notes from prior iterations of the project going back to 2012. My first playable version (where I actually played hundreds of turns, not just a handful to test something) was February 2019. The scenario was actually released in November 2020, so that was also about 4 years in the making. And, as you said, a whole lot of time was spent in Excel!

    Ain't that the truth! :lol:
     
    Last edited: Jan 26, 2022
    JPetroski and Dadais like this.
  11. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229
    OK, let me try and explain. It's not that I am not willing to learn, it's that I CANNOT learn passively. Very basic skills I cannot learn passively from reading about them or watching videos. . I need in-person, hands-on instruction, with active questioning sentence by sentence for the same reason you can't learn to play the piano by by reading about it in a book or watching a video. YOu need someone to put their hands over yours and physically put your hands in the right position to show you how to how your hands over the keyboard just to start you out. There's an analog here for basic programing, which is what scripting is. In any other field, this is called teaching, on the internet, this is called hand-holding, and it's the only way I can learn.

    It's like threading a needle, you need both hands, and you need them at the moment of threading, which is why I've said real-time Q&A. That's what tutoring is, I responded very well to it. I do suspect though the way people have tried to teach me over the years I'd still have the basic problem of that I'm an inductive thinker, so scripters end to think in terms of practical operations and to me all things are arbitrary until I understand the architecture of the system, something I simply will never understand by feeling it out. This is why for me the why's of a system are way more important than the hows and if I understand the whys the hows follow but never the other way around. Every technical thing I've ever gotten instruction on I forget within 10 minutes because it's completely arbitrary, including say, getting old windows XP batch files for civ 2 to run on Windows 10. Because I don't understand WHY things have to be configured the way they do to get them to run, they have no memoric staying power. In practice, I know a system really well or I don't know it at all. I have to be able to have a comprehensive knowledge network so I can wikiwalk my way back from any random point in my scatterbrain to the needed solution.

    Are you getting an idea of the problems I face when it comes to understanding the scripting?

    It's learning, remembering, and at this very basic level a failure to launch because it's completely incomprehensible, without the whole Lua thing being explained to me line by line in crayon. That's not an exaggeration.



    Now as to the events in the old macro language, there's nothing in there about adding pollution, and the thing is I can't add it to a random square or a specific square I need to force the vanilla pollution event, which is confined to a specific city radius in order for this to work, otherwise there's no point.

    CIv 2 is set up for rise of CIvilizations. The Macedonian Dynasty, the Muslim Conquests from the perspectives of the Caliphs, the Colonization of the Americas. It's not for civilizations in decline, that are divided and falling apart, and corrupt and tearing themselves to pieces. That was the problem with Fading Lights, the Byzantine Recovery hinged on external victories, but didn't go over the festering rot in the empire itself, and didn't give you a means to combat it.

    Now if the Bestow Improvement event can take away improvements as well as give them on page 207, then yeah, we might have something.
    BestowImprovement

    Parameters
    improvement= improvement index number
    race= civilization name
    capital= Yes, No, On, Off, True, or False
    wonders= Yes, No, On, Off, True, or False

    This brings out a couple of questions
    Can you set a specific city to receive the improvement? CIty name is not listed as an option.
    Can you remove improvements?
    If so does this include wonders?

    If yes for all of these, then the old Macro language was PAINFULLY underutilized. Combined with the Take Technologyotion we have events swapping a way to continuously allow for RP and goal setting. Which is good insofar as it goes.
     
  12. Knighttime

    Knighttime Prince

    Joined:
    Sep 20, 2002
    Messages:
    344
    @Konig15 We get it, you don't see a viable path forward to learning Lua. At this point I feel like you've explained yourself very clearly -- you don't need to cover that ground over and over again. (Just link people back to an earlier post if you feel like they still don't understand.)

    Lua can do this, in fact I do exactly this in my Medieval Millennium scenario for plague strikes. (Don't scream, I didn't say you had to learn Lua, bear with me here...)

    I agree with this statement 100%, and I was confronted with this same problem in building MM. But it's a fine line -- most people want to play a scenario where they have at least some sense of forward progress, so the key is to provide people with a struggle they have a chance of overcoming, not one that feels like a hopeless fatalistic march.

    According to the documentation it cannot. But Lua can do this. (Stay calm...)

    According to the documentation it cannot do any of those things. But all of them are possible with Lua. (Wait for it...)

    Well, I don't think the Macro language was painfully underutilized, in fact there are quite a few scenarios out there that really push it to the limit. But the Macro language itself falls short of what designers can dream, which is why so many people (myself included) are promoting the use of Lua.

    The question you need to ask yourself is, how many of these things that Macro can't handle are required for your vision of this scenario to be achieved? Can Macro get you 90% of the way there, or only 40%? If you made a list of the events you would need Lua to accomplish, is that a list of 3 items? 10 items? 150 items?

    Here's the key: you don't necessarily have to learn Lua to release a scenario with some Lua events. I think there are multiple people on this forum that would be happy to write Lua events for you and just hand them to you, all done, they just work -- if the scope of your request is reasonable. The three items you listed here (pollution in a city radius, giving and taking improvements and wonders) might take less than an hour total for those of us who know Lua well to write for you. Not really a big deal. And using @Prof. Garfield 's Lua Scenario Template, it's possible to integrate Macro events with Lua events -- so you could write most of the events in Macro, and someone here could fill in the gaps with the handful of Lua events that Macro can't handle. The scenario would technically run all of the events in Lua, but the majority of them would actually be written in the good ol' Macro language you already know.

    But if you have a list of 50+ items that Macro can't handle, which will take 100+ hours of work, that's an entirely different story. That means your vision simply isn't aligned with the decision to proceed with Macro as the primary events language. If that's the case, since learning Lua is off the table, I think you should probably select a different project entirely. Sorry if that's too blunt, but I think that's a fair assessment of the lay of the land. You have to align your tools with your project, or (turn that around) you have to select a project that takes into account the capabilities of your tools.

    This. If you are confident that Macro can do almost all of what you need, and you have a short list of Lua events that you want someone else to write for you, dig in and build what you can. Demonstrate progress, write the events that are possible with Macro, create a scenario that at least works, and you will not have problems finding someone here to pitch in with a short list of Lua events that are needed to finish the project. I would be glad to do this myself. But you won't find volunteers clamoring to write Lua events for you as a first step because that's not the appropriate first step in any Civ project, as @tootall_2012 and others have said.

    Only you can understand the gap between what Macro can handle and your vision, and only you can speak to the degree to which you might be willing to bend your vision in order to keep the amount of Lua work reasonable.
     
    Last edited: Jan 29, 2022
    JPetroski likes this.
  13. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229
    In that case, you have my utter thanks.

    I'm not gonna ask what a reasonable or unreasonable request for lua events are, not even gonna think about events yet, I'm just gonna build the maps. Right now I have two in mind, a regular map and a trade map, which is both trade and the religious and political borders of the empire.

    I hope this doesn't upset you but where can I download your Medieval mod? It's like the Bodicia one, I heard about it but couldn't find it until someone gave me a direct link. I apologize for not responding sooner, there's been frizzy internets, ice stroms and apperently %G CAN seriously screw with your sleep (not sure about everyone but I have to unplug my routers every night now that I have wireless and with a sleep mask I'm getting the most restoraive sleep I've had at least since Obama was president).

    I cannot tell you how thankful I am. When I have a pre-alpha build, the Lua help I'll need at first will be translation from old macro to lua just to figure out some of the very basic languge functions. But that won't be for some time. But I have to Get Good on more basic function of Civopedia enteries, editing world names, more or less everything in the rules folder after @attitudes.

    Is this the thread to ask about those things? Or should I ask elsewhere? I've been playing the Midgard sneario again and my word do I have questions about barabarians and goody huts and while I knopw Scenario Leauge wiki has a thing on barbarians I wonder if there's a unit gif with the barbarian drof info marking the units in question and how those rules change based on map eligability because I don't think the barbarian paper rules work in Midgard. And the goody huts....
     
  14. Knighttime

    Knighttime Prince

    Joined:
    Sep 20, 2002
    Messages:
    344
    Thanks for asking, you can download Medieval Millennium here: https://forums.civfanatics.com/resources/medieval-millennium.28568/

    To provide a little more information about how the process works: @Prof. Garfield 's Lua Scenario Template has the capability of parsing a macro Events.txt file and running those events "behind the scenes" using Lua. It doesn't generate a human-readable file with Lua code, though, that you could look at side-by-side with your macro events file and see how they compare. You'll write, test, edit, and maintain your macro events in Events.txt just like always. And as you said, it won't be for some time yet that you'll have to worry about anything to do with Lua at all. Good luck with your map work and getting started on edits to Rules.txt!
     

Share This Page