Author Topic: JAC  (Read 5527 times)

0 Members and 1 Guest are viewing this topic.

Offline Ford_Prefect

JAC
« on: November 03, 2014, 09:19:16 PM »
I'm working on creating an open source (GPLv3) SMAC clone using Java 7.

Currently its just 93KiB of text parsers for reading in all the available factions and rules.

Currently I'm working on:
  • Saving and loading all the rules/factions/etc to and from xml files.
  • J-unit tests
  • Placing and moving units along the map

Todo:
* Everything that isn't done.  ::)
* script.txt  Gonna save this for when I'm feeling ambitious.  Gonna have to design it properly to handle the translations.

Whats done.
* Loading/Saving Individual factions.
* Loading Chassis/Armor/weapons/Reactor
* Loading Ideologies.
* Loading blurbs
* Partial Loading of facilities and unit abilities.  These only store some of the information in the txt file.  Will need to manually input values for their effects.


Goals:
  • Ability to add new facilities
  • Easy to mod (currently planned via xml)
  • Support Windows/Linux/Mac/etc...
  • Support Multiple Languages
  • other  ;)

Ideas:

« Last Edit: January 03, 2015, 05:25:19 PM by Ford_Prefect »

Offline DrazharLn

Re: JAC
« Reply #1 on: November 03, 2014, 10:34:56 PM »
As I hinted at before, I think it would be a better idea to base the new datafile standard on json (and it should be thought about a little, documented and versioned so we can change it in future if necessary).

Why JSON rather than XML? JSON is much more human readable and editable and thus supports the common SMAC practice of modding by editing text files better.

JSON parsers exist for a wide range of languages, just like XML parsers, so support shouldn't be a problem.

Once basic functionality is complete, I think the following are desirable:
* Scripting language for modding/extension that hooks into game logic
* Sensible mod management with signed mods, versioning, dependencies, etc.
* AI scripting environment and toolkit to try to evaluate better AI strategies (I have some background in AI and would be interested in developing AIs for SMAC. The Freeciv projects and so on probably have interesting work in this area).
* Better MP support (lobbies, ladder, browser, PUG/matchmaking support (suited for slower pace of SMAC))

Offline Ford_Prefect

Re: JAC
« Reply #2 on: November 03, 2014, 11:49:41 PM »
I'm currently using the JAXB functionality in java.  I'm not sure if I want to learn a different library to save/load jsons.  (Or is it really easy? if so... point me at an example.  :D )

Btw... this is what the faction settings currently looks like.  (There is another xml for the text.)  Note:  Don't use this as an example.  The file format isn't stable yet.
Code: [Select]
?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<factionSettings>
    <ai_fight>-1</ai_fight>
    <ai_power>1</ai_power>
    <ai_tech>1</ai_tech>
    <ai_wealth>0</ai_wealth>
    <ai_growth>0</ai_growth>
    <Free_Techs>InfNet</Free_Techs>
    <num_of_free_techs>0</num_of_free_techs>
    <social>
        <entry>
            <key>ECONOMY</key>
            <value>-2</value>
        </entry>
        <entry>
            <key>MORALE</key>
            <value>1</value>
        </entry>
        <entry>
            <key>RESEARCH</key>
            <value>1</value>
        </entry>
    </social>
    <morale>0</morale>
    <psi>0</psi>
    <free_facilitys>4</free_facilitys>
    <research>0</research>
    <drone_bonus>-1</drone_bonus>
    <talent>-1</talent>
    <energy>0</energy>
    <interest>0</interest>
    <commerce>0</commerce>
    <pop_cap_difference>0</pop_cap_difference>
    <hurry>50</hurry>
    <unit>NONE</unit>
    <techcost>100</techcost>
    <sharetech>-1</sharetech>
    <tech_share>false</tech_share>
    <terraform_cost>100</terraform_cost>
    <fungus_nutrient>0</fungus_nutrient>
    <fungus_minerals>0</fungus_minerals>
    <fungus_energy>0</fungus_energy>
    <extra_frequency>0</extra_frequency>
    <mind_control_immunity>true</mind_control_immunity>
    <fanatic>false</fanatic>
    <votes>0</votes>
    <freeproto>false</freeproto>
    <aquatic_faction>false</aquatic_faction>
    <alien_faction>false</alien_faction>
    <pro_ideologies>
        <item>values</item>
        <item>knowledge</item>
    </pro_ideologies>
    <anti_ideologies>
        <item>values</item>
        <item>power</item>
    </anti_ideologies>
    <ai_emphesis>RESEARCH</ai_emphesis>
    <revolt_success_modifier>0</revolt_success_modifier>
    <probe_cost>100</probe_cost>
    <drone_reduction>0</drone_reduction>
    <offence>100</offence>
    <defence>100</defence>
    <wormpolice>1</wormpolice>
    <techsteal>false</techsteal>
</factionSettings>

Quote
Sensible mod management with signed mods, versioning, dependencies, etc.
  • Part of the reason why I've got the factions/rules split up into multiple files.  One is the settings/rules and the other is all the words.  I'm planning to hash the settings files while the file holding the translated text isn't hashed at all.  (Since it doesn't matter gameplay wise if one person sees the text in German or in English)
  • I had forgotten about versioning.  Will need to do that.  Hopefully the files will be forward compatible with little effort.
  • Dependencies will be interesting - some factions will only work with certain rulesets.  Then there is the fact that custom factions can be crazy powerful.  (Especially since I removed the limit on the number of effects you can place on a faction  :D )

Quote
* Scripting language for modding/extension that hooks into game logic
Not sure how to do this.  Probably a post 1.0 feature.  The security issues alone will make that quite difficult.

Quote
* AI scripting environment and toolkit to try to evaluate better AI strategies (I have some background in AI and would be interested in developing AIs for SMAC. The Freeciv projects and so on probably have interesting work in this area).
Definitely will have a toolkit for evaluating AI performance.  Not sure about scripting. 

Quote
Better MP support (lobbies, ladder, browser, PUG/matchmaking support (suited for slower pace of SMAC))
That will require a matchmaking server (Or doing horrible things via email  :D ).  But it will be a goal.  Probably version 1.1 First I need to get a working multi-player in place.
« Last Edit: November 04, 2014, 12:22:40 AM by Ford_Prefect »

Offline Sompom

Re: JAC
« Reply #3 on: November 04, 2014, 08:07:59 AM »
Hi Ford,
   Not to spam you, but I'll repeat my offer to help here, so that it's in the right post. Let me know whenever you're comfortable letting others on the project!
Thanks,
Sompom

Offline Ford_Prefect

Re: JAC
« Reply #4 on: November 04, 2014, 12:33:10 PM »
@Sompon
Thanks for the offer!  I plan to make use off it once I've got the foundation built.

I plan to open the codebase up after:
  • I've gotten all the variables from SMAC to load in
  • I've re-factored and gotten basic multi-player in place - EDIT:  2015/1/2 Code will be opened up when single player starts to work.
    [li$i]The player can select a faction and build a colony pod to make a base[/li]
    [li]Cleaned up and make sure to comment on all the functions[/li]
    [/list]

    After those are achieved, I don't think the game's structure will change much.  It will just be allot of implementation details, testing and asset creation.  Not to mention someone will have to create the 3d stuff.  ;)

    There is probably a weeks worth of work for the variables.  It will take longer than that because of work. (Sorghum doesn't harvest itself. ::)
    The multi-player will take an indeterminate amount of time as I will be learning the library calls and stuff to do so.  (I know some of the general theories of how to design multi-player.... I've just never done it before.). 

    I will post here when I reach one of the milestones.
    « Last Edit: January 03, 2015, 05:28:44 PM by Ford_Prefect »

    Offline Ford_Prefect

    Re: JAC
    « Reply #5 on: November 08, 2014, 09:10:46 PM »
    Any preferences for the open source licensing?

    LGPL, GPL, other?

    Status update:
    Making good progress on reading in text files.  Still need to do Techlong, techshort, scripts, concepts, flavor, and interludes. I'll probably work on unit tests for a while.
    « Last Edit: November 08, 2014, 10:27:36 PM by Ford_Prefect »

    Offline Sompom

    Re: JAC
    « Reply #6 on: November 08, 2014, 11:33:05 PM »
    I don't have a license preference as long as it's nice and open. Your pick!

    Offline Ford_Prefect

    Re: JAC
    « Reply #7 on: November 09, 2014, 08:04:34 PM »
    I've been applying some skull sweat towards a problem.  How should the effects of special abilities be stored in a way that allows modding?  This is made especially interesting by the fact that some of the effects change depending on chassis/reactor/who is attacking whom/etc.   The idea I have is to store a list of effects.  Each effect will contain 0 or more restrictions and a list of 1 or more tags that are active under those restrictions.

    Here is a list that I think should cover all possible unit abilities.

    Code: [Select]
    Restrictions:
    the units chassis type
    reactor type
    minimum police rating
    enemyunit_chassis_type  Air/Land/Sea
    enemyunit_armor_type Energy/Physical/Binary
    enemyunit_weapon_type Energy/.... etc.


    // Tags:
    // Attack/defense effects

    defence_effect(%) - defensive bonus.  (If you want to only apply to a certain scenario, like when
           being attacked by air, use the enemyunit_chassis_type, etc restrictions)
    offence_effect(%) - offensive damage % change. 

    killcitypop(%) - kill a % of a cities inhabitants if the unit wins.
    atrocity(); - is this an atrocity to use.
    moraleEffect(#) - change this units morale by #
    IgnoreBaseDefenses() - unit attacks the unit inside the base without any of the bases defenses taking effect.
    artillery(range) - unit becomes artillery capable of range.
    Amphibiouspods - unit can go from sea base to land and vice versa.  ground unit in transport can attack adjacent units in the sea.

    //Non-combat effects
    range_bonus(#) increase the range of a unit by #

    clean_reactor() - no maintenance cost.
    radar_bonus(#) - increase radar range by #.
    drop_pods - unit can make air drops.
    ignore_zoc() - unit ignores zones of control.
    cost_to_subvert(%) - change the cost to subvert a unit by the given %.
    police_bonus(#) - gives a bonus of #.  If you want to restrict, use the minimum police rating.

    //Terraformer effects
    fungicide(%) - remove fungus rate % modifier.
    terraform_rate_nonfungal(%) - % change in the terraform rate for non-fungal actions. 
    terraform_rate_all - % change in all terraform actions.

    //Transport effects
    allow_transportair() - allow transports to carry air units.
    transport_heals_cargo() - transports will heal units being carried.


    Does anyone see any problems with this idea?  Or does anyone have any request for a unit effect that I missed?

    Offline Yitzi

    Re: JAC
    « Reply #8 on: November 09, 2014, 10:33:22 PM »
    I've been applying some skull sweat towards a problem.  How should the effects of special abilities be stored in a way that allows modding?

    Don't store them in the special ability; instead store them in the relevant area (combat bonuses/penalties for combat effects, police effect for police, etc.), and simply have the presence/absence of each ability be a condition that can be applied.

    That way it's easy to make a new ability with more than one effect, it should be the most efficient way in terms of runtime, and if someone decides to make an ability that affects something you never thought of (like an ability for colony pods that makes them build a base with 2 pop or add 2 pop to a base), it can be done easily if the matter being affected is moddable in the first place.

    Offline Flux

    Re: JAC
    « Reply #9 on: November 10, 2014, 01:40:09 AM »
    Now that we have JAC being worked on it would be cool to have AC ports into 2 different languages. (the other being python with opensmac)
    Maybe "port" is not the right word?
    I wonder which one will be finished first.

    Anyway, I am excited to see this develop though I have only the faintest knowledge of Java.

    -Flux
    « Last Edit: November 10, 2014, 03:02:44 AM by BlueFlux »
    Left the internet, more-or-less.... Might drop in occasionally.

    Offline Ford_Prefect

    Re: JAC
    « Reply #10 on: November 15, 2014, 12:43:06 AM »
    The Weekly Report.

    I'm still working on implementing the system for modding unit abilities and base facilities.  I've come up with a solution, but implementing it is taking quite a bit of time.

    The code base has increased to 131KiB.  :(

    I might take a break from working on the unit abilities, etc and instead work on learning how to create a server and client.  I'm new to network programming so it will be interesting (or frustrating  ::) )


    Offline Ford_Prefect

    Re: JAC
    « Reply #11 on: December 03, 2014, 02:16:51 AM »
    Decided to post to say that I'm still alive.  I've had a bunch of paperwork to deal with in real life... so not much progress has been done in the last two weeks.  I'm currently working on implementing the map into the game (so I have someplace to put the units.  :) ).

    Online Buster's Uncle

    • With community service, I
    • Ascend
    • *
    • Posts: 49344
    • €854
    • View Inventory
    • Send /Gift
    • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
    • AC2 is my instrument, my heart, as I play my song.
    • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
      • View Profile
      • My Custom Factions
      • Awards
    Re: JAC
    « Reply #12 on: December 03, 2014, 02:27:50 AM »
    Glad you're alive. ;b;

    Offline Ford_Prefect

    Re: JAC
    « Reply #13 on: January 03, 2015, 05:24:15 PM »
    Status Update:
    Happy new year!  :D
    Map work is allot more complicated than I thought it would be. I'm still working on maps.  ::) 
    177kb of src.  But I suspect at least 20kb of that is the copyright notice that is pasted at the top of each source file.  ::)
     
    Complications:
    • WIP: How to keep players on multiplayer from cheating?  (Solution: Make it so that they only get map updates for the squares they can see.  This makes the map system much more complicated to program, but will eliminate being able to spy via cheating for clients.)
      • As a side effect scouting will be more important, as you won't know about a player's terrain improvements (bunkers, sensors, roads) until you see them.

    • WIP: Units can take more than 1 turn to move to a square. (Fungus takes 3 turns for infantry) So each move requires keeping track of movement points, the destination, the terrain, etc.  Not to mention it will have to check to see if something interrupts its movement every turn.  Whats worse is that various techs or unit abilities can change how fast they can go on different terrain types.
      • As a side note, the number of squares a terraformer moves has no effect on its terraforming rate. (As far as I can tell)
      • The fact that the basic terraformer only takes 1 turn to move onto a fungus square makes this part much more complicated for making it all modifiable.   :(

    • WIP:  Terrain types.  Need to keep track of what is mutually exclusive.  What requires a prerequisite (Tech or terrain type).  And any speed modifiers the terrain has.  What upgrades what. 
    • TODO: The variability of nutrients/minerals/energy.  You are capped on the food output of a square until you have a certain tech unless the square has bonus nutrients?!  Figuring out a simple way to set this up and making it modifiable is a pain.

    Offline Yitzi

    Re: JAC
    « Reply #14 on: January 03, 2015, 11:45:21 PM »
        [li$i]TODO: The variability of nutrients/minerals/energy.  You are capped on the food output of a square until you have a certain tech unless the square has bonus nutrients?!  Figuring out a simple way to set this up and making it modifiable is a pain.[/li]
        [/list]

        Allow people to add conditional caps, with "faction has tech" and "square has bonus resource" as valid conditions (and with the conditions including conjunctions and disjunctions of other conditions.)

         

        * User

        Welcome, Guest. Please login or register.
        Did you miss your activation email?


        Login with username, password and session length

        Select language:

        * Community poll

        SMAC v.4 SMAX v.2 (or previous versions)
        -=-
        24 (7%)
        XP Compatibility patch
        -=-
        9 (2%)
        Gog version for Windows
        -=-
        103 (32%)
        Scient (unofficial) patch
        -=-
        40 (12%)
        Kyrub's latest patch
        -=-
        14 (4%)
        Yitzi's latest patch
        -=-
        89 (28%)
        AC for Mac
        -=-
        3 (0%)
        AC for Linux
        -=-
        6 (1%)
        Gog version for Mac
        -=-
        10 (3%)
        No patch
        -=-
        16 (5%)
        Total Members Voted: 314
        AC2 Wiki Logo
        -click pic for wik-

        * Random quote

        Our ancestors harnessed the power of a sun, and so again shall we.
        ~Comissioner Pravin Lal 'The Science of Our Fathers'

        * Select your theme

        *
        Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
        Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
        Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
        Style sheets: 0: .
        Files included: 45 - 1228KB. (show)
        Queries used: 40.

        [Show Queries]