clyde

Amateur Game Making Night

Recommended Posts

Wouldn't that just be the first command in Update() ?  I'm not sure, but it should run the stuff in Update in order.. I think Update(), FixedUpdate() and LateUpdate() are the only ones available. Update being the first thing run on each frame, FixedUpdate being called multiple times each frame or sometimes not at all, depending on the framerate and LateUpdate, which is guaranteed to happen after Update.

Share this post


Link to post
Share on other sites

I'm building an economy of trading between planets, and to keep things sensible I wanted to first do all of the production on all planets, then do all the trading on all planets, then do the expending of supplies on all planets.

 

This keeps silly things from happening such as a planet that's running at a deficit not being able to expend anything (since stock is at zero) and screaming shortage, but then receiving supplies after the fact (thus showing having a shortage even though they have stock) or having a planet not ship anything out because stores are empty, only to produce a bunch later and have spare supplies on hand that didn't ship.

Share this post


Link to post
Share on other sites

[Edited for clarity.]

 

Ah, I see what you mean.

I think in this case I'd have these processes called in a special function, as opposed to in each planet's update. If you have a list of all planets somewhere (such as in a PlanetManager class), you could have three separate functions for iterating through all planets and calculating production, trading, and expending. This way you can call these functions every frame, or (if you wanted it to be a turn based game) you could only call them each turn.

 

Planet
 ∟ function Produce
 ∟ function Trade
 ∟ function Spend

PlanetManager
 ∟ variable PlanetList    // list of all planets in the game
 ∟ function DoAllPlanetProduction // iterates through each planet and calls Produce on it
 ∟ function DoAllPlanetTrading    // iterates through each planet and calls Trade on it
 ∟ function DoAllPlanetSpending   // iterates through each planet and calls Spend on it

 

If you set it up in this way, you could pass the list of planets through to each planet's Trade function, and that planet could iterate through the list of all planets and decide on which one(s) to trade with.

Share this post


Link to post
Share on other sites

I just compiled the version 0.00000001 of my first Unity game project, so far called Random Dungeon Mans. The setting/flavor/stuff isn't settled yet, I've mostly just spent the entire weekend and today writing a dungeon creation algorithm and decided to put stuff together when I finally got it to a workable place.

 

http://danimo.net/randdunggame/randdunggame.html

 

Its not a game yet, but you can run around and explore what my random dungeon generator spits out. you can also jump and clip through the ceiling, then press the Reload button to generate another dungeon level for yourself. textures are just placeholder samples I grabbed from somewhere.

 

so far my biggest issue is probably scoping. I'm gonna drop messing with the dungeon algorithm much for now and see if I can turn what this is now into some kind of game.

Share this post


Link to post
Share on other sites

Progress Report for week #2

What was my goal?

What is my long-term goal?

-Make the dance-game.

What is my goal for week #2?

-Watch tutorials 2-6 on this page and have Unity open during it so that I can mimic what dude is talking about in order make sure I comprehend it.

What challenges am I likely to face and what steps can I take to prepare for them?

-Amnesia Fortnight is going to suck up a lot of my available time.

+ I can make progress on my goal while waiting for a time when Capt. Hastings and I can watch the documentaries together. I can limit my consumption of the Twitch-feed by making a rule that I'm only allowed to watch it if I am currently on schedule for completion of week #2's goal.

-I might start getting into material that doesn't seem applicable to the dance game and feel like I don't need to watch it.

+ I can be open to coming up with tiny experiments with which to apply those portions. As I begin to see how to make the dance-game in Unity, I should apply those techniques in a separate project. So I'll have two Unity-projects, one for things that may be applicable to the dance-game and one that will be for things that do not seem applicable.

Did I accomplish my goal?

-no

What challenges did I face?

- I played 11 hours of the limited-time Titanfall Beta. I also started doing a tutorial in addition to the videos that sent me in a wildly different tangent. Videos 2-5 were fun, but five minutes into 6, I was like "I don't want to learn about what I can do with cameras right now, I just sat through 2 hours of terrain-building and flora and I want to learn more about the programming part."

I started the space-shooter tutorial and got tripped up by the scripting portion. After getting advice from this thread and the IRC party, I started looking into C# and began to watch the scripting videos. Made a lot of progress actually. No regrets.

What is my long-term goal?

-Make the dancing game.

What is my goal for week #3?

- I ended up getting a book on Unity development and I'd like to make some progress in it. I'd like to read through and experiment with what I learn the following:

-the two chapters on scripting

-the chapter on prefabs

-the chapter on GUI

-I'd like to actually make a very short twine-like in Unity with what I learn from this chapter.

-the chapter on character controllers

What challenges am I likely to face and what steps can I take to prepare for them?

-Amnesia Fortnight is actually this week, not last. So I'll take my advice from last week and limit my twitch watching to lesser than or equal to my time spent learning how to make a game.

-I might get side-tracked again, but that might be a good thing. I still don't know what all I need to know. In moments that I find out, my goals mutate and I think that's ok at this stage.

-It's possible that the GUI and scripting chapters won't cover everything I need to know in order to make a short twine-game in Unity. I need to be prepared for that possibility so that it won't be demotivating. I'll be ready to accept that I need to find some additional resources for that learning-project.

-I still don't know how to create a 2d sprite. I really want to know that. I need to figure out how to make a 2d sprite. That is an additional priority. I'll search a bit and then start asking y'all.

Share this post


Link to post
Share on other sites

[Edited for clarity.]

 

Ah, I see what you mean.

I think in this case I'd have these processes called in a special function, as opposed to in each planet's update. If you have a list of all planets somewhere (such as in a PlanetManager class), you could have three separate functions for iterating through all planets and calculating production, trading, and expending. This way you can call these functions every frame, or (if you wanted it to be a turn based game) you could only call them each turn.

<removed for brevity>

If you set it up in this way, you could pass the list of planets through to each planet's Trade function, and that planet could iterate through the list of all planets and decide on which one(s) to trade with.

 

I thought the goal of object oriented programming is to not have these random scripts floating out there not attached to anything in particular? Maybe I just misunderstand the methodology still, I still have problems with the object oriented part as most of my programming experience was in QBasic.

 

Regardless, I think what I'm going to do is throw all the producing/spending of resources into LateUpdate. This might make a few strange instances of a planet having plenty of stock right next door to a planet that's in an emergency shortage but, in the end, that will just make more trade opportunites for the player anyway.

Share this post


Link to post
Share on other sites

Progress Report for week #2

-I still don't know how to create a 2d sprite. I really want to know that. I need to figure out how to make a 2d sprite. That is an additional priority. I'll search a bit and then start asking y'all.

 

Animating a sprite is basically making one picture with all the different poses that a sprite could do, and then displaying different parts of the image depending on what's going on. The Spelunky thread has a pretty good example on how the Chris Remo, spelunker extrordinare, sprite is assembled. If you mean actually drawing it, that's not exactly my forte.

Share this post


Link to post
Share on other sites

^That's called a sprite sheet, which is just an organized collection of all possible animation frames. I don't know an animator that straight up draws a sprite sheet!

 

Clyde, I recommend using ASEprite if you're making pixel art, which is a pretty decent animation and image editor. It lets you playback animations, do onion skins, use layers, export sprite sheets and all sorts of cool stuff. Also photoshop can do animation.

Share this post


Link to post
Share on other sites

Animating a sprite is basically making one picture with all the different poses that a sprite could do, and then displaying different parts of the image depending on what's going on. The Spelunky thread has a pretty good example on how the Chris Remo, spelunker extrordinare, sprite is assembled. If you mean actually drawing it, that's not exactly my forte.

I'm speaking of displaying a 2d sprite in Unity specifically. I'm guessing that I have to make a quad-object and then use a .png for its texture, but I don't know.

Unrelated question: Is there any reason I would use a for-loop instead of a while-loop? For-loops seem way more confusing; I would like to avoid them.

Share this post


Link to post
Share on other sites

For loops are used for when you want to iterate a specific amount of times, while "while" loops iterate infinitely until a condition has been met. As far as I can tell for loops are a specific structure of while loops.

 

So for example if you want to add 1 to every item on a list, you would probably use a for loop if you know the length of the list.

Share this post


Link to post
Share on other sites

I'm speaking of displaying a 2d sprite in Unity specifically. I'm guessing that I have to make a quad-object and then use a .png for its texture, but I don't know.

 

That's the gist of it. Unity now has support for 2D stuff but I'm no expert (it's only a month or two old). I personally use a third party solution called 2D Toolkit which runs about 65 bucks on the asset store, it does sprite atlasing, has a sprite implementation, and many more features.

Share this post


Link to post
Share on other sites

To make a 2D sprite in Unity, drag an image file from your file browser of choice into the scene or project tab.

 

To make an animated sprite is a bit more involved. Make a sprite sheet! Look it up if you don't know what that is. U: Once you have dragged the sprite sheet image into your project tab, you can select it and modify it from there. In the Inspector tab, there are a bunch of properties. Most probably are unimportant for now (and some are only relevant in Unity Pro, like the packing tag, I think). Select the Sprite Mode drop-down menu and change it to Multiple. Then click the new Sprite Editor button that appears. I think that's a good starting point. U:

 

Oh, once you've selected all the frames in your Sprite Editor, go to the project tab, expand the sprite, and it'll show all those frames. Select all of them and drag them as a group into the scene. That'll automatically create an animation using those frames. There's... a LOT more to how animation works, and to be honest I'm still a beginner in how Unity does all that stuff, but that should get you started, I hope? Read up on Mecanim for more fun stuff to do with animations!

 

Also, if you're doing pixel art, change the Filter Mode to Point. Otherwise you'll get some super blurry images everywhere.

 

Note that all of this is for 2D mode in Unity. If you wanted to make a 2D sprite in 3D mode, you'd basically be making a quad, like clyde was thinking.

Share this post


Link to post
Share on other sites

This might be really dumb but the car movement looks strangely naturalistic compared to other car stuff I've seen, and that might just be the camera angle but I really like it.

Share this post


Link to post
Share on other sites

BigJKO your car game reminds me of MicroMachines for the NES/Genesis aka the best top down racing game.

 

just add a pool table level and it'll be perfect

Share this post


Link to post
Share on other sites

Haha, that's awesome Blambo. I don't know what to make of that, but that sounds like a compliment! ;)

 

danimo, that is exactly where the inspiration for this comes from! And a pool table level is definitely going in.

Share this post


Link to post
Share on other sites

For loops are used for when you want to iterate a specific amount of times, while "while" loops iterate infinitely until a condition has been met. As far as I can tell for loops are a specific structure of while loops.

 

So for example if you want to add 1 to every item on a list, you would probably use a for loop if you know the length of the list.

 

You got it, it's because this

for(int i = 0; i < array.Length; i++)
{
  //do something
}

looks nicer than:

int counter = 0;
while(counter < array.Length)
{
  //do something
  counter++;
}

The bonus is your counter variable (int i) is scoped only for the for loop.

Share this post


Link to post
Share on other sites

Haha, I'll try! :tup: Just for funsies last night I put a bunch of the AI characters on the track to race themselves. In this vine they're just chasing each others tail, but every once in a while someone got ahead of the pack! Hooray for that guy.

 

Next up is giving them a couple of different personalities, like one of them brakes a bit at every turn, playin' it safe. And also, I need to make it so they avoid obstacles, i.e. the player or anything I might put on the tracks. That would also hopefully fix them just stopping dead on walls..

Share this post


Link to post
Share on other sites

I find it ridiculous how much progress BigJKO is making. Keep it up.

God, me too. It makes me feel so inadequate. Hah.

Share this post


Link to post
Share on other sites

I thought the goal of object oriented programming is to not have these random scripts floating out there not attached to anything in particular? Maybe I just misunderstand the methodology still, I still have problems with the object oriented part as most of my programming experience was in QBasic.

 

The goal of object oriented programming (as I understand it) is to compartmentalize functionality; when you're dealing with a galaxy of planets trading/spending/producing, it makes sense to me to have a class that represents the galaxy as a whole, and can connect planets to other planets in order to facilitate trade, etc. Setting up a singleton to do this may not be the most Unity-friendly way to achieve this however; I'm basing this off pre-Unity experience. The PlanetManager approach is just the way I'd do it - if the LateUpdate method seems to work fine, then you should be able to hold off making a PlanetManager until you need it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now