Giter VIP home page Giter VIP logo

Comments (8)

StefArma avatar StefArma commented on June 3, 2024 1

i think that _difficil is the same only because it was an initial copypaste... however each mission might be improved and with different conditions after the mission core is done (this is still alpha).

So, making a well shaped function will then take time to also specify differences in the moment they're going to be coded.

In my point of view: core has to be DRY... let me mention: undercover, spawn/despawn, win/loose, etc.
So we have a scaffold that is solid and easy to read, and based on that we can add the specific subcategories that can actually be less shaped considering it's a mission of few mb and not a mod itself.

Also i'd give priority to parameters: it should be simple understand what is passed and how to call/spawn a function

from a3-antistasi.

Barbolani77 avatar Barbolani77 commented on June 3, 2024 1

Well, I would start to build some basic functions like: [_soldiers, _marker] call isAbleToConquer > 3*([allUnits,_marker] call isAbleToDefend), or [_soldier] call isAbleToFight (not unconscious, alive, not captive, not fleeing), thos will simplify a lot of things.

from a3-antistasi.

Sparker95 avatar Sparker95 commented on June 3, 2024 1

One way I've learned to make "classes" and "objects" in SQF is:

  1. Create any object which can be treated with setVariable and getVariable, like a logic unit or an object with a simple 3D model which you can later hide.
  2. Then treat it like any object in OOP, make a "constructor", "destructor" for it and "methods" as usual functions.
    It definitely gives a boost to code flexibility, also keeps it more organized. But I have also found that the more objects like this you've created the longer time it takes to create a new one, simply the limitation of an engine(it's 10's of microseconds, IIRC, but still), and the (get/set)Variable performance might drop, so these objects shouldn't be created for every sneeze of your soldier.

OOP approach is good for "entities" that need to do some kind of processing with ability to spawn many of them, like you create a "mission" object, it instantly initiates needed data for the mission, markers, etc, and spawns a thread to monitor the mission execution. Now you can spawn as many as you like and do whatever with them and they will never interfere.

from a3-antistasi.

Souli7 avatar Souli7 commented on June 3, 2024 1

Maybe this repo can give you some insperation: https://github.com/dwringer/a3system
Found after some quick searching on github.
Love the work you put into Antistasi so maybe this will eventually help.

from a3-antistasi.

Sparker95 avatar Sparker95 commented on June 3, 2024

As I know SQF doesn't support classes (don't confuse with classes in .cfg files) or object-oriented things without extentions. Do you use some extention to get class support?

from a3-antistasi.

zalexki avatar zalexki commented on June 3, 2024

Hum i see, so https://community.bistudio.com/wiki/Class_Inheritance is only for config files ? i cry :(
But i think we still can have a more object-oriented code (or at least DRY), simply on mission files i can see that all this dificil condition is repeated, this should be refactored in a function (or at least mooved into a isDificil.sqf file and then included) and also get a linter on it.

We call also look at some plugins to do that like this one.

from a3-antistasi.

zalexki avatar zalexki commented on June 3, 2024

Actually looks like OOP is not a real thing in SQF :/

I found this guide where some ideas can be applied for better readability : https://ace3mod.com/wiki/development/coding-guidelines.html

from a3-antistasi.

zalexki avatar zalexki commented on June 3, 2024

Enfusion (DayZ and high chance arma 4) will support it \o/
I close because issue name actually is irrelevant to project.

from a3-antistasi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.