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
Stick100
Mar 18, 2003

Ephphatha posted:

How many of us are planning on entering the 2014 indie game maker contest? I'm gonna try get something made since the longer timeframe gives me more weekends to work on something, but I know it won't be competitive.

The competition is hosted by RPG maker but you're free to use any technologies/engine and make any genre of game.

How long has national game dev month been a thing for anyway? Never heard of it before.

I think I'm going to try. My plan is to attempt a Unity 4 blueprint only vehicle game.

Adbot
ADBOT LOVES YOU

Pentecoastal Elites
Feb 27, 2007
Probation
Can't post for 7 hours!
In C#, Unity:
I need to have a series of enemies of various types spawn, and they should spawn more often as the game progresses. The easier enemies spawn first and spawn more quickly as the game progresses. The harder enemies first spawn later, and do the same but at a much slower rate.

I wanted to just use an array, but each type needing a different spawn rate is throwing me off. Right now I have a bunch of InvokeRepeating calls with cascading delays at the start, and that works well and gives me a lot of fine balance control, but it results in a lot of very similar-looking code and doesn't look or feel particularly elegant.
I know I've found a solution and it's working and I probably shouldn't gently caress with it too badly, but I've just started learning how to code in general and am using this game as a learning experience, so if there is a clever way to do this I'm very interested.
I don't want or need anyone to post up a bunch of code or hold my hand through the process, but because I'm so new to this I'm still learning how to think about problems like this. If anyone could suggest a method I would love to hear it.

This is some psuedocode of what I have so far
code:
	void Start (){
		InvokeRepeating ("SpawnEnemyA", 2, 3);
		InvokeRepeating ("SpawnEnemyA", 20, 4);
		InvokeRepeating ("SpawnEnemyB", 7, 5);
		InvokeRepeating ("SpawnEnemyB", 30, 10);
		InvokeRepeating ("SpawnEnemyC", etc etc
                 }

        void SpawnEnemyA{
               Instantiate(EnemyA), SpawnPoint
              }
        void SpawnEnemyB{
               Instantiate(EnemyB), SpawnPoint
              }
        etc etc

Flownerous
Apr 16, 2012
A basic timer (basically what InvokeRepeating is doing) is usually something like:

code:
    public float m_TimeToFirst = 2.0f;
    public float m_TimeBetween = 1.0f;

    float m_TimeToNext;

    void DoThing()
    {
        // DO a thing
    }

    void Start()
    {
        m_TimeToNext = m_TimeToFirs;
    }

    void Update()
    {
        m_TimeToNext -= Time.deltaTime;
        if (m_TimeToNext <= 0.0f)
        {
            DoThing();
            m_TimeToNext += m_TimeBetween;
        }
    }
Seems like you want an array of timers and instead of a constant m_TimeBetween you want that to change depending on how far through the level you are.

Che Delilas
Nov 23, 2009
FREE TIBET WEED
I'm a beginner as well so take this with a grain of salt.

From your pseudocode it looks like you have one gameobject that is responsible for spawning all the enemy types. You could break that up into multiple gameobjects, each responsible for spawning a single enemy type. Have your script have some public properties like "InitialDelay" and "Period" so you can fiddle with the spawn rates in the Inspector.

(Edit: Or I suppose you could have just the one gameobject but with multiple copies of the script, each script handling a different enemy type. I'm not sure how well I like that solution though, it could clutter up the inspector with a bunch of the same named script.)

If you want to get fancy you could use Invoke instead of InvokeRepeating, and have it do math to figure out the next delay. Something like

code:
void Start()
{
	Invoke("SpawnEnemy", InitialDelay);
}

void SpawnEnemy()
{
	Instantiate(EnemyPrefab, SpawnPoint);
	nextDelay = /* Teacher, when are we ever going to have to USE this? */;
	Invoke("SpawnEnemy", nextDelay);
}
You could have other properties in the script to control when the delay changes, and by how much, and just do whatever math is appropriate based on how you want your spawn rates to change.

Che Delilas fucked around with this message at 11:39 on May 31, 2014

Praseodymi
Aug 26, 2010

Is there some sort of API or library for doing menus in C++? I'm trying to fill the gap in my knowledge but it's taken nearly 250 lines of code just to do a vertical list of buttons with mouse and controller. Is there even any reading I can do if there's some theory behind it I might be missing or is this just something to get used to?

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

Onion Knight posted:

void Start (){
InvokeRepeating ("SpawnEnemyA", 2, 3);
InvokeRepeating ("SpawnEnemyA", 20, 4);
InvokeRepeating ("SpawnEnemyB", 7, 5);
InvokeRepeating ("SpawnEnemyB", 30, 10);
InvokeRepeating ("SpawnEnemyC", etc etc
}

The code itself is fine; when you find you have a lot of repeating code like this, with just parameters changing, you're usually looking at a good candidate for data-driven code :swoon:!

So you'd define an xml or json chunk (or whatever, CSV is a favorite of data-noobs, devolving into CSV delimited first with colons or tildes, and then multiple tildes... :gonk:) like so:

code:
(a json file, or whatever)

[

    { "name":"SpawnEnemyA", "time":2, "amount":3 },
    { "name":"SpawnEnemyA", "time":20, "amount":4 },
    ...
]
code:
implementation (c# or whatever)

1. Load your data.

2. The code to spawn all of them ends up as something like:

   foreach( EnemyEntry in EnemyList ) Spawn( EnemyEntry.Type, EnemyEntry.Time, EnemyEntry.Amount );

This nicely decouples the data itself from the implementation, so if you decide to change the way Spawn works, you don't have to change 80,000 copy-pasted entries.

:toot:

FuzzySlippers
Feb 6, 2009

If you wanted something in the Unity editor you could create a serializable class that has fields for prefab, time, amount. If its serializable a monobehaviour with an array of them can be configured right in the inspector. You could put the logic into the little class too.
code:
[System.Serializable]
public class Spawner {
        public GameObject Prefab;
        public float Delay;
        private float _nextSpawnTime;

        public void UpdateTime(float time) {
            if (time < _nextSpawnTime) {
                return;
            }
            _nextSpawnTime = time + Delay;
            Instantiate(Prefab);
        }
}
(typed from memory might be dumb)
So then the ParentSpawner monobehaviour just zips through its own array of Spawner objects and updates them on the current time. Each Spawner spawns or not depending upon its fields. For the level progression stuff it would be easy to add to it (when time passes a field value cut delay or something).

This isn't terribly different than having a bunch of monobehaviours doing this but I like it because it doesn't crowd your hierarchy and if you want to stop spawning rather than find every spawner you just tell the ParentSpawner to stop updating.

Though I like Unormal's solution better and I use XML files for everything.

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!

Praseodymi posted:

Is there some sort of API or library for doing menus in C++? I'm trying to fill the gap in my knowledge but it's taken nearly 250 lines of code just to do a vertical list of buttons with mouse and controller. Is there even any reading I can do if there's some theory behind it I might be missing or is this just something to get used to?
It mostly just sucks balls. There are libraries, but you'll inevitably find that they actually make things more difficult than if you just coded simple things yourself, at least until you're wanting more complex poo poo like scrollbars and text-edit-windows.

Pentecoastal Elites
Feb 27, 2007
Probation
Can't post for 7 hours!
Thanks a ton to everyone who posted a suggestion. I should have set it up like Che Delilas suggested (why didn't I think of that!) but I'm going to try to get it to work pulling data from an XML like Unormal suggests. I'm going to need to learn how to do that sooner or later, so might as well dive in now.

If I can get it working in the next day or so, I'll throw a dev build up here.

Thanks again!

Che Delilas
Nov 23, 2009
FREE TIBET WEED

Onion Knight posted:

Thanks again!

I should point out that (and this is true for all programming) you shouldn't get too caught up in making everything elegant and generic and infinitely expandable, at least not too early. As you can see from all the replies, there is a multitude of ways to solve a particular problem, each with its own pros and cons, and it's very easy to get paralyzed trying to choose the "best" solution. Obviously you have to make a decision as to how future-proof you want your project to be; in your example if you are planning on having dozens or hundreds of enemy types, then yeah you're probably going to want to roll a data-driven solution before you start creating all those types. But if you're just going to have a few, then I might move onto other areas of the project for now since you really already have a working (if brute-force) solution.

Premature optimization is death, DEATH, for a project that you actually want to get out the door at some point.

Stick100
Mar 18, 2003

Che Delilas posted:

Premature optimization is death, DEATH, for a project that you actually want to get out the door at some point.

It's also quite frankly a waste in most circumstances. Most early code either get's completely rewritten, unused, or never needs to be optimized. It's very difficult to optimize the code until the projects finished. As one of my bosses would say the key to optimizing is speeding up the slow parts. You can't know which parts are the slow parts until you're near the end. This is also why most game dev machines and game demo's are hardware 5-10x more powerful than game consoles.

Notable example Forza E3 vs shipping.

http://www.examiner.com/slideshow/forza-motorsport-5-e3-build-and-final-version-compared

Data driven code can save your tons of headache and in and of itself is not necessarily optimization.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?
IRC dudes, if any of you have contact deets for bbcisdabomb, might want to ping him. The SA GameDev wiki's down, which is hampering my "LOOK AT THE PROUD HISTORY OF THIS COMPETITION!" opening explanation paragraph :v:

(yes, we're doing SA GameDev again, I'm writing the OP for the organizational thread as we speak)

JossiRossi
Jul 28, 2008

A little EQ, a touch of reverb, slap on some compression and there. That'll get your dickbutt jiggling.
Joooooiiiinnnn Uuuuuuusssssssss

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

, the SQL columns howled in monstrous union.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?
SA GameDev 9 is live. Come make Public Access TV games with us (no, really!).

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Wondering what people would think the best approach is here.

Say I am making a Zelda Link to the Past clone in Unity. How would you go about setting up the project with regards to scenes.

I have 3 options really.

I could create a scene for the world map and each dungeon/area.

But in the Zelda games each square of the map has a scroller once you hit the edge, so maybe a scene per square makes sense?
That seems like it could become a bit massive in the end though, but easy to manage on a per scene basis.

Loading the maps from a file also works, but it seems like it would be a lot slower to design the game when in the editor I can drag items/enemies/triggers around really easily.

Thoughts?

I'm leaning towards option 2 and just making sure I have everything named and structured well to avoid confusion.

Alternatively are there any good 2D tutorials for this kind of game? I'm fine going it on my own but it might just give me some structural ideas for the project as a whole.

Ragg
Apr 27, 2003

<The Honorable Badgers>
I think the recommendation is generally not to use Unity as a level editor as it's not really well suited to that kind of stuff. Maybe if you write a custom editor or use something from the Asset Store.

eeenmachine
Feb 2, 2004

BUY MORE CRABS

BUGS OF SPRING posted:

Wondering what people would think the best approach is here.

Say I am making a Zelda Link to the Past clone in Unity. How would you go about setting up the project with regards to scenes.

I have 3 options really.

I could create a scene for the world map and each dungeon/area.

But in the Zelda games each square of the map has a scroller once you hit the edge, so maybe a scene per square makes sense?
That seems like it could become a bit massive in the end though, but easy to manage on a per scene basis.

Loading the maps from a file also works, but it seems like it would be a lot slower to design the game when in the editor I can drag items/enemies/triggers around really easily.

Thoughts?

I'm leaning towards option 2 and just making sure I have everything named and structured well to avoid confusion.

Alternatively are there any good 2D tutorials for this kind of game? I'm fine going it on my own but it might just give me some structural ideas for the project as a whole.

We did NimbleQuest in Futile and used the tilemap editor Tiled (http://www.mapeditor.org).

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Ragg posted:

I think the recommendation is generally not to use Unity as a level editor as it's not really well suited to that kind of stuff. Maybe if you write a custom editor or use something from the Asset Store.

Its that bad eh? Seems like such a waste when it's so built into the app

eeenmachine posted:

We did NimbleQuest in Futile and used the tilemap editor Tiled (http://www.mapeditor.org).

That is definitely the feel I am going for. I'll check out Tiled.
I had planned to use to new Unity built in 2D, but I'll check out Futile and see what tutorials I can find.
Thanks!

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.
I'm using Tiled and .tmx in my game doodle and its pretty awesome, but older versions you have to edit tile properties tile by tile, which sucks, and daily builds which have the ability to edit a group of tiles' properties at once have all kinds of other bugs on my system that make it pretty drat hard to use.

I don't want to get involved in writing bug fixes for Tiled instead of working on my game :smith: I'm almost considering trying out a different map editor and a different map format, although Tiled should probably iron those details out soon-ish? Development doesn't seem crazy but it is active at least.

Ragg
Apr 27, 2003

<The Honorable Badgers>

BUGS OF SPRING posted:

Its that bad eh? Seems like such a waste when it's so built into the app

It doesn't even have snap to grid. Speaking from experience it's a real pain in the rear end laying things out in Unity.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Ragg posted:

It doesn't even have snap to grid. Speaking from experience it's a real pain in the rear end laying things out in Unity.
ProGrid is the best $20 I spent in the AssetStore. I poo poo you not.

WITH that, Unity is alright for level design. Without that, it's totally miserable.

One Eye Open
Sep 19, 2006
Am I awake?

Ragg posted:

It doesn't even have snap to grid. Speaking from experience it's a real pain in the rear end laying things out in Unity.

Yes it does. Hold down control/command key while moving the object. You can set the grid in Edit->Snap Settings. See here. However, I lay most things out in Maya rather than the Unity editor as it's what I'm used to.

Pentecoastal Elites
Feb 27, 2007
Probation
Can't post for 7 hours!
Hey, it worked!
https://googledrive.com/host/0BxsXVYMElwaZYzYxcDljYUZBNms/Dog%20Petter%20Dev%20Build.html
In retrospect I don't nearly have enough enemies to necessitate pulling data from elsewhere, but, I learned a ton in the implementation.

This is incredibly rough and has zero polish, but here's where I am so far, if anyone wants to take a look.
It gets a little overwhelming for the mouse, but it's designed for a touch interface (there's also no game over screen yet, you just stop collecting points when a pest touches your arm)

Ragg
Apr 27, 2003

<The Honorable Badgers>

One Eye Open posted:

Yes it does. Hold down control/command key while moving the object. You can set the grid in Edit->Snap Settings. See here. However, I lay most things out in Maya rather than the Unity editor as it's what I'm used to.

That ain't snap to grid.

retro sexual
Mar 14, 2005
Just wanted to share a really neat game by some Irish friends of mine that is on Kickstarter now. Check it out:
https://www.kickstarter.com/projects/bitsmithgames/franknjohn

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Shalinor posted:

ProGrid is the best $20 I spent in the AssetStore. I poo poo you not.

WITH that, Unity is alright for level design. Without that, it's totally miserable.

Thanks maybe I'll give this a try. Tiled was suggested in the other thread so may try that since its free.
It just seems like balancing level design would be easier right in the editor, it's weird there isn't a great solution for it. Though I guess native 2D is new.

The King of Swag
Nov 10, 2005

To escape the closure,
is to become the God of Swag.
The purpose of this post was originally to ask a simple question, but after having asked it, this post devolved into a detailed analysis of my project; the decisions I've made so far, the ones I'm still deciding on, how and why I've made them and how I felt they would affect the commercial sales of the finished product. That further devolved into an analysis of my insecurities with devoting so much time and effort into a project, that like most indie projects, needs to realistically be looked at as an inevitable and abysmal commercial failure, and that any money made from such a venture is simply to be taken as gravy on top of having the pride of having released a game.

But then I thought better, deleted all that and here's my original question: what is a good 2D framework for Unity, that doesn't force me into a 2D only environment / orthographic only camera? I'm working on a graphical roguelike, but I'm working with 3 dimensional maps, so vertically aligning horizontal map slices (which are obviously tiles merged into a singular mesh) and rendering them with a perspective camera is a must.

I've looked at a number of different options, but it seems like every one comes with its own quirks and limitations that don't jive well with my requirements.

SuicideSnowman
Jul 26, 2003
You can use any 2D framework with any camera you want as far as I know (I'm not sure about Futile). If you start a 2D project in Unity, it'll start you out with an orthographic camera but you're welcome to change it to a perspective camera at any time.

Stick100
Mar 18, 2003

The King of Swag posted:

The purpose of this post was originally to ask a simple question, but after having asked it, this post devolved into a detailed analysis of my project; the decisions I've made so far, the ones I'm still deciding on, how and why I've made them and how I felt they would affect the commercial sales of the finished product. That further devolved into an analysis of my insecurities with devoting so much time and effort into a project, that like most indie projects, needs to realistically be looked at as an inevitable and abysmal commercial failure, and that any money made from such a venture is simply to be taken as gravy on top of having the pride of having released a game.

But then I thought better, deleted all that and here's my original question: what is a good 2D framework for Unity, that doesn't force me into a 2D only environment / orthographic only camera? I'm working on a graphical roguelike, but I'm working with 3 dimensional maps, so vertically aligning horizontal map slices (which are obviously tiles merged into a singular mesh) and rendering them with a perspective camera is a must.

I've looked at a number of different options, but it seems like every one comes with its own quirks and limitations that don't jive well with my requirements.

I know 2D toolkit is well regarded for 2.5d development using a perspective camera although I've never tried it for that purpose.

superh
Oct 10, 2007

Touching every treasure
I've done a full 3d perspective 2d sprite game in Unity with 2dtoolkit and it works ok. My sprites were large and having them in perspective led to billboard clipping issues that I had to hard-code render orders to get around.

I haven't used unity 2d at all yet.

xgalaxy
Jan 27, 2004
i write code
Unreal Engine 4.2 Release Notes

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
That sure looks like a whole bunch of really neat stuff.

pseudorandom name
May 6, 2007

Especially the Windows XP support.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Any insight on how the levels in the 8-bit Donkey Kong worked?

I'm wondering the most about the angled floors, all the other levels seem to be on a 14-wide grid. I'm guessing the moving elevators weren't really level tiles but sprite/objects of some sort?

Lork
Oct 15, 2007
Sticks to clorf
The angled girders just look like the same tile as the straight ones, just arbitrarily placed a few pixels above or below the next one. I don't think there's any reason why they would have to confine themselves to a grid for the background other than for organizational purposes.

Jewel
May 2, 2009

Lork posted:

The angled girders just look like the same tile as the straight ones, just arbitrarily placed a few pixels above or below the next one. I don't think there's any reason why they would have to confine themselves to a grid for the background other than for organizational purposes.

Because that's how stuff like the NES worked. They have a grid of tiles in memory, and then very few sprites. Even stuff like screen scrolling was a variable for offset that they incremented then shifted all the tiles over when it hit 16. I'm interested in knowing the answer too, actually.

Edit: vvv Ah yeah never thought of that!

Jewel fucked around with this message at 06:52 on Jun 6, 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!
My guess would be that they just used 15 tiles; girder, girder-up-1-pixel-bottom-7-pixels, girder-up-1-pixel-top-1-pixel, [...], girder-up-7-pixels-bottom-1-pixel, girder-up-1-pixel-top-7-pixels.
(Assuming the tiles are 8x8 for this example.)

Lork
Oct 15, 2007
Sticks to clorf

Jewel posted:

Because that's how stuff like the NES worked. They have a grid of tiles in memory, and then very few sprites. Even stuff like screen scrolling was a variable for offset that they incremented then shifted all the tiles over when it hit 16. I'm interested in knowing the answer too, actually.
I had no idea. Kind of makes some of the stuff I've seen in later NES games seem totally out of control in retrospect.

Adbot
ADBOT LOVES YOU

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

Lork posted:

I had no idea. Kind of makes some of the stuff I've seen in later NES games seem totally out of control in retrospect.

What kind of stuff do you mean? I can't think of anything that's crazy mind blowing in that respect off the top of my head.

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