Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Guys, I know the object was deleted :mad:. When I read about them at first, I thought it was like I created the prefab as an asset, and could just use it like a template. Then I found out that apparently any component that I want to use to instantiate a prefab needs to be given it as an actual GameObject. I'll say I'm not entirely convinced I'm doing this right. After having slept on it, I'm just assuming I was using the original handle for everything when I should have been using the returned one from Instantiate.

Onion Knight posted:

If you're got a GameObject with a component holding your ItemClass instance, on collision pass the instance to your inventory List and destroy the GameObject.
When you need to drop it again, just make a new GameObject (or as this is Unity, probably a prefab already set up with the right components), pass the instance from the List into the component, and remove the instance from the inventory List. Done.

I have the actual inventory management with containers all complete. There is no problem here. The issue is in the object lifetime:
1. Create original GameObject that gives itself to the player when they collide.
2. When given to itself, it provides a interface of itself as an item so that the game can have it do its then when told to use an item, and how it would be drawn as an inventory item. It also includes something about what to do when the player drops it.
3. When the player drops it, it regenerated itself as a GameObject. I was doing this by trying to retain the original GameObject and have that regenerate, but I deleted it when I removed it on the initial collision.

dizzywhip posted:

There are a lot of ways to tackle this, but if you just want to temporarily remove the game object and put it back later, use the SetActive method to disable and re-enable it as needed instead of destroying it.

I didn't know about that method, so I will try that one tonight. That would dodge the Instantiate/Destroy problem.

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I think I can clarify really that inventory management itself isn't the problem. I think my problem is with the limitations and usages of prefabs. I could restore the item as a drop in the world by building it up from scratch and stuffing all the components back in; I might as well just make a dedicated method for doing that. They were just making prefabs out to be some magic to get that out of the way. All it really looks like to me is a GameObject in my assets that I can drop into components at startup. So when I first heard about the, I thought they were doing something like being a template builder that I could use to poop out copies of the GameObject.

superh
Oct 10, 2007

Touching every treasure
Set it to enabled = false or whatever, it'll become invisible and stop updating, then turn it back to enabled = true.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

Rocko Bonaparte posted:

So when I first heard about the, I thought they were doing something like being a template builder that I could use to poop out copies of the GameObject.

You can do this, you just feed Instantiate() the prefab and use the GameObject copy it returns. It's kind of a pain in the rear end because you either have to find the prefab you want (potentially a huge pain) or make a public variable and set it in the inspector to point at your prefab (a smaller pain). Or I supposed if you want to clone a specific GameObject that still exists, you could use that, but that doesn't sound like your situation.

Spek
Jun 15, 2012

Bagel!
What's a good way to manage a largeish AI? Specifically in Unity. Most of the AI/enemy scripts in my game are simply just the one script that ultimately inherits from MonoBehaviour. But I've finally gotten to the point of designing the end boss and it will have several attacks and abilities most of which will, while they're active, require lots of book keeping variables and it seems like it'll be an error prone mess to just throw that all into the one script. I could make each attack its own script and that would be much cleaner and easier to follow except each attack needs to have access to most of the member variables of the core boss script. I don't like the thought of making them all public and passing them back and forth as often as necessary would quickly become a pain in the rear end. If C# had friend classes I could use that but it doesn't.

So I'm left unable to think of a solution I don't hate. Either one giant mess of a class, make most of the variables public, or pass a large amount of data to each state when it's started. Are there any better options I'm missing?

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
Just uploaded a new Mono for Unreal Engine build

quote:

* Fixed hot-reloaded classes not getting garbage collected
* Fixed reinitialization of hot-reloaded classes
* Improved support for BlueprintImplementableEvent and BlueprintNativeEvent
* Fixed hot-reloading improperly rebinding input
* Fixed UProperty/UFunction accessibilty modifiers

I also uploaded a sample too. I have no idea how it works... but hey, the download is a-okay :v:.
If you already signed up, you can download it from the same link you got in your email. If not, sign up here

nye678
Oct 27, 2007
Hi Spek. I think you should go for the big mess option, and then refactor until it isn't a mess. Obviously I have no idea what your game is, but unless your class definition is thousands of lines of code I wouldn't worry about it to much. If you do want to break it up a bit more consider using a struct to wrap all your bookkeeping data and passing that to the state. Also partial classes may suit the same needs that you would be using friend classes for.

Flownerous
Apr 16, 2012

Spek posted:

If C# had friend classes I could use that but it doesn't.

Nested classes should work. It's unrequited friendship but I've used it before for splitting up large classes in Unity.

Boz0r
Sep 7, 2006
The Rocketship in action.
What arguments are there for using UnityScript instead of C# in Unity?

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Boz0r posted:

What arguments are there for using UnityScript instead of C# in Unity?
"I know Javascript, I don't know C#, and I would rather learn a smaller amount."

Obsurveyor
Jan 10, 2003

Boz0r posted:

What arguments are there for using UnityScript instead of C# in Unity?

"I want to give myself brain damage."

Stick100
Mar 18, 2003

Drastic Actions posted:

Just uploaded a new Mono for Unreal Engine build


I also uploaded a sample too. I have no idea how it works... but hey, the download is a-okay :v:.
If you already signed up, you can download it from the same link you got in your email. If not, sign up here

Thanks, do you still build from the 4.4 source following the same instructions?

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

Stick100 posted:

Thanks, do you still build from the 4.4 source following the same instructions?

Yeah. The version that gets uploaded there will only *technically* supports 4.4 (Nothing stopping you from trying with newer versions though, just not supported), so those instructions stay the same.

Spek
Jun 15, 2012

Bagel!

nye678 posted:

Also partial classes may suit the same needs that you would be using friend classes for.

Flownerous posted:

Nested classes should work. It's unrequited friendship but I've used it before for splitting up large classes in Unity.

Thanks, a mixture of partial classes and nested classes is working perfectly for me.

Inverness
Feb 4, 2009

Fully configurable personal assistant.

Spek posted:

If C# had friend classes I could use that but it doesn't.
C# has the "internal" access modifier which limits accessibility to code in the same assembly. This fulfills the role that friend classes do in C++. You can also uses the assembly level InternalsVisibleToAttribute to expose them to other assemblies you know about.

BabelFish
Jul 20, 2013

Fallen Rib
https://www.youtube.com/watch?v=dsrZgmv23Yc

Epic's put out the 4.6 preview video, which includes experimental 3D (world space) UMG widgets. They're moving so fast I barely recognize the UI system from six months ago.

Also, built in demo recording via network traffic!

echinopsis
Apr 13, 2004

by Fluffdaddy
Thats very exciting for me because I've got a 3D UI in my UE4 game but it's kinda poo poo because it's me just placing the meshes in the level and moving them in front of the camera every frame. Not that it doesn't work but it seems to lag behind the camera every frame or so and go jittery.
Also I found 2D UMG to be confusing as hell (3D is unlikely to be easier) but find placing meshes with BP very straightforward and flexible

My dream situation would be a separate 3D world with a transparant backdrop that was rendered on top of the game world

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

echinopsis posted:

My dream situation would be a separate 3D world with a transparant backdrop that was rendered on top of the game world
Can't you accomplish this with multiple cameras?

echinopsis
Apr 13, 2004

by Fluffdaddy
I'm not sure how I would render the 2nd camera's "goods" on top of the game world


e: Actually late last night I discovered "Movement components", I had no idea what they are and still have little idea. If they can be used to place an actor they might be more effective than simple setting the world location/rotation, as far as being tied better into the sequence of events of the game

echinopsis fucked around with this message at 19:20 on Nov 23, 2014

Peewi
Nov 8, 2012

echinopsis posted:

Thats very exciting for me because I've got a 3D UI in my UE4 game but it's kinda poo poo because it's me just placing the meshes in the level and moving them in front of the camera every frame. Not that it doesn't work but it seems to lag behind the camera every frame or so and go jittery.
Also I found 2D UMG to be confusing as hell (3D is unlikely to be easier) but find placing meshes with BP very straightforward and flexible

My dream situation would be a separate 3D world with a transparant backdrop that was rendered on top of the game world

I have no experience with UE4, but to me that sounds like each frame you're moving the UI elements before moving the camera.

echinopsis
Apr 13, 2004

by Fluffdaddy

BabelFish posted:

which includes experimental 3D (world space) UMG widgets.

I've just realised this means the 2D UMG widgets in the game world, not using 3D meshes in UMG



Peewi posted:

I have no experience with UE4, but to me that sounds like each frame you're moving the UI elements before moving the camera.

Yeah, but I have no idea how to change this order. I tried to use a sequence so when the BP_Update_Camera function return node is called on the CameraManagerBlueprint (the official way to place/point a camera) that a sequence node 1st goes to the return and then calls a function on the HUD actor to move/face where it should, but beyond that I have no idea. I've even tried averaging out the location over a few frames but it makes it lag too much.

superh
Oct 10, 2007

Touching every treasure
I don't know anything about ue4 but in unity it's as simple as setting the order index on a camera, and setting the cameras each to only render the world / ui individually.

JGTheSpy
Jul 31, 2002
Excuse me, but if I could have a moment of your time, I'd like to explain why you're not actually enjoying that game that you're enjoying. You see, I am in fact an expert. At games. I know, it's impressive.

Boz0r posted:

What arguments are there for using UnityScript instead of C# in Unity?

I originally learned Unity with UnityScript and I didn't really want to start over but I decided C# would be more useful to know. It took a couple hours tops to transition. A couple things take a little extra code but I think it's generally easier to write and troubleshoot C# by a large margin. I've probably saved dozens of hours by switching and now I'm actually familiar with a great language.

So none. If someone presents an argument for UnityScript, it's probably wrong.

Raenir Salazar
Nov 5, 2010

"According to Wikipedia" there is a black hole that emits zionist hawking radiation where my brain should have been

I really should just shut the fuck up and stop posting forever
College Slice
I've been taking a class where we've been working in Unity.

So far I think 60% of all of my debugging problems originated with Unity in some way shape or form. :mad:

I think I spent 30 minutes figuring out why for some reason the X axis is shared for both analog sticks for the gamepad for instance. Or that my state controller can't seem to handle simultaneous states (spinning and moving).

Though enough complaining, I have a question, if I have some sort of effect that I made in blender such as say a transparent sphere that emits a little or has some special effect, but Unity doesn't seem to wanna import it straight up. I assume I need to write a shader for that material right?

Is it just Create C# Script > Write the shader > drag and drop onto the material in the inspector somewhere?

The Unity docs seem bafflingly shallow on workflow.

Dirty
Apr 8, 2003

Ceci n'est pas un fabricant de pates

roomforthetuna posted:

"I know Javascript, I don't know C#, and I would rather learn a smaller amount."

This is the theory that I used, but it doesn't really transfer in practice. I found myself constantly having to look up or figure out the Unityscript way of doing things. It got maddening and I ported my whole project over to C#. It didn't take long, and suddenly I was able to use C# reference from anywhere, not just Unity-related docs. It's not quite the same for me, I already knew Java, but since Unityscript pushes you down that road, I'd say it makes more sense to go for C# every time.

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

Raenir Salazar posted:

I've been taking a class where we've been working in Unity.

So far I think 60% of all of my debugging problems originated with Unity in some way shape or form. :mad:

I think I spent 30 minutes figuring out why for some reason the X axis is shared for both analog sticks for the gamepad for instance. Or that my state controller can't seem to handle simultaneous states (spinning and moving).

Though enough complaining, I have a question, if I have some sort of effect that I made in blender such as say a transparent sphere that emits a little or has some special effect, but Unity doesn't seem to wanna import it straight up. I assume I need to write a shader for that material right?

Is it just Create C# Script > Write the shader > drag and drop onto the material in the inspector somewhere?

The Unity docs seem bafflingly shallow on workflow.
There's an explicit "Create Shader" option. If you already understand shaders, this should help you with the Unity-specifics: http://en.wikibooks.org/wiki/Cg_Programming/Unity/Minimal_Shader

Raenir Salazar
Nov 5, 2010

"According to Wikipedia" there is a black hole that emits zionist hawking radiation where my brain should have been

I really should just shut the fuck up and stop posting forever
College Slice

SupSuper posted:

There's an explicit "Create Shader" option. If you already understand shaders, this should help you with the Unity-specifics: http://en.wikibooks.org/wiki/Cg_Programming/Unity/Minimal_Shader

Thanks man, for the most part I do as I roughly know Opengl and did shaders did, although obviously recreating the effect might take a great deal of work. :smith:

echinopsis
Apr 13, 2004

by Fluffdaddy
Maybe someone can help me get my head around event dispatchers in UE4

Until now I've done all my inter-BP communication with interfaces and casts (I mainly used interfaces before I realised a cast was often sufficient)

But I am stuck in a position where I cannot cast, it's inflexible because I have a child actor component but I can't call any events on it (usually I can cast to the class and it works easily, but something about it being a child component (even though it's a BP) prevents the casting)

And an event dispatcher will probably work but I just need a bit of help figuring out what goes where.

The situation is that I want to call an "event" when the player gets a new ship (from the ship BP), so that the HUD can update itself.

Do I set up the dispatcher on the HUD (the receiver) or the ship (the sender)?
And then, how do I call it from the ship?

If I create the dispatcher in one BP, I don't know how to reference it from another (isn't that the entire point?)

IDK why but the documentation seems to be making some assumptions and I can't work it out

echinopsis fucked around with this message at 11:17 on Nov 25, 2014

echinopsis
Apr 13, 2004

by Fluffdaddy
If Event Dispatchers are meant to only be used within one BP I think I get them now. I was hoping what they were was a global event call, and all BPs would receive the event.

Anyway, turns out I just needed to "get" the actor component of the child actor and then my casting worked as it always did. I was trying this eariler but I was getting it as a class not an object.. BOOM

BabelFish
Jul 20, 2013

Fallen Rib
Generally event dispatchers come in handy when you're doing actor<-->level blueprint communication, since it allows the objects to be portable between levels. You'd set up the dispatchers in the actor blueprints then call/bind to them in the level or actor blueprint as appropriate.

An example I normally give is:
I've got a door and N number of lights. When I open the door I want all the lights to turn on. The door is one blueprint, the lights are several instances of a second BP.

The door gets a dispatcher that is called when the door opens (player runs into the collision volume or whatever).
The light gets a custom event that does everything we need to turn on the light, then on BeginPlay that event is bound to a dispatcher.
In the level BP, you'd create a custom event, bind the custom event to the door's dispatcher, then inside the custom event call the dispatcher on all the light actors.

As far as HUDs go, back in the old days of non-UMG slate I tended to route things through the player controller, since it offered easy access to the player HUD object, might not be applicable to you, since if I remember rightly your HUD is actually an actor.

BabelFish fucked around with this message at 03:01 on Nov 26, 2014

Raenir Salazar
Nov 5, 2010

"According to Wikipedia" there is a black hole that emits zionist hawking radiation where my brain should have been

I really should just shut the fuck up and stop posting forever
College Slice
I have another question, suppose I have a game objects and one set of scripts to define its behavior, the statecontrollerscript and statelistenerscript.

These work and have say, three different actions they have (shoot blue bullets, red bullets and mauve).

Now I want to have a second or more model, but have them do a different action.

I had tried setting a public variable so that I could test the behavior and pass 0 to one and one to another and two for the third but they all end up doing the same exact action at the same time. What's happening here? The game objects are dragged and dropped into the game with the two scripts attached and then I try writing 0 or 1 or 2 based on what behavior I want them to do.

echinopsis
Apr 13, 2004

by Fluffdaddy

BabelFish posted:

Generally event dispatchers come in handy when you're doing actor<-->level blueprint communication, since it allows the objects to be portable between levels. You'd set up the dispatchers in the actor blueprints then call/bind to them in the level or actor blueprint as appropriate.

An example I normally give is:
I've got a door and N number of lights. When I open the door I want all the lights to turn on. The door is one blueprint, the lights are several instances of a second BP.

The door gets a dispatcher that is called when the door opens (player runs into the collision volume or whatever).
The light gets a custom event that does everything we need to turn on the light, then on BeginPlay that event is bound to a dispatcher.
In the level BP, you'd create a custom event, bind the custom event to the door's dispatcher, then inside the custom event call the dispatcher on all the light actors.

As far as HUDs go, back in the old days of non-UMG slate I tended to route things through the player controller, since it offered easy access to the player HUD object, might not be applicable to you, since if I remember rightly your HUD is actually an actor.

My HUD is now a ChildActorComponent of my PlayerCameraManager, all I needed to do to make it work like a normal spawned actor was "get" the actor from the ChildActorComponent. Before I was trying to cast to it while it was ChildActorComponent which is why it was't working


so with the dispatcher, I'm confused about the terminology, "gets a dispatcher".. In a actors you create a dispatcher, and its there in the component list. is this the BP that calls the dispatcher (so the events fire on this BP) or the actor calls the events, so that OTHER actors receive the events.
Either, in other actors I don't seem to be able to find the events. Unlike say, if I create an interface, and then I can call the functions/events I created with the interface from any actor (it shows up in the context specific menu) and I just need to link it to an actor to make it work

THis is confusing without a diagram

Swartz
Jul 28, 2005

by FactsAreUseless
I'm not sure of a better place to post this so I'll post it here.

I'm working with the X-Ray engine (Stalker series) and need a C++ programmer to help me out with a few features.

I'm willing to pay $50 this Friday to anyone who can implement the following two things for me:

1) Give the ability for shotguns with tri_state_reload the ability to have a separate animation for when reloading a shotgun with an empty magazine vs. a full one
2) I want certain guns, such as the Abakan, to have a different fire mode depending on what fire_mode they are using. For the Abakan, it should fire at 1,800 RPM in 2-round bursts, and it's normal RPM selected in the weapons' lua file the rest of the time.

Requirements:

Visual Studio 2008 SP1 (I could upgrade the source, but I won't, as this is what I work with)
Knowledge of game engines

The reason I'm paying so little is I know that for any decent C++ programmer this should not be a challenge.

Email me at matthew.w.swartz at gmail if interested and I'll provide the source code to work with, and upon successful verification that these two features work I'll send you $50 via Paypal (or another service that is reasonable).

There is also the opportunity to make more money after this as there are other features I may need coded and cannot do myself.

KoRMaK
Jul 31, 2012



re: LibGDX

Why does it never remember my android sdk directory?

KoRMaK
Jul 31, 2012



Swartz posted:

I'm not sure of a better place to post this so I'll post it here.

I'm working with the X-Ray engine (Stalker series) and need a C++ programmer to help me out with a few features.

I'm willing to pay $50 this Friday to anyone who can implement the following two things for me:

1) Give the ability for shotguns with tri_state_reload the ability to have a separate animation for when reloading a shotgun with an empty magazine vs. a full one
2) I want certain guns, such as the Abakan, to have a different fire mode depending on what fire_mode they are using. For the Abakan, it should fire at 1,800 RPM in 2-round bursts, and it's normal RPM selected in the weapons' lua file the rest of the time.

Requirements:

Visual Studio 2008 SP1 (I could upgrade the source, but I won't, as this is what I work with)
Knowledge of game engines

The reason I'm paying so little is I know that for any decent C++ programmer this should not be a challenge.

Email me at matthew.w.swartz at gmail if interested and I'll provide the source code to work with, and upon successful verification that these two features work I'll send you $50 via Paypal (or another service that is reasonable).

There is also the opportunity to make more money after this as there are other features I may need coded and cannot do myself.

So you estimate this would take less than 2 hours worth of effort?

BabelFish
Jul 20, 2013

Fallen Rib

echinopsis posted:

This is confusing without a diagram

Here's a super fast example:

Light Blueprint:


Door Blueprint:


Level Blueprint:


The level binds a custom event to the door's "ED_OnDoorOpen", which turns around and calls the dispatcher "ED_TurnOn" in an array of light actors. As long as you have a reference to the actor, you can use event dispatchers in either direction.

pseudorandom name
May 6, 2007

KoRMaK posted:

So you estimate this would take less than 2 hours worth of effort?

$50 is not enough compensation for two hours of work and two hours isn't enough time for somebody to become familiar with a game engine.

KoRMaK
Jul 31, 2012



I really want to use libgdx, but the tutorials don't seem to be accurate. Everytime I launch the game creator it forgets my sdk directory.

Here is the command I use
code:
D:\MyDocuments\Installs\gdx-setup.jar --sdkLocation "C:\Users\KoRMaK\AppData\Local\Android\android-sdk\"
Why isn't sdkLocation working? It keeps defaulting to "c:\your\sdk\directory"

e: I set my ANDROID_HOME directory and now its picking that up.

KoRMaK fucked around with this message at 17:03 on Nov 26, 2014

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

pseudorandom name posted:

$50 is not enough compensation for two hours of work and two hours isn't enough time for somebody to become familiar with a game engine.
Agreed it's not a great offer, but for someone who *is* familiar with the game engine it sounds like about 20 minutes of work, and maybe someone would want to learn about the game engine. Still, you're going to get a crummy learner programmer, not someone who'll do a great job.

Adbot
ADBOT LOVES YOU

KoRMaK
Jul 31, 2012



LIBGDX question - I can't set the default directory for projects via command line, what gives? I do

code:
java -jar gdx-setup.jar --dir "C:\my\dir\" --name "butts"
but none of those settings show up in the gdx launcher.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply