Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - RawCode

#1681
This early development version but, it working just as designed.

At this moment "injection" done by additional "monitor" thread, this subject to change, perfectly - by original game developer.

there is only single def at play:


<?xml version="1.0" encoding="utf-8" ?>
<Loaders>
<Loader>
</Loader>
</Loaders>


this def will perform loading of *main* type of assembly, allowing to inject code at early stages of game.

payload code is


public class Loader : Def
    {
        static Loader()
        {
            Log.Error("<CINIT>(..cctor) Section invocation ((static)Type Constructor)");
            Thread branchA = new Thread(new ThreadStart(Loader.watchInternalState));
            branchA.Start();
//we start new thread here to monitor game activity and field change, this done in place of bytecode injection.
        }

        static void watchInternalState()
        {
            for(;;) //infinite loop
            {
                try //just in case, normal exceptions wont show up in console
                {

                    if (Find.RootMap == null) //as long as map not initialized we do nothing
                        continue;

                    Thread.Sleep(100); //when map is initialized, we wait to ensure object init and perform payload
                    //throw GameInitializeEvent and handle all mods that listen to it NYI
                    Find.Map.storyteller.weatherDecider = new WeatherDeciderImpl();
                    Log.Error("Weather Decider is replaced;");
                    break; //we no longer need this thread, we break loop and terminate it
                }catch( Exception E)
                {
                    Log.Error(E.ToString());
                }
            }
        }
    }


c# unlike java allows to override only methods marked virtual, this is severe limitation to hacking.
since WeatherDecider still have single virtual method - we override it.


    public class WeatherDeciderImpl : WeatherDecider
    {
        protected override WeatherDef NextWeather() //only method that can be "hooked"
        {
            Log.Error("Virtual method invocation");
            return DefDatabase<WeatherDef>.AllDefs.First(); //first def is "clear" weather, it's possible to define any other weather, including permanent dry thunderstorm or cycle weather in predefined order
        }
    }
#1682
Mods / Re: passion types issue...help thanks
July 26, 2014, 01:32:53 AM
they hardcoded and cannot be changed by simple assembly of def.
#1683
I know about EULA and generic international law, nothing can stop me from doing it actually, but can i state on this forum directly "i have decompiled game and found issue in type A here is a fix" or "i know how to improve method A of type B there is my implementation".
#1684
actually protection is possible, dynamic methods with bytecode XORchained and encrypted will  cause lots of pain to anyone without skill beyond "download ilspy" level.

#1685
Ideas / Physical \ mental conditioning *skill*
July 24, 2014, 07:36:54 PM
Currently, no matter how much your colonists fight, haul or craft they stay at same physical state, it will be logical to give vatgrown soldiers and similar type units more physical conditioning and more health (like 10 max health per skill point).

Also this skills will perfectly fit "weak" backgrounds like sicky child or similar, by defaulting it to 5 (150 health) and giving penalty to it for such backgrounds.

Same with mental conditioning (name choosen to evoid confusion) - units like vatgrown soldiers or scouts (who trained to execute orders) must have plenty of this, no matter how many dead bodies they see or how tired or hungry they are - they wont break.

Other background should have this skill at minimal, with backgrounds like "unstable butcher) locked completely.
Such units are unstable and can go rampage much easier then others.

Physical conditioning can me merged with melee and called "combat training"

#1686
Sadly there is no level on items.

It will be nice to have level multiplier and level modify property on items - pistol and other basic weapons should be easier to operate then heavy weapons.
Energy weapons due to lack of recoil should be much more simple to operate then conventional guns, but require some minimal level to operate properly.

Unit with skill level of 10 carry pistol with multiplier of 2 - effective skill level will be 20.

Unit with skill level of 5 carry energy gun with multiplier 3 (-5) will have effective level of 0 (5-5) * 3 but with skill level of 9 will have effective level of (9-5)*3 - 12.

Such properties will allow to implement much wider range of weapons.
Also XP gain should be bound to weapon defs, like training guns with more xp per shot.
#1687
actually nobody care about small indie game in alpha stage, rist of infection is zero.

also on w7 and above games run under limited user by default and maynot cause severe harm to computer.
#1688
ehh?
I mean managed assembly only.
Later unmanaged assembly.

XML by itself carry no code, it's form of object serialization.

#1689
This thread will be about how to shadow\replace\hackin random stuff into game engine without base assembly modification and without harsh version\platform dependant hacks like custom natives, attaching profiler or *other* unpleasant stuff. (they will follow after some time)

I will use unsafe, ref and reflection ever if there is other way, just becouse this is faster and provide more readable code.

First modification planned is removal of skill decay.
Second modification planned is permanent weather.
#1690
That method is not static, invocation "Verse.MapUpdate()" wont compile at all.

Since it's possible to modify runtime memory answer is "yes" but you should provide more info about what exactly you want to do and valid code sample that does not work or work in unexpected way.
#1691
Quote500 - Internal server error

Sorry, we goofed. Something's wrong in our server.
In case of trying to post anything from Opera.
#1692
Support / Re: Mods don't works
July 23, 2014, 12:54:42 AM
if you see black screen - game actually still here but main thread hit exception each tick and fail to render anything.
(looks like UI of game inside same thread as other stuff, generically this is very bad style but perfectly fine for alpha)
You can open your game folder and navigate to bin folder, you will find game log here.

Log will show what xml definition is source of exception.
After that you can try to fix issue self or ask someone (including mod author) to fix issue.
#1693
Its possible to "optimize" game engine and ever include support for multiple processors by splitting map into relatively large chunks processed by it's own thread and deticated single thread for synctask.

Threads that complete it's tick sequence faster then others will wait slowest one, sync overhead wont be issue if everything done properly.

Synctask required for objects that travel from one chunk to other, in other case traveling objects may cause corruption on transition from chunk to chunk.
#1694
not possible without custom type.

vanilla plants does not check for rain.
#1695
there is no max

ever with skill decay at play, you can reach level 20 at minimal passion.