TheHollowNight
Member
Working on a store type thing for my game. Instead of having a traditional store I'm thinking about making 80's/90's style magazine type ads
I am super into this
Working on a store type thing for my game. Instead of having a traditional store I'm thinking about making 80's/90's style magazine type ads
Once you remove inheritance from MonoBehavior, you wont be able to attach the file as a script to your gameobjects anymore. Instead, you will want to make instances of the class within the relevant scripts that you do attach.
Check here for more information on how to make instances of Classes in C#
C# isn't my strongest language (I'm much more comfortable in C++) but classes can be a tricky thing to get your head around if you haven't encountered them before. If there's anything you don't understand, feel free to give me a shout
If you're serious about localization, YUP.PSA: don't put subtitles directly in your movies, keep the subtitles apart so you can localize them later.
Getting close to finishing the alternate ending and last battle of the game, time to add some twists to the story:
Well, we're finally live with Into the Stars on Steam & GoG - It has been a CRAZY couple years and I just wanted to thank Indie GAF for the sane voices of support and encouragement!
Launch Trailer
Website
Our first review is in and we can't wait to see what the rest of the day brings...
Sorry for going to this thread and asking even more questions as I work with my game! Seeing as this kind of "I always wanted to do this" project is quite different from what I've handled during my CompSci course... (mostly to do with the larger scope, and different requirements)
Once I'm done with the world map, I think I'd like to be able to effortlessly reuse the code for the player handling (for gameplay) camera, and the UI. All are already prefabs, but right now they're also separate Unity prefabs. If I instate them in a new scene for a new map, the links will break. Is there a way to reduce my work even further by making sure the Unity editor somehow "knows" that they all should be automatically linked together, in any method you know of? (Maybe it involves an "everything of the above" prefab?)
Also, how would you handle event flags for quest/game progress in a JRPG?
(Also would be nice is a way to keep the important data in memory while the game changes the scene, be it to another map or to a battle... DontDestroyOnLoad seems to be the ticket. Just want to make sure I'm not doing things wrong.)
if(MyPlayerReference == null)
{
MyPlayerReference = PlayerManager.Instance.MyPlayer;
MyPlayerReference.DoSomething();
}
if(MyPlayerReference == null)
{
MyPlayerReference = PlayerManager.Instance.MyPlayer;
if(MyPlayerReference != null)
{
MyPlayerReference.DoSomething();
}
}
I think you're coming to the point where you need to start thinking about Managers.
What I'm assuming you have at the moment, is a scene where you have manually dragged the prefabs in, attached scripts, linked these scripts up yourself and then hit "play". If that is the case, then unfortunately this isn't going to cut it for the rest of the project
One of the things that can be a bit bewildering with Unity is trying to figure out how different game objects interact with each other. How does one object (script) "know" about another? This is where managers come into play.
(This is going be a very basic example, so sorry if it doesn't apply directly to your project. Also sorry if this is stuff you already know about!).
So let's take a look at a "Player Manager". The PM is a class that should be responsible for creating the player, destroying the player and providing a reference to the player to any other class that needs it. This means that (ideally) you want to make a single instance of your PM, and have it be accessible by any other class that may need to access information about the player. (You might want to look up "Singletons" in unity for an example of how to make a class like this). Oh, and yes, we would probably want to make this class "don't destroy on load" or whatever that function is called We want it to persist between scenes.
But how should the PM actually make a player? I'd say the most sensible way would be to have a public method named something like "CreatePlayer()". The reason we would want to do this is because then we have more direct control over when the player is created. Since the PM is going to persist over all our scenes, we can't rely on its "start" or "awake" functions to do this. What would be more sensible is to have a unique script for each "level", that calls the "CreatePlayer()" method in the Player Manager when the level starts. (Apologies for the platform game example here, but hopefully you'll be able to adapt it to your own game)
Now, the "CreatePlayer()" method would have to maintain a reference to the player that it instantiates. This is pretty simple, you just do something like "GameObject MyPlayer = Instantiate(PlayerPrefab) as GameObject" (Can't remember the exact syntax, sorry!). Then, in any other class (such as the UI), when we needed to know information about the player (like health) we can do something like "PlayerManager.Instance.MyPlayer" in order to grab the player, and then we can use GetComponent to get the player script which would likely be holding all of it's data.
So know we've got an overview of what it does, let's talk about how you can use this to avoid setting up all the links in your prefabs. To put it quite simply, you just need to set those links via code. Again, I don't know what you're doing, but I assume you have something like a reference to your player in your camera, that you have dragged in via the editor. Well, that's pretty simple! In your camera's Update function, check if the reference to the player is NULL, and if it is, then get the player from the player manager! This way you can ensure that your camera will start "knowing about" the player as soon as the player is spawned, even if you aren't going to spawn your player for 30 seconds after the scene starts!
Now, one thing that you absolutely, 100% need to be aware of, is that when you use systems like these, you must always check that your references are valid before attempting to call any methods on them!
For example, if above in our camera we simply went:
Code:if(MyPlayerReference == null) { MyPlayerReference = PlayerManager.Instance.MyPlayer; MyPlayerReference.DoSomething(); }
This would more likely than not crash. This is because we didn't check whether the player manager actually gave us back a valid reference or not. A simple way to fix this would be:
Code:if(MyPlayerReference == null) { MyPlayerReference = PlayerManager.Instance.MyPlayer; if(MyPlayerReference != null) { MyPlayerReference.DoSomething(); } }
That is a much safer way to do it, as you ensure that the player is valid before you call a method on it. Basically, whenever you need to grab a reference to something from a manager, you need to do a check like this before you do anything with that reference.
(Just make sure whenever you delete/destroy the player, you set the PlayerManager's reference to the player to be null, otherwise you run the risk of passing back a junk reference that won't be picked up by these safety checks.)
Phew, that was a bit of a long one... Anyway, I hope that has helped and not compounded your confusion Let me know if you need anything else!
Hmm, to see if I get it:
Create a PlayerManager class that will persist across different scenes, and it should handle the instantiation of the Player prefab.
So, if I'm not getting things wrong, I should create a new GameObject containing just the PlayerManager script thingy, and let it create the Player when the time is right?
As for the camera and the UI, I guess they only need to have their scripts updated to keep checking if the Player eventually gets created, then grab that instance? And they also have to find a PlayerManager first?
Sorry for all the questions, but yeah, this thing's scope a lot bigger than any projects I've done in uni, AND I'm doing it alone.
Just FYI, theres a Unity game manager code snippet linked in the OP
Yep, that's pretty much it. In theory the camera and UI shouldn't have to "find" the PlayerManager, as it should be a global static instance. This means it can be accessed from anywhere within the project. (Note that isn't necessarily the best way to do it, but it probably is the simplest)
I have a logic class that handles stuff like this so I can query if the player is alive, dead, his position, his object, etc. This way I don't need to constantly find the player with multiple objects - when I need to I just look at my GameLogic to find out where to aim, where he's standing, the closest respawn point in relation to the player, etc. At the end of every frame I update pertinent player information from the player's controller to the game's logic. I also use it to initialize on state change, new game, etc. Basically an overall manager. Other classes update and initialize various variables in the logic class on a need to basis.Yep, that's pretty much it. In theory the camera and UI shouldn't have to "find" the PlayerManager, as it should be a global static instance. This means it can be accessed from anywhere within the project. (Note that isn't necessarily the best way to do it, but it probably is the simplest)
All right, will see if I can adapt it to my needs.
Mmm hmm. One more thing: the functions that the PlayerScript originally did probably should go somewhere else.
I'm thinking of something like below...
PlayerManager creates and keeps the Player prefab
Player prefab contains the PlayerScript for gameplay use
Camera and UI finds the PlayerManager static object, waits until the Player shows up, then grabs the instance and do things.
Should I leave the PlayerScript as is, or should I move the non-data code out of it, or move everything out of it?
I tend to just have an empty gameobject called "managers" in my initial scene and any manager scripts that I need I just attach them all to that gameobject - although thats for games where the fundamental things being managed don't actually change; UI, score, player values, etc.
for a game where, I dunno, in level 1 its an on foot platformer, level 2 is a racing game or whatever, that might not be the best way
Seems like you're almost there now!
Your playerscript should handle everything about how the player actually functions within the game. For example, things like Movement, attacking, receiving damage, triggering animations. That kind of stuff.
As a rule of thumb, if it affects your player directly, then it should be done in the player script. As a little example, here's a potential flow for how an enemy may attack.(Again, maybe not 100% relevant to your project)
- The enemy gets the reference to the player from the PM
- The enemy calculates the distance between it and the player
- The resulting ditance is within range, so the enemy calls an "Apply Damage" function on thePlayerscript, and passes in a value of 100
- The Playerscript, within it's ApplyDamage, does calculations based on the stats/gear currently equipped
- The playerscript then decreases its health by the appropriate value
So in that example we can see how the different scripts (enemy and player) have different responsibilities. Enemy does all the distance calculations, Player does the resulting damage calculation.
Hope that makes it a bit clearer
I'm quite fond of management being done this way. Its a single class that can be accessed by anything in the game. If you don't abuse them they work very well, IMO.
if(g_PlayerManager->GetPlayer())
{
if(g_PlayerManager->GetPlayer()->GetPlayerState() == ePlayerState_Dead)
{
//DoStuff. Reset level and shizzle.
}
}
Ah! Since it's a turn-based console-style RPG, the battles take place on an entirely different scene. I still haven't gotten the battle code in at all yet - no battle code at all! Right now, I do have functional movement and UI code for the most part. Gotta fix the loading sloppiness, non-functional Exit Game, and... testing out warps and interactable objects.
(Oh, and it also has a working "loop the world map" code without visual issues, and a working stat/level formula.)
Oh I agree with this and do the same, only info that may be used more than a few times per scene makes it to the logic class. I have separate classes for save game handling, menu systems (platform specific), game settings, control settings, etc.It's means to an end really. The underlying functionality is the same, it's just abstracted to different levels. However, I'm of the opposite opinion when it comes to management. I like to separate everything up as much as possible. The main reason for this is organisation.
If, for example, we put all of the various manager operations into a single global for the stuff I do at work, that file would probably end up being tens of thousands of lines long. Probably hundred thousands actually...It'd make me want to shoot myself in the face
The other advantage (IMO) of separating everything out as much as possible means that it's harder to make silly mistakes (Like accidentally calling the wrong function or setting the wrong value) as you need to be a fair bit more explicit in what you're actually doing in order to get results.
But really, in terms of execution the difference is just a few function calls. Like, if I was querying whether the player was alive or not, I'd do something like this:
Code:if(g_PlayerManager->GetPlayer()) { if(g_PlayerManager->GetPlayer()->GetPlayerState() == ePlayerState_Dead) { //DoStuff. Reset level and shizzle. } }
But as I said, just means to an end really!
Cool, keep at it! And don't be disheartened when you inevitably have to rewrite a massive section. It happens to everyone
Not much to show for today. Still have a lot of work and ideas to go through before getting where I want.
Changed my data structure handling movement into a Dictionary so I can do things more easily later on. Took a bit longer that I thought it would but having a position based key makes it really nice for accessing platforms. I've been trying to come up with cool puzzle ideas that rely on camera rotation. So far "escher platforms" and "stationary platforms"(where you rotate and the platforms stay in the exact same position with respect of the camera) are the main ones I've come up with. Once I get both of those fully working then I want to put in some moving platforms as well as obstacles that you'll have to time and move around. Need to give reason for single block movement.
And here we have the blood effect in action:
Oh I agree with this and do the same, only info that may be used more than a few times per scene makes it to the logic class. I have separate classes for save game handling, menu systems (platform specific), game settings, control settings, etc.
Also, right now I'm using Box2D-based movement by applying force. It does work well enough with some tweaking (disabling unwanted gravity and making it almost start and stop on a dime), but I was thinking if I could do better by making it truly start/stop movement. Doesn't have to be fixed to a grid, mind you - my intent is to allow free analogue movement where possible. (The mapping tool I use, Tiled + Tiled2Unity automatically generates appropriate collision, layers, and animations, so I'm set on mapping.)
Just to be sure, for my needs, I probably only need one static manager class for now, no? And it'll just "work" if I prefab the GameObject having the script for said manager? (And just asking, should the camer and UI canvas be also prefabs?)
http://gfycat.com/TotalMildEyelashpitviper
-VISCERAL beat'em all action with new low stance animations and a movement speed that's way too fast because I forgot I had set Honey to have 150+ speed (fat chance of that ever happening in game, though you're very welcome to try)
(this bulletpoint list in reference to the "how to contact games media" post from earlier, which is obviously something I'm working on in parallel - what, you mean to say that's not how we should do it?)
Love the look, but the ribbon on the weapon being red kinda distracts and masks the blood effects.
Oh man, that crouch/hop! Looking nice!
Btw, I may have missed that post from before, was it in this thread? And do you happen to have a link handy?
Thanks!
And no, I meant someone asked how to properly contact games media earlier... not sure there's any definite good answer about that, the only good reference I have on the topic is the one everyone has probably seen already: http://www.pixelprospector.com/how-to-contact-press/
Kinda dreading the whole process, myself, but everyone needs to go through the wringer at some point. That's why I appreciate the lengths to which people like timetokill right here are willing to go to try out and give feedback/exposure. I feel we all need every bit of help we can get with coverage, especially if/when we can't get to indie gatherings and conventions (take me, being in France and living off basically what I need to make it through each month, it's absolutely not something I can even remotely consider)... so I sincerely thank people who go out of their way to do so!
For your manager class, on player instantiate have it update the manager to let it know it exists. You don't need the manager to look for the player (I try to avoid subscriptions whenever possible).Stuffed in the generic manager code from the linked post in the OP.
Now that I have a PlayerManager, well, I guess I'll have to put code somewhere in it so that once it asserts its existence and confirms that it's the only one out there, get a Player prefab out there, and initialize if needed?
Also would be good to answer to.
(Man, I really am "fresh" with Unity.)
Thanks for the info! The guys that made CrashLands did an AMA on reddit a little while ago, which had some useful tips. I asked them about their marketing stragegy, and one of the things they did was make their emails "sassy"...not really sure what they meant by that but it worked
I think your game definitely has potential to get good coverage, just as long as it gets in-front of the right eyes! I'm very, very early on the "promotion" road myself, but I'm also dreading having to take the plunge and fire my screenshots/videos out to as many people as possible
And now it's my turn to have critical eyes cast upon me!
Have this booked to read this evening thanks to you and Pehesse!So... this is kind of a really long read (it took me about an hour), but it's really interesting. It's a candid interview with Rebecca Heineman (who's been in the industry for 30+ years) about the harsh realities of game development both AAA and indie. Of particular interest is a sobering discussion regarding the theoretical limit of indie game marketshare and the ensuing race to the bottom, but really the whole thing is worth reading.
http://www.nodontdie.com/rebecca-heineman/
Thanks to Pehesse for linking to it on Twitter last night!
A quick tip is don't be afraid to adjust the hue as you shade and highlight things. Something looking colorful is more about diverse hues than it is about high saturation.
So... this is kind of a really long read (it took me about an hour), but it's really interesting. It's a candid interview with Rebecca Heineman (who's been in the industry for 30+ years) about the harsh realities of game development both AAA and indie. Of particular interest is a sobering discussion regarding the theoretical limit of indie game marketshare and the ensuing race to the bottom, but really the whole thing is worth reading.
http://www.nodontdie.com/rebecca-heineman/
Yeah, it's a tough, but fair assessment! (and that Doom 3DO story...). There was a thread about it here earlier, but I'm glad it gets as much exposure as it can, and probably should!
(oh, and very cool color advice and examples!)
My first instinct was actually to share some of your designs because I think you've mastered the art of picking different hues for shading, but I thought pixel art was a little more apt for what HandsomeCharles is doing. The principle is universal though.
My first instinct was actually to share some of your designs because I think you've mastered the art of picking different hues for shading, but I thought pixel art was a little more apt for what HandsomeCharles is doing. The principle is universal though.
Question to anyone using Unity for a mobile game (particularly android), what should I aim for in terms of APK size? Right now my latest build is about 22MB, and I remember reading from one of you that 100MB is the absolute max you tend to want to aim for, right?