• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

GAF Indie Game Development Thread 2: High Res Work for Low Res Pay

Status
Not open for further replies.
"... Because I can tell you right now, it isn't for the money. [Laughs.]"
Laughs. xD Good read. Thx for posting.


On another news:
Progress is a lil dragging on my end at the moment. Lots of paperwork again...

Paperwork? Sounds interesting and boring at the same time! Sorry, I think I'm just in the extreme excitement that is developing a game and managing to at least have something that looks like a WIP game!

Me, I think I'm almost done with the audio system in my game, and all that is left is to test out whether game and UI sound effects work. Now to think of a good way to tie the sound effects to the relevant items... Thinking of putting the relevant sound clips and calls within the script that does the UI itself and have it route the calls to the audio manager, making good use of the pre-existing connections. (Every button has a function call already, so not much of a stretch to go from there.)
 
Better?

7WJqmTO.gif

yeah that feels better to me!
 
Maths for the most part. Only sux when computing the wrong result. xD

Heh!

Now I've implemented a warp and tested out if my game can handle loading a different scene without losing its marbles.

Apparently, it can't.

I'm thinking it probably has something to do with the player manager in my game. Every other manager can be reinitialized, but the player manager must be kept, and, well, something's wedged (I think I'm probably not restarting the code properly) and the player prefab never shows up, and everything else kind of goofs up.

Seeing as most of the errors were MissingReferenceExceptions, I think it's probably the fact that the player and its associated data never spawns is the problem, no? (Maybe this is a good time to rework the player code so that the data and visual/collision/sound sides are separated.)
 

JeffG

Member
Seeing as most of the errors were MissingReferenceExceptions, I think it's probably the fact that the player and its associated data never spawns is the problem, no? (Maybe this is a good time to rework the player code so that the data and visual/collision/sound sides are separated.)
If your gamemanager has references to gameobjects that are destroyed when you load a new level, you will get that.

You will either have to recreate it or set the object not to destroy on load.


My Game Manager, sets itself to not be destroyed on load. It also finds my main game player and set its not to be destroyed on load.

The Gamemanager also does the load level and after the level is load it updates the position of the player, by finding a blank game object (using it as a spawn point)
 
If your gamemanager has references to gameobjects that are destroyed when you load a new level, you will get that.

You will either have to recreate it or set the object not to destroy on load.


My Game Manager, sets itself to not be destroyed on load. It also finds my main game player and set its not to be destroyed on load.

The Gamemanager also does the load level and after the level is load it updates the position of the player, by finding a blank game object (using it as a spawn point)

OK, here goes...

So, right now, I have a lot of managers in each and every scene, and they should load the appropriate prefabs for the game's use. Most of the managers are there so that links don't break every time something changes during development - pretty much every single one but the one managing the player can be thrown out since they're just loaded fresh and usually has unique variables specific to the scene set (like default music, spawn point, the works), but most of their features are shared due to the nature of the game.

I think I only have to make sure the PlayerManager and the Player prefab (and associated scripts/data) don't suddenly wedge themselves when a new scene is loaded...

Either way, here's the code. (Still haven't split up the spawning code into its own thing... perhaps it's time for that?)

Code:
using UnityEngine;
using System.Collections;

public class PlayerManager : MonoBehaviour {
    private static PlayerManager manager = null;

    public GameObject player;
    
    public float defaultX = 0;
    public float defaultY = 0;

    public bool playerExists = false;
    public bool noEncounterZone = false;

    public static PlayerManager Manager
    {
        get { return manager; }
    }


	void Awake()
    {
        GetThisManager();
    }

    void GetThisManager()
    {
        if (manager != null && manager != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            manager = this;

            Vector3 position = new Vector3(defaultX, defaultY, 0);
            player = (GameObject)Instantiate(player, position, Quaternion.identity);
        }
        DontDestroyOnLoad(this.gameObject);
    }

    public void PlayerExists()
    {
        playerExists = true;
    }

    void Update()
    {
        
    }
}

Help would be appreciated! :) (also, I don't know how to make good use of the "I exist!" code. Would that be relevant?)
 
OK, here goes...

So, right now, I have a lot of managers in each and every scene, and they should load the appropriate prefabs for the game's use. Most of the managers are there so that links don't break every time something changes during development - pretty much every single one but the one managing the player can be thrown out since they're just loaded fresh and usually has unique variables specific to the scene set (like default music, spawn point, the works), but most of their features are shared due to the nature of the game.

I think I only have to make sure the PlayerManager and the Player prefab (and associated scripts/data) don't suddenly wedge themselves when a new scene is loaded...

Either way, here's the code. (Still haven't split up the spawning code into its own thing... perhaps it's time for that?)

Code:
using UnityEngine;
using System.Collections;

public class PlayerManager : MonoBehaviour {
    private static PlayerManager manager = null;

    public GameObject player;
    
    public float defaultX = 0;
    public float defaultY = 0;

    public bool playerExists = false;
    public bool noEncounterZone = false;

    public static PlayerManager Manager
    {
        get { return manager; }
    }


	void Awake()
    {
        GetThisManager();
    }

    void GetThisManager()
    {
        if (manager != null && manager != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            manager = this;

            Vector3 position = new Vector3(defaultX, defaultY, 0);
            player = (GameObject)Instantiate(player, position, Quaternion.identity);
        }
        DontDestroyOnLoad(this.gameObject);
    }

    public void PlayerExists()
    {
        playerExists = true;
    }

    void Update()
    {
        
    }
}

Help would be appreciated! :) (also, I don't know how to make good use of the "I exist!" code. Would that be relevant?)

Assuming "player" is your reference to the prefab, you are overwriting the reference with the new instantiated player when you create it. Make two variables, one for your prefab, and one for your instance. Not sure if this is the only error, but it certainly seems like a biggy to me :p

Sorry, can't elaborate on it any more right now, but maybe someone else can if you need any help!
 
Assuming "player" is your reference to the prefab, you are overwriting the reference with the new instantiated player when you create it. Make two variables, one for your prefab, and one for your instance. Not sure if this is the only error, but it certainly seems like a biggy to me :p

Sorry, can't elaborate on it any more right now, but maybe someone else can if you need any help!

Should I also do the same (prefab and instance use separate variables) thing on all other managers?

Also, I was wondering if I could clean up the manager code, too.

No worries, someone else can probably elaborate! After all, I guess everyone have their "moments" sometimes!
 

JeffG

Member
Should I also do the same (prefab and instance use separate variables) thing on all other managers?
They are different things, so yea should be in two variables. One is a pointer the the prefab and after the Instantiate call, it points to the version of the object that is "live" in the scene.


You could also

Create Blank Game Object (Call it PlayerManager)
Attach PlayerManager Script to this object

Drag prefab to this object and remove the Instantiate call.


Note: I personally try to avoid Instantiate. My main player is set as above. Enemies/Other objects are created using some kind of pool manager (I use PoolBoss right now)
 
They are different things, so yea should be in two variables. One is a pointer the the prefab and after the Instantiate call, it points to the version of the object that is "live" in the scene.


You could also

Create Blank Game Object (Call it PlayerManager)
Attach PlayerManager Script to this object

Drag prefab to this object and remove the Instantiate call.


Note: I personally try to avoid Instantiate. My main player is set as above. Enemies/Other objects are created using some kind of pool manager (I use PoolBoss right now)

All right, so I guess I might need to rewrite some portions of my manager code.

The second method sounds... weird to me. I guess I'll just keep on using the thing that works for me...

In the meantime, while my scripts are wedged, I thought I might as well as start drawing a town map. Think of it as the "first" town, and it's still missing a lot of tiles. I'm thinking of a basic layout for the first town, and after that, maybe it's time to implement local warps and NPCs.


Also in store: one of the character's partial sprite sheet. It's missing "hurt", "low HP", "KO'd" sprites for now, and I believe that it probably might end up being used for some more specific situations that need more sprites. (Wanna guess what the style is inspired from? :p)


Click "View Original" to view the PNG files; oh, and did I mention that they might update? The URL's should always point to the latest version of the file while I update.

(Hmm... is there a way to tell Unity to treat a single-sprite as a valid animation? Some of the sprites have to be duplicated because otherwise it doesn't recognize it as an animation clip when I create anims.)
 

TheKroge

Neo Member
Here's some screenshots and concept art for my game... It's almost done just trying to spruce it up! It's a multiplayer online 4x/grand strategy game.

3Bf13bI.jpg


NOVbWm5.jpg


And some concept art. Let me know what you think!

InAZ8cG.jpg


BiM7nLz.jpg
 

Exuro

Member
Anyone know of a good tutorial on xml(I'm using unity) for storing/loading? I've gone through a few on youtube but they're pretty simple and mostly cover single "items" where the item has the exact same attributes/elements and I'm going to have several different block subclasses that have different attributes/elements all under a level. Also not sure how i'd set up the hierarchy, like there's the level with its name, id, whatever, and in level are various block types with their various attributes/elements. Any suggestions would be great.
 

JeffG

Member
Anyone know of a good tutorial on xml(I'm using unity) for storing/loading? I've gone through a few on youtube but they're pretty simple and mostly cover single "items" where the item has the exact same attributes/elements and I'm going to have several different block subclasses that have different attributes/elements all under a level. Also not sure how i'd set up the hierarchy, like there's the level with its name, id, whatever, and in level are various block types with their various attributes/elements. Any suggestions would be great.

Just create your .Net objects and use them as you normally would.


to load

Code:
 <insert.Net Object Type in here> _myObject = new <insert.Net Object Type in here>();


using (StreamReader reader = new StreamReader(fileName))
{
                _myObject = (<insert.Net Object Type in here> )XMLUtil.FromXml(reader.ReadToEnd(), typeof(  <insert .Net Object Type in here>  );
}

to save
Code:
try
        {
            using (StreamWriter writer = new StreamWriter(fileName))
            {
                writer.Write(XMLUtil.ToXml(_myObject, typeof(<insert.Net Object Type in here>)));
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

Utility

Code:
using System;
using System.Text;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Xml;
using System.IO;

    public class XMLUtil
    {

        //This will returns the set of included namespaces for the serializer.
        public static XmlSerializerNamespaces GetNamespaces()
        {

            XmlSerializerNamespaces ns;
            ns = new XmlSerializerNamespaces();
            //ns.Add("xs", "http://www.w3.org/2001/XMLSchema");
            //ns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
            return ns;

        }

        //Returns the target namespace for the serializer.
        public static string TargetNamespace
        {
            get
            {
                return ""; /* @"http://www.w3.org/2001/XMLSchema"; */
            }
        }
        public static object FromXml(string Xml, System.Type ObjType)
        {

            XmlSerializer ser;
            ser = new XmlSerializer(ObjType);
            StringReader stringReader;
            stringReader = new StringReader(Xml);
            XmlTextReader xmlReader;
            xmlReader = new XmlTextReader(stringReader);
            object obj;
            obj = ser.Deserialize(xmlReader);
            xmlReader.Close();
            stringReader.Close();
            return obj;

        }

        public static string ToXml(object Obj, System.Type ObjType)
        {

            XmlSerializer ser;
            ser = new XmlSerializer(ObjType, TargetNamespace);
            MemoryStream memStream;
            memStream = new MemoryStream();
            XmlTextWriter xmlWriter;
            xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);
            xmlWriter.Namespaces = true;
            ser.Serialize(xmlWriter, Obj, GetNamespaces());
            xmlWriter.Close();
            memStream.Close();
            string xml;
            xml = Encoding.UTF8.GetString(memStream.GetBuffer());
            xml = xml.Substring(xml.IndexOf(Convert.ToChar(60)));
            xml = xml.Substring(0, (xml.LastIndexOf(Convert.ToChar(62)) + 1));
            return xml;

        }
    }
 

TheKroge

Neo Member
At the risk of being 'that guy' - *tips fedora* - she seems to have made a fairly inappropriate choice of ensemble for what appears to be a cold and heavily industrial / polluted environment.

There is a backstory to it.. it's lengthy but the short of it is that earth is barely able to sustain life at this point, and humans frequently travel to the desert-like parts of the planet, 90% of land between the poles, for supplies and bring them back to the poles where they are currently stationed. The figure in the concept art has just arrived back to the pole after being in the heat of the desert, and is momentarily stuck in a "thousand yard stare" when she is reminded that her homeworld is destroyed. The cold is barely on her mind.
 
Hey everyone! It's been a long time coming but I can finally share the debut trailer for Beacon! We're bringing it to Xbox One, PC & Mac!

https://www.youtube.com/watch?v=f2loCODrm6Q


I'm super proud of the team for all the hard work we've put in over the last month to make this happen. I hope you enjoy it!

We're currently sending out a big press release to all the sites, so hopefully it will gain some traction over the course of the day.

I'm not allowed to make my own thread on GAF, so I'm hoping someone likes it enough to make one! :)

We'll be showing at the Unity booth next week, so come along if you would like to play the game!
 
Hey everyone! It's been a long time coming but I can finally share the debut trailer for Beacon! We're bringing it to Xbox One, PC & Mac!

https://www.youtube.com/watch?v=f2loCODrm6Q

It looks really good! Grats to you all and I hope everything goes well! When are you planning on releasing?


We'll be showing at the Unity booth next week, so come along if you would like to play the game!

You have to end the "Unity is shit" threads, this is your destiny! :p
 
You have to end the "Unity is shit" threads, this is your destiny! :p

Heh?

Speaking of which, I wonder if there's scope for performance optimization in the future for my project. For now, I guess I'll take care of the town...

...after I reinstall and restore my desktop. Something happened that made it refuse to boot. It seems like the OS files decided to go AWOL for some reason. At least my personal data appears to be intact, so it's just a "thing" of reinstalling all the things and changing a few settings to play nice with how I work. After all, the important bit is probably the data, no? Irreplaceable data.

Given knowledge of a map's size (in Unity units which happen to correspond to 1 unit = 16 tile pixels = 1 tile), and the current display resolution relative to 320x240, can one program a 2D camera so that it never shows out-of-bounds areas?
 
I'm trying to get over a paradigm shift in moving from GameMaker to Unity. I haven't figured out the best way to set up draw calls beyond the humble SpriteRenderer and GUI commands, neither of which appreciably suit my needs. There doesn't seem to be a direct way to set up draw calls, and my Google Fu is telling me to instantiate tons of new game objects which seems bad (especially in light of all the optimization woes which Unity devs are getting heckled over recently).

So my question is what's the most efficient way to do this? I have a texture designed to be broken into a 4x4 grid and tiled across indefinite spans. I also have edge textures which are designed to nicely wrap what would otherwise be harsh edges of the texture, as shown below with the columns.

kLmUfr8.png


2czR7Dp.png


Ideally in the scene editor I would be able to use a single game object per rectangular span, and then during runtime call a few for-loops to iterate through the size of the span (as specified by the transform scale) to draw appropriate slices of the textures, but I can't find an appropriate function to do that drawing. So should I instead be spawning several several game objects? Is that not going to introduce a lot of overhead and be wasteful with draw calls?

It seems like a bad plan to me, but maybe that's just because I haven't been using Unity long enough to get a good feel for the strengths and weaknesses and whatnot.
 

Jumplion

Member
Hey everyone! It's been a long time coming but I can finally share the debut trailer for Beacon! We're bringing it to Xbox One, PC & Mac!

https://www.youtube.com/watch?v=f2loCODrm6Q


I'm super proud of the team for all the hard work we've put in over the last month to make this happen. I hope you enjoy it!

We're currently sending out a big press release to all the sites, so hopefully it will gain some traction over the course of the day.

I'm not allowed to make my own thread on GAF, so I'm hoping someone likes it enough to make one! :)

We'll be showing at the Unity booth next week, so come along if you would like to play the game!

Look at what I found~

Best of luck to your game! I'd check it out if I could, but I'll just have to settle for picking it up when I can.
 
So should I instead be spawning several several game objects? Is that not going to introduce a lot of overhead and be wasteful with draw calls?

If you assign packing tags to your sprites, the sprite packer will automatically combine them into texture atlases (see the Sprite Packer window). Unity batches similar materials and sprites into one draw call. Click the stats tab in the game window to see the amount of draw calls.

As for game objects, the important thing is that you avoid instantiating/destroying at runtime as much as possible (shake the nearest tree and pick one of the object pool implementations), and take out all the Update methods you don't need. Simple GameObjects don't have that much overhead.

There's some upcoming 2D stuff on the Unity roadmap that could be useful to you, such as smart sprites, though those features have been postponed because of workflow/UI issues. Another option would be to write a custom shader to tile the sprite textures.
 

Right now (IIRC), Unity's tilemap feature is in Alpha so it's not publicly available. For the moment, you might want to look at batching your sprites.

(Also check this link out too

Personally, for all my 2D stuff I use a plugin caled 2D Toolkit. It's a fantastic plugin that has about 3-4 years worth of development behind it (And I believe it is still being updated) and is well worth the cost! ($75). On top of that, the forums have a lot of good info from various people's questions, and if you encounter something new the developers are fairly active with their support and get back to you normally within a week.

Oh, and it has tilemap features, collider definitions, sprite batchers etc. It's a fairly popular plugin so you'll find that quite a few other plugins have functionality that can be cross compatible too.

Hope that helps :)
 
If you assign packing tags to your sprites, the sprite packer will automatically combine them into texture atlases (see the Sprite Packer window). Unity batches similar materials and sprites into one draw call. Click the stats tab in the game window to see the amount of draw calls.

As for game objects, the important thing is that you avoid instantiating/destroying at runtime as much as possible (shake the nearest tree and pick one of the object pool implementations), and take out all the Update methods you don't need. Simple GameObjects don't have that much overhead.

There's some upcoming 2D stuff on the Unity roadmap that could be useful to you, such as smart sprites, though those features have been postponed because of workflow/UI issues. Another option would be to write a custom shader to tile the sprite textures.

Oh, wow, that smart sprite looks really useful. I'd have to go about asset creation slightly differently, but it'd still be pretty handy.

Is the instantiating at runtime concern one of constant instantiation? IE am I going to run into trouble or not get the batching if I instantiate a bunch of stuff in the awake function? I'm trying to pare down my workflow, and it'd be a lot easier to click and drag larger rectangles of wall instead of hand-place each sprite tile.

Right now (IIRC), Unity's tilemap feature is in Alpha so it's not publicly available. For the moment, you might want to look at batching your sprites.

(Also check this link out too

Personally, for all my 2D stuff I use a plugin caled 2D Toolkit. It's a fantastic plugin that has about 3-4 years worth of development behind it (And I believe it is still being updated) and is well worth the cost! ($75). On top of that, the forums have a lot of good info from various people's questions, and if you encounter something new the developers are fairly active with their support and get back to you normally within a week.

Oh, and it has tilemap features, collider definitions, sprite batchers etc. It's a fairly popular plugin so you'll find that quite a few other plugins have functionality that can be cross compatible too.

Hope that helps :)

That helps a lot. I'm going to have to take a while to go through all that and decide if 2DTK is for me. I have no doubt it's good, but I want to figure out if it will be useful for my purposes.

Thanks again!
 
Is the instantiating at runtime concern one of constant instantiation? IE am I going to run into trouble or not get the batching if I instantiate a bunch of stuff in the awake function? I'm trying to pare down my workflow, and it'd be a lot easier to click and drag larger rectangles of wall instead of hand-place each sprite tile.

Instantiating a bunch at the start of a level is perfectly fine if your prefabs are set up correctly. It's the constant creating/destroying that Unity is not comfortable with.
 

RazMaTaz

Banned
Monster Hunter in modern day?

I like the billboard details.

Thanks :)

And sort of like Monster Hunter meets Devil May Cry meets another bunch of games. Trying to make this game as fun as possible, but it isnt that far off from completion, well, atleast for PC that is. Android and IOS is a whole new ball game.
 
Instantiating a bunch at the start of a level is perfectly fine if your prefabs are set up correctly. It's the constant creating/destroying that Unity is not comfortable with.
This really depends on its footprint. Most 2D stuff won't cause a fuss. I've done extensive testing since half of my damn game blows up and shit flies everywhere. You can instantiate and destroy stuff without issues as long as you're not doing it a zilliom times per frame or creating/getting rid of huge chunks in a single frame. Complexity/footprint matters here. 2D games aren't going to hit the same levels of performance issues as large 3D games.

I still pool, but certainly not everything because I haven't needed to.

The best way to be sure? Do some tests and find out what works for your game. Not doing something because someone says so without you testing it, even if good practice, will lead to missed opportunities and one-off unrelated solutions.
 
Sort of a side note, but as a new user to Unity and presumably using an engine version higher than 4.3, I'd recommend not using the GUI commands or OnGui() triggers - they're basically deprecated in favour of using Unityengine.UI and Canvas commands

I'll keep that in mind. Thanks!
 
quick screenshot of what I'm working on with a friend :) used to be completely 2D, so we've kinda rebuilt it from the ground up to move to 3D (really helps the gameplay now that we're treating a lot of it more like a simulation).

Unity%202016-03-09%2011-10-25-73.png
 
This really depends on its footprint. Most 2D stuff won't cause a fuss. I've done extensive testing since half of my damn game blows up and shit flies everywhere. You can instantiate and destroy stuff without issues as long as you're not doing it a zilliom times per frame or creating/getting rid of huge chunks in a single frame. Complexity/footprint matters here. 2D games aren't going to hit the same levels of performance issues as large 3D games.

I still pool, but certainly not everything because I haven't needed to.

Yeah, sure. I may be a little paranoid because I've been working with mobile devices that are still annoyingly low-powered and fillrate-limited (and Unity is not the fastest thing around), and I've had to optimize and precache and pool the crap out of our stuff to minimize hitching.
 
Yeah, sure. I may be a little paranoid because I've been working with mobile devices that are still annoyingly low-powered and fillrate-limited (and Unity is not the fastest thing around), and I've had to optimize and precache and pool the crap out of our stuff to minimize hitching.
Oh for sure. I pooled to the moon and back for our mobile game. Maybe it's just me being lax with PC/Console development but there's enough grunt there to overshoot any target we have for 2D.

Pooling is great practice but if you can get away without doing it then it's no real problem. Most of the stuff I instantiate doesn't get destroyed so wether I create the pool ahead of time or not has no real impact. If I got rid of objects all the time I would definitely pool, I think the GC is the largest hit to performance in Unity. Wiping a metric ton of objects at once is no bueno. A few here and there hasn't done much, if anything, I've noticed.

For our explosions I just instantiate all of our pixels in split frames. There's a few that do "die" to keep the gibs cleaner looking and those that do get shoved in an array and used on the next pixel explosion. I think the most I can get away with in a single frame of instantiation is about 400ish on PS4 before seeing a frame drop - that's also with operations being performed on each pixel when they are created, to boot. Which is obnoxious looking anyhow if I double that across two frames.

Instantiation is less of a hit than GC, at least in what I've tried. I'm less afraid of putting a new object in scene, tbh.
 

LordRaptor

Member
As we're discussing them, I can post my super-generic object pooling script if anyone would find that helpful?
Its basically a singleton pool manager that can add anything you want to a dictionary of pooled objects and supports both 'lazy' and 'strict' pooling (lazy being if you ask for an object it will always give you one, strict being if the pools empty you wont get a new object)
 

TheKroge

Neo Member
Finally got the Linux/SteamOS version up.



So it's space and planet?


Yeah, you have huge star fleets that you use for battle, exploration, transportation, etc, and in order to overtake the army of a planet to conquer it, you have to drop down and fight them face to face. I like it better than just some simulated numbers... It's fun to watch a whole troop to get bloodied and disintegrated :)
 
As we're discussing them, I can post my super-generic object pooling script if anyone would find that helpful?
Its basically a singleton pool manager that can add anything you want to a dictionary of pooled objects and supports both 'lazy' and 'strict' pooling (lazy being if you ask for an object it will always give you one, strict being if the pools empty you wont get a new object)
Make one where the end user has to buy more credits to get more objects!
 
Something wedged big time with the filesystem, and I had to wipe and reinstall, after getting most of my personal data out of the drive.

Most of everything is intact, but one thing that reared its ugly head is the UI script has gone AWOL. Oh well, not that it's hard to rewrite it, seeing as it had barely any function. Now to fill in the blanks and see if somehow the project is now in an inconsistent state.
 

LordRaptor

Member
Make one where the end user has to buy more credits to get more objects!

Ironically, as the game I'm working on is a management sim type title, thats basically my high level game design - the more money a player has spent the more crap will be going on on screen, heh
 
So, right now, the way player data is stored is like this:

PlayerManager > Player's prefab > PlayerScript > Stats

I'm thinking of doing some changes so that it's more like this:

GameManager finds a PlayerManager and/or vice versa > Player prefabs + a GeneralPlayerData (steps, time, gold, inventory, stuff like that) > Their corresponding PlayerScripts > DerievedStats > Stats

Would this be enough of a change to make the game able to handle more than one player character cleanly, as well as making stats easier to get for UI and calculations?
 

Vanguard

Member
Testing out gameplay, decided to throw more than I would enemies in because, well might be nice later on.
Hmm, this is being weird, maybe I should profile it.

Lawd that's a lot of garbage you got there. Oh right, GetCompontentFast... I should probably replace that with the newly re-written event system.
Oh yeah! Most of it gone now, though while I'm here let's try and get rid of that remaining garbage... cause the amount we're gonna shoot in this game, this could be better!

Hmm, can't see why it's generating garbage... Time to peek at some IL!!

IL_0071: box NEEDZero.DamageEvent

Oh... you... *****

I can fix this! I just need to generic the Invoke method so that it will constrain the struct and solve the box. Done!
Why is it generating more garbage now... Not doing it on the invoke anymore, how about inside the invoke...

IL_002e: box !!T

Oh yeah, the delegate invoke. I forgot about that.

So now thinking about changing the event structs to classes, and caching the instance for the event so the GC can FO. In some cases it's also faster than structs, but depends on the size of the struct of course.
Which then brings on the whole issue of immutability, which is nice because I've written some bizzare stuff at times and don't want to edit the class on an event receiver. So far I'm looking at maybe constructing it with the instance it's made in, and then comparing that on an update method so that only the parent instance can update it.
I do not trust 2am me.

I just needed to vent / spout / rant my internal monologue. Carry on.
 

Roubjon

Member
Our game Olympia Rising will be out on the Wii U sometime in April. I'm not expecting much from it, but it'll be really cool to be able to play it on a console. Maybe some random kid will love it.
 
Status
Not open for further replies.
Top Bottom