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
RoboCicero
Oct 22, 2009

"I'm sick and tired of reading these posts!"
I ran into this problem when getting UI elements to bounce in sync. In the end I just had a master 'clock' component that fired a method on all my target components at regular intervals so there was only one thing keeping track of the time.

You could maybe try organizing it so you have a SpawnGroup parent that controls the spawning of its children?

e: Or the below more correct method :v:

RoboCicero fucked around with this message at 17:30 on Jun 16, 2016

Adbot
ADBOT LOVES YOU

Jewel
May 2, 2009

Chernabog posted:

Is there a more accurate way to measure time in Unity than this? Sometimes the spawns get desynchronized when the spawnInterval gets too small.

code:
void Update () 
{

	elapsedTime += Time.deltaTime;

	if (elapsedTime > spawnInterval)
	{
		elapsedTime = 0.0f;
		SpawnerT.GetComponent<enemySpawner>().spawnHere ();
				
	}
}
Sorry for all the noob questions :unsmith:

Yeah, since you're "discarding" the extra you slowly drift off. To fix just that, try this

C# code:
void Update () 
{

	elapsedTime += Time.deltaTime;

	if (elapsedTime > spawnInterval)
	{
		elapsedTime -= spawnInterval;
		SpawnerT.GetComponent<enemySpawner>().spawnHere ();
				
	}
}
which will still spawn maximum one per frame; which could end up building up in the event of a very large delta time. Another way is:

C# code:
void Update () 
{
	const int maxToSpawnPerFrame = 5;

	elapsedTime += Time.deltaTime;

	for (int i = 0; i < maxToSpawnPerFrame; i++)
	{
		if (elapsedTime > spawnInterval)
		{
			elapsedTime -= spawnInterval;
			SpawnerT.GetComponent<enemySpawner>().spawnHere ();			
		}
		else
		{
			break;
		}
	}
}
Which leaves you with the exact amount on screen that you should always have.

PokeJoe
Aug 24, 2004

hail cgatan


I made another Android game called Kitty Cart. It plays kinda like the minecart minigame in super mario rpg or stardew valley. You ride along, collect coins, and hop over gaps.

I did all of the graphic assets myself, and it was tons of work. I'd say nearly half of my time working on this game was artwork related. I got a lot of suggestions showing it off to people to give the cat's animation a little more character, or to make him look surprised or something when jumping or falling, but I already stretched my computer artist skills pretty far as is.

It was done in libGDX, and I had a good time with it. The framework isn't too difficult to work in and being able make a desktop build made testing it much easier than constantly using my phone or an emulator.



It's free, so please give it a go if you're interested. I'd also be happy to field any questions.

https://play.google.com/store/apps/details?id=com.myreliablegames.kittycart&hl=en

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
If I wanted to embed a web view into a Unity application targeting windows desktops, what's the best way to do that? Cursory looks for plugins show a bunch of things for mobile, but nothing for windows.. Would I need to integrate CEF?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
why not just

code:
void Update () 
{

    elapsedTime += Time.deltaTime;

    while (elapsedTime > spawnInterval)
    {
        elapsedTime -= spawnInterval;
        SpawnerT.GetComponent<enemySpawner>().spawnHere ();
    }
}

Chernabog
Apr 16, 2007



As it turns out the big desynchronization problem was in a coroutine I wasn't using properly elsewhere.

There are still small irregularities in the spawning interval so I tested both of your approaches Jewel but then it started spawning a bunch of objects at a time. I might just leave it as it is right now because it is barely noticeable and it doesn't really disrupt the gameplay.

Stick100
Mar 18, 2003

leper khan posted:

If I wanted to embed a web view into a Unity application targeting windows desktops, what's the best way to do that? Cursory looks for plugins show a bunch of things for mobile, but nothing for windows.. Would I need to integrate CEF?

Mobile is have the concept of a web view that doesn't exist in Windows. I believe you'd have to integrate CEF or go grab a well reviewed item off of the asset store.

Tann
Apr 1, 2009

PokeJoe posted:

I made another Android game called Kitty Cart.

Not bad! It would be nice to have a jump bar so I could understand how long it takes to charge up the maximum jump. The backgrounds and music make it feel pretty surreal. I think I agree about how it might have been nice to give more focus to the cat, it's not very noticeable that it's actually a cat.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Suspicious Dish posted:

why not just

code:
void Update () 
{

    elapsedTime += Time.deltaTime;

    while (elapsedTime > spawnInterval)
    {
        elapsedTime -= spawnInterval;
        SpawnerT.GetComponent<enemySpawner>().spawnHere ();
    }
}

This is the best one, you don't need a maxPerFrame unless the spawner takes a considerable amount of time.

dreamless
Dec 18, 2013



Chernabog posted:

As it turns out the big desynchronization problem was in a coroutine I wasn't using properly elsewhere.

There are still small irregularities in the spawning interval so I tested both of your approaches Jewel but then it started spawning a bunch of objects at a time. I might just leave it as it is right now because it is barely noticeable and it doesn't really disrupt the gameplay.

If the problem is that they're visually clumping up, you could simulate partial frames for your spawned objects:

code:
void Update () 
{

    elapsedTime += Time.deltaTime;

    while (elapsedTime > spawnInterval)
    {
        elapsedTime -= spawnInterval;
        var spawnedObject = SpawnerT.GetComponent<enemySpawner>().spawnHere ();
        spawnedObject.Simulate( elapsedTime );	// an update function that takes a delta time; or pass in to spawnHere
    }
}
If the spawner's moving you'd have to figure out where it was elapsedTime ago, which is kind of a pain.

PokeJoe
Aug 24, 2004

hail cgatan


Tann posted:

Not bad! It would be nice to have a jump bar so I could understand how long it takes to charge up the maximum jump. The backgrounds and music make it feel pretty surreal. I think I agree about how it might have been nice to give more focus to the cat, it's not very noticeable that it's actually a cat.

Thanks for the suggestion! A jump indicator wouldn't be too hard of an addition, I think I'll add one when I get around to updating it.

RabidGolfCart
Mar 19, 2010

Excellent!
Adjustable rooms.


Now to figure out how to punch holes in it.

RabidGolfCart fucked around with this message at 09:40 on Jun 18, 2016

Py-O-My
Jan 12, 2001
Well this finally happened: http://forum.unity3d.com/threads/zios-editor-theme-support.411818/



Custom editor themes for Unity. A couple of bugs but it mostly works great.

Jo
Jan 24, 2005

:allears:
Soiled Meat
I have a bunch of tiles that I'd like to join into a larger collider for use with Box2D.

This seems like a specialized form of bin packing and I can't think of an algorithm which gives optimal rectangle coverage. I'm thinking something which just recursively merges rectangles in vertical and horizontal passes, but that doesn't seem great. Any suggestions? Or is that optimal?

EDIT: I think this might actually be optimal. I can't find a counterexample yet, but I also can't prove it yet.

Jo fucked around with this message at 17:23 on Jun 19, 2016

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

RabidGolfCart posted:

Now to figure out how to punch holes in it.
Go watch videos of the Natural Selection 2 editor if you want to steal ideas.

Cumslut1895
Feb 18, 2015

by FactsAreUseless

Jo posted:

I have a bunch of tiles that I'd like to join into a larger collider for use with Box2D.

This seems like a specialized form of bin packing and I can't think of an algorithm which gives optimal rectangle coverage. I'm thinking something which just recursively merges rectangles in vertical and horizontal passes, but that doesn't seem great. Any suggestions? Or is that optimal?

EDIT: I think this might actually be optimal. I can't find a counterexample yet, but I also can't prove it yet.

Some kind of Quadtree with the starting rectangle being it's bounds?

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Hi thread. I'm a web developer that is interested in making a game as a side project, just a clone of Tetris to start. What javascript/html5 game engine/library is recommended for a new-to-game-dev but not new-to-programming person? There are a lot of options. In my googling around, melonjs seem simple enough for what I want, but I thought I would check in here for other opinions.

Stick100
Mar 18, 2003

PlesantDilemma posted:

Hi thread. I'm a web developer that is interested in making a game as a side project, just a clone of Tetris to start. What javascript/html5 game engine/library is recommended for a new-to-game-dev but not new-to-programming person? There are a lot of options. In my googling around, melonjs seem simple enough for what I want, but I thought I would check in here for other opinions.

What is your background, what are you goals besides making the game? Where do you want to publish it?

Pixi seems pretty good
http://www.pixijs.com/

Unity3D -> Web GL export has gotten suprisingly solid.

Kongregate and Itch.IO are both decent places to publish HTML5 games now.

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!

PlesantDilemma posted:

Hi thread. I'm a web developer that is interested in making a game as a side project, just a clone of Tetris to start. What javascript/html5 game engine/library is recommended for a new-to-game-dev but not new-to-programming person? There are a lot of options. In my googling around, melonjs seem simple enough for what I want, but I thought I would check in here for other opinions.

You can do it just using canvas if you want. Here's a basic one I did - link. Tetris is simple enough where you just need key input and drawing some sprites/squares, you can concentrate on the game and not the library.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

Stick100 posted:

What is your background, what are you goals besides making the game? Where do you want to publish it?

Pixi seems pretty good
http://www.pixijs.com/

Unity3D -> Web GL export has gotten suprisingly solid.

Kongregate and Itch.IO are both decent places to publish HTML5 games now.

Phaser is another big one. It's a more of a complete engine based off (an older version of) Pixi.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace

Stick100 posted:

What is your background, what are you goals besides making the game? Where do you want to publish it?

My background is I'm a full stack Web Apps engineer, experienced in php & java backend and Javascript frontend. Not much in terms of the real-time interactively of a video game. My goal is just to work on something different, I've never had to manage a game loop for example. I have no plans to publish this besides a code repo on github.

Bob Morales posted:

You can do it just using canvas if you want.

Yes I likely could but I'd prefer the hand holding of a framework on my first go.

I'll check out phaser and the link to the Tetris example, thanks!

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

PlesantDilemma posted:

Yes I likely could but I'd prefer the hand holding of a framework on my first go.

Why though? Canvas isn't complicated in the slightest. I can't see a framework making a tetris clone much simpler than it already would be.

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!

HappyHippo posted:

Why though? Canvas isn't complicated in the slightest. I can't see a framework making a tetris clone much simpler than it already would be.
I'd recommend direct Canvas too. A framework probably won't be hand-holding you so much as forcing you to learn a bunch of extra stuff that you're not familiar with.
I suppose if you're not familiar with games then you have to learn some stuff you're not familiar with either way, but learning how to implement a game loop is probably easier (and more applicable in other contexts) than learning the foibles of a specific framework.

Centripetal Horse
Nov 22, 2009

Fuck money, get GBS

This could have bought you a half a tank of gas, lmfao -
Love, gromdul

PlesantDilemma posted:

Yes I likely could but I'd prefer the hand holding of a framework on my first go.

I'll check out phaser and the link to the Tetris example, thanks!

To side with some of the other people who have responded to you: a framework will not hold your hand. When you decide you want to learn to ride a bicycle, you don't run out and buy a 1,500cc cruiser. Game frameworks work best for people who don't need them. You're going to spend way, way, way more time learning the framework than you are going to spend writing your game. Learn a little bit about delta timing, and you've got the only thing that's going to matter for your entry-level Tetris project.

Edit: Having said that, Turbulenz is pretty cool (but also way too much framework): http://biz.turbulenz.com/

Catgirl Al Capone
Dec 15, 2007

frameworks are really good and useful but if you don't understand the underlying principles of the things they're doing for you, you'll be in trouble when something breaks down.

xzzy
Mar 5, 2009

a medical mystery posted:

frameworks are really good and useful but if you don't understand the underlying principles of the things they're doing for you, you'll be in trouble when something breaks down.

That would require the framework to have effective documentation and an overview of its architecture.

Most of them are "here's a hello world, and a link to the our autogenerated function reference." :downs:

Catgirl Al Capone
Dec 15, 2007

xzzy posted:

That would require the framework to have effective documentation and an overview of its architecture.

Most of them are "here's a hello world, and a link to the our autogenerated function reference." :downs:

yeah that's kinda what i'm trying to imply, there are a lot of really good frameworks with horrendous documentation and the best way to get through it is to have an understanding of the core language so you have some degree of intuition in how to use the functionality the framework provides.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Hey some great replies here. I'll skip the framework stuff for now, seems to be less value there than I was thinking. I'll study that linked Tetris example as my first step. Thanks everyone!

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

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

:allears:
I think frameworks and engines and stuff become more useful the more complex your game is. Since Tetris-level games are on the super simple side of the scale, they don't really benefit from using a framework.

Bongo Bill
Jan 17, 2012

PlesantDilemma posted:

Hi thread. I'm a web developer that is interested in making a game as a side project, just a clone of Tetris to start. What javascript/html5 game engine/library is recommended for a new-to-game-dev but not new-to-programming person? There are a lot of options. In my googling around, melonjs seem simple enough for what I want, but I thought I would check in here for other opinions.

I would go with the Elm language's Graphics or WebGL libraries, rather than doing it in raw Javascript, but that's due to a personal preference for static typing, immutability, having a compiler, not using Javascript etc.

Jo
Jan 24, 2005

:allears:
Soiled Meat

Cumslut1895 posted:

Some kind of Quadtree with the starting rectangle being it's bounds?

I think I need to clarify. Imagine a bunch of boxes sitting next to one another.

code:

####
 ##
 #

The optimal number of rectangles for this configuration would be three.

code:

[####]
 [##]
 [#]

If I iterated the other way, I might end up with four rectangles made from those seven boxes instead. I'm looking for something optimal.

Bongo Bill
Jan 17, 2012

I'm not sure I understand the problem, but it seems you could start with determining the minimum and maximum X and Y values among all of your boxes, and whichever has the smallest difference is the axis you should group along.

Jewel
May 2, 2009

Jo posted:

I think I need to clarify. Imagine a bunch of boxes sitting next to one another.

code:
####
 ##
 #
The optimal number of rectangles for this configuration would be three.

code:
[####]
 [##]
 [#]
If I iterated the other way, I might end up with four rectangles made from those seven boxes instead. I'm looking for something optimal.

I remember something on this topic a while ago when I was attempting to do something similar but I can't find what I'm looking for. I did find a paper Fast Algorithms To Partition Simple Rectilinear Polygons however, which only works if there's no "holes", and a page on simplifying the largest set of rectangles.

Edit: And this one about Voxel face crawling mesh simplification which seems the same.

Jewel fucked around with this message at 23:20 on Jun 25, 2016

Xerophyte
Mar 17, 2008

This space intentionally left blank
Relevant blog posts: Meshing in a Minecraft Game, Part 1 and Part 2

They are more about general voxel meshing than specifically generating covering quads. I'm not sure if you need the quads themselves for anything.

Stuff:
1. You're probably not going to be able to generate an optimal simplification. A greedy algorithm doesn't yield one. Probably shouldn't worry about it.
2. T-junctions may or may not be a problem when rendering, depending on application.
3. If you want the voxels to be editable then you probably don't want the simplification to be expensive to compute since you need to do it dynamically.

E: Oh, hey, colliders, not meshing. Greedy merging approach seems fine then.

Xerophyte fucked around with this message at 23:58 on Jun 25, 2016

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Jo posted:

I think I need to clarify. Imagine a bunch of boxes sitting next to one another.

code:

####
 ##
 #

The optimal number of rectangles for this configuration would be three.

code:

[####]
 [##]
 [#]

If I iterated the other way, I might end up with four rectangles made from those seven boxes instead. I'm looking for something optimal.

My post on region math might be relevant as well if you want YX banded

http://magcius.github.io/xplain/article/regions.html

Jo
Jan 24, 2005

:allears:
Soiled Meat
Thanks everyone for all the great recommendations! The page on rectangular regions is helping a lot. I'll take a look at the others in the morning.

Turtlicious
Sep 17, 2012

by Jeffrey of YOSPOS
I'm downloading Unreal right now, I feel like I'm ready to code my dream project.

It's inspired by Shadowrun (on the Sega Genesis,) but with a ton more content. I want to be able to load content from text files so that users can create or mod huge aspects of the game. I have a design document down, and have done coding for work to simplify my job.

I chose Unreal for Blueprint scripting, and because they don't limit your tools.

It's a roguelike, with some procedurally generated content, and a fairly large hub world.

I've never done a big project like this, what are some things I should avoid?

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Turtlicious posted:

I've never done a big project like this, what are some things I should avoid?
Using Unreal. You literally described the polar opposite of the sort of project that it's easy to convince UE4 to produce. You really want an engine better suited to something procedural / freeform / weird. Unity's a fine choice as a default, though it's far from the only one.

Unreal gets to be a worse choice the further your concept strays from "first person shooter with static, hand-built levels."

ToxicSlurpee
Nov 5, 2003

-=SEND HELP=-


Pillbug

Turtlicious posted:

I'm downloading Unreal right now, I feel like I'm ready to code my dream project.

It's inspired by Shadowrun (on the Sega Genesis,) but with a ton more content. I want to be able to load content from text files so that users can create or mod huge aspects of the game. I have a design document down, and have done coding for work to simplify my job.

I chose Unreal for Blueprint scripting, and because they don't limit your tools.

It's a roguelike, with some procedurally generated content, and a fairly large hub world.

I've never done a big project like this, what are some things I should avoid?

Use unity instead.

Trust me.

Adbot
ADBOT LOVES YOU

Turtlicious
Sep 17, 2012

by Jeffrey of YOSPOS
Every single person I've told my Idea too in the last hour has said use Unity.

I uninstalled Unreal, and installed Unity.

I'm already refactoring!

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