« first day (1938 days earlier)      last day (3098 days later) » 

Jon
12:00 AM
well, the new chipsets coming up support ridiculous amounts of ram
so if you are coding for next gen
 
nope
well, not yet
 
Jon
i was joking, lol
optimize at some point
you pick up tricks along the way
never use foreach in game dev
 
why?
please elaborate
or if there's an article somewhere that's good too
 
Jon
foreach.. used in a update() inside your gameloop for example
it would allocate memory to the stack on each frame
GC heavy operations
 
Hmm, that's right
 
Jon
12:04 AM
using a simple for loop removes that completely
 
I might do some testing side-by-side and see.
 
foreach does some extra function calls too
 
If there's a major noticeable difference, then I'll go with for
 
Jon
you just should.. its not a matter of choosing here
 
Jon
12:05 AM
otherwise, you have a memory leak
 
Really? I'd think Unity3d, or C# would have some sort of automatic GC to take care of that.
 
Jon
memory leak used loosely i guess
GC is slow
if you are using gc needlessly it is bad for your game loop
 
well, the only problem I really have is how to iterate over a Dictionary using a plain for loop
 
Jon
yeah..
dictionaries are a different thing
 
I mean, there's a solution, but from what I can tell it has a time complexity of $O(n^2)$
 
Jon
12:07 AM
typically you don't want to iterate over a dictionary collection
 
granted, that may be better than what I currently have
 
Jon
you may want to rethink your storage
 
I don't really have any other option than a dictionary, as I have to associate each body with a certain mass product
 
Jon
that is fine then
 
Jon
12:09 AM
i don't know if you can iterate through a dictionary without foreach... unless you wrote your own implementation
 
I'd rather not write my own implementation of something that's probably going to be way worse than the default .NET version
 
Jon
depends on what you are doing....
 
wait a minute...
 
Jon
for example.. you could store an array of all the indices
if the data didn't change
 
I could use a List<Tuple<...>> instead
 
Jon
12:11 AM
what is being stored?
 
It looks something like this:
key=Some gameobject value=Mass product
 
Jon
ok, so <float, float>
 
Actually <GameObject, double>, but yeah
 
Jon
so your gameobject, is the key
 
Jon
12:12 AM
why not just a list of gameobjects then?
how many do you have?
 
because each gameobject needs to have an associated mass product with it
@Jon at the moment? 4.
 
Jon
so, extend gameobject, and create a Mass property
then create a list of ExtendedGameObject
 
GameObject is a sealed class, I can't extend it or inherit from it.
Which sucks, but yeah
 
Jon
is this unity?
 
Jon
12:14 AM
then you are wrong
 
thanks?
 
Jon
create a new script
 
I already have one set up
 
Jon
if you look at the script you created, that is extended from GameObject
You can then create a list<ScriptName>
 
Nope. It's MonoBehaviour
Wait, are you talking about the script's main class or the script itself?
 
Jon
12:15 AM
Right... sorry.. which is a gameobject
Every single script you create, is linked to a gameobject
 
uh-huh
 
Jon
unless you don't inherit from MonoBehaviour
lol
uh-huh
anyways, you shouldn't be using a dictionary here
 
okay, what should I be using then?
 
Jon
a list of <Object>
 
List<dynamic> works too, I think
 
Jon
12:18 AM
Object, being the Object type
Your gameobject has a script attached?
 
right.. whatever
yes
 
Jon
listen
i am not a retard
That script, references your gameobject
you can create a list<scriptname>
Not only will it reference everything your gameobject contains... but it will also contain your Script code
 
user4704
List<dynamic> is not something you should use by-default. "dynamic" in general should be a red flag.
 
Jon
so you can put your Mass there.
flag wars!!!
 
Hmm. I don't think this is going to work.
See, the problem is this:
I have a GameObject, which has the GravityComponent script attached.
Inside, there's a Dictionary<GameObject, double> which contains all the other gameobjects in the scene, with a certain tag.
The value for each key is the result of this calculation:
gravity constant * mass of the current gameobject * mass of another gameobject
And the key is the "other gameobject"
I'm not seeing how a List<GravityComponent> would be able to accomplish this.
 
Jon
12:25 AM
ok, so what you need, is that each gameobject in your scene needs to be aware of the mass of the other game objects in your scene
so what does your dictionary solve here? You lookup a gameobject, and get a mass back?
 
No, I get the result of a calculation between the mass of the current gameobject, and another gameobject
Essentially, the top half of this, well-known formula:
 
Jon
that sounds really messed up to me
 
$$F=G\frac{m_1m_2}{r^2}$$
 
Jon
each entity should make these caculations by themselves, based on if they require movement or not
in their Update() method
 
But that's not ideal.
 
Jon
12:28 AM
how long have you been doing game dev?
 
The reason I'm storing the values in the dictionary is because I don't need to re-calculate them every frame.
 
Jon
just curious, because the way a game loop works can confuse newcomers. not trying to offend
 
About half a year now. I've been programming for a good 3 years at this point
 
Jon
Ok, so you have a dictionary, that updates how many times?
 
not at all
the reasoning being:
- The amount of bodies that "have gravity" never changes.
- The masses of the bodies that "have gravity" never change.
 
Jon
12:31 AM
distance changes?
 
yes, but distance is re-calculated every frame
 
Jon
if you just need a quick lookup, dictionary is great... I honestly have no idea what you are using them for atm
 
If I drew up a quick graphic or something would that help?
 
Jon
why can't that value be stored in the gameobject script?
if it never changes
 
Because there are multiple different values that need to be stored
Here, I let me get the code into the github repository.
 
Jon
12:33 AM
ok... i'll just bow down then, i have no idea what you are doing
 
Jon
ok, show me the code
 
one second
using UnityEngine;
using System.Linq;
using System.Collections.Generic;

[System.Serializable]
[RequireComponent(typeof(Rigidbody))]
public class GravityComponent : MonoBehaviour
{
    public double gravitationalConstant = 6.674 * Mathf.Pow(10, -11);
    public Vector3 startingForce;

    private GameObject[] _bodies;
    private Dictionary<GameObject, double> _massProducts;
    private Rigidbody _bodyRigidbody;

    /// <summary>
    /// Initalize various private values and caches, like the
    /// cache of bodies, masses, etc.
git is being annoying, so there it is
 
Jon
this is unity?
oh man
you must come from .net 4.5
dude is just liberally using linq, and dictionaries like he is a boss
:)
 
Hey, you know, I was suggested to do that
not my idea :P
 
Jon
12:37 AM
if you are in unity, you typically wanna stay .net 2.0 for maximal portability
ok so what you are doing, is calculating a value once
then storing it in a dictionary.
You could just put that calc in the Start() method of that gameobject
but it doesn't really matter.. this works fine
weird.... but its fine
 
Okay, now that everything's been mostly cleared up with the addition of the code, what is it that you find strange about it?
 
Jon
body.transform.position

why not

body.mass?
double attraction = body.Mass / bodyPositionDifference.sqrMagnitude;
wouldn't that make sense to you?
ohhhh, waitaminute
 
the mass is already stored in the rigidbody.. I think you've figured that out ;)
 
Jon
aight
well, you can still drop the foreach in the fixedupdate :)
 
cool
let me just figure out how one manages to iterate over dictionaries using a plain for loop
 
Jon
12:43 AM
it is not really possible
unless you store an index of values
which defies the purpose of a dictionary
 
turns out I really like this song:
 
whups, I just lost 6 minutes of simulation time because I forgot to disable the sphere colliders on two objects
 
Jon
I was thinking of making a game that links multiple games together
 
Wooo, code rebuild night.
 
Jon
But all in the same format, inspired by that chopper game I made recently
Chopper, plane, tank, car, boat, whatever means of transportation and whatever crazy game I can make with it
I am working on a prototype, 2d airplane game with Tron bike mechanics
It is pretty wicked
 
1:10 AM
@Jon so, right angle turns and such + light ribbon?
 
Jon
Stick around and I'll demo it at some point
It is not a grid based game
F/R
 
@Jon Wow, that Unity webgl stuff is pretty slick
 
Jon
Yeah it works for the most part
Frankly it has to
Sounds are still a little iffy. Networking doesn't work at all
 
that sucks
 
 
2 hours later…
3:19 AM
I'm getting this weird thing where going to google.com on Firefox fails to load but it works fine on chrome
 
Pip
4:17 AM
that
....is odd
@Jon awesome
 
 
3 hours later…
user92578
This was posted earlier but it's realoy hilarious!
 
user92578
-6
Q: Error declaring constant?

Mane G.I want to achieve the following but I keep getting 2 errors: public class ClassKey : MonoBehaviour{ const int rend.bounds.max.y = 20; } Errors: error CS1519: Unexpected symbol `.' in class, struct, or interface member declaration error CS1519: Unexpected symbol `=' in class, struct, or inte...

 
what the what
but I'm using Unity!
 
 
2 hours later…
9:09 AM
@Leathe oh dear ... such a pain isn't it!
 
hm?
 
lol trying to implement voxels in unity is beast
 
 
2 hours later…
Jon
11:19 AM
unity eats voxels for breakfast
 
 
1 hour later…
12:28 PM
@Jon yup ... finally my entire voxel framework working on the cpu
now looking at offloading the work to compute on the gpu within unity
do you think it would be safe to go directly to the openGL api from within unity?
I was hoping to have my voxel framework compiled and usable anywhere
 
Does unity on windows use opengl?
According to google: It can be forced to by a commandline flag
 
user92578
I would guess it defaults to DX
 
user92578
(Which is weird, why would anyone still build DX versions of engines?)
 
Because windows driver support for opengl is still fairly crap
 
user92578
really?
 
user92578
12:35 PM
okay, did not know that
 
I would have guessed that keeping your graphics card drivers up to date would alleviate that?
 
Recently yes, for nvidia and amd cards
Intel and such still lag behind last I checked
 
What is the issue with these? They don't support most recent features or something?
 
IIRC lack of features, more bugs and less performance
But don't quote me on that =p It's been a while since I looked it up
 
No worries, I'm just curious :) I don't work with unity, and we're suggesting our customers to use NVidia cards, with the latest drivers (But we work with OpenGL) :P
 
Jon
12:54 PM
@Wardy you probably want to look into Compute Shaders
 
Jon
1:29 PM
 
user92578
Really cool
 
What are the squares? Just debug things?
 
Jon
naw, colliders
 
Aah
Can you do a rotated cylinder? That might be more accurate
(Or given that this is 2d, a stretched rotated square...)
 
Jon
yeah, i could put whatever there, atm it is a square :)
but you are right, i should adjust based on angle/etc
 
1:41 PM
@Jon lol
@Jon yeh thats exactly what i'm doing
but the code in quesiton will be in my voxel core framework
and I don't want that to require a unity reference
feels a bit shit
unless I can make unity API calls when the voxel framework is deployed inside another engine
unless I write some sort of interface that I would then write an engine specific interface for
feels a bit ... hmmm
this is the sort of high level (as in orbital high) that @MickLH is good for :)
its a design question i guess
Maybe I could somehow talk directly to that libSatanicCurse that he previously mentioned
I literally just need to do some compute stuff, with it
 
user92578
Have you tried libSatanicCurse.disable();?
 
@Wardy this is where an API comes in =p
Make a pure CPU implementation (the one you have) and one that uses unity compute stuff
Then just let people implement the right stuff and set an object properly
 
user92578
BTW Thanks once again for showing me that #define enum value trick Kevin, I'm using it for the editor a lot
 
@KevinvanderVelden yeh the idea is that my voxel core is an api that would be consumed by the user
I'm planning to port all my noise functions on the gpu too once I get the voxel code over
but I at least have a pretty good surface gen now
 
Well, implementation would mostly be "Add a reference to this DLL for unity or this DLL for cpu"
 
1:52 PM
@KevinvanderVelden yeh maybe I just say that all my GPU implementations are in their own assembly but implement a common interface defined in the core
 
basically the provider model
 
That also gives the option of people implementing their own version if they so desire
 
IGpuVoxelContainer and IGpuVoxelGenerator
yeh
@KevinvanderVelden random thought ... if i implement a raw OpenGL and a raw DX version they in theory should be all the implementations needed
then i basically write code to pull the result and give it to the calling code which could be written in any engine
@Tyyppi_77 lol how did i miss that ... I think doing that might reuslt in blank screens, Mick's point was that all graphics apis depend on something inherently evil but it must be given the nature of what it does lol
 
user92578
ah
 
user92578
1:59 PM
oh man soon I can start listening to christmas songs!
 
uh ...
 
user92578
OH NO ALMO
 
user92578
the user images were nicely on one row
 
quick everyone hide
 
user92578
and then you came and screwed it up
 
2:02 PM
resize your browser
 
user92578
/votekick Almo
 
I have 4 on the second row
 
lol
 
user92578
it's already fullscreen
 
get a 4k screen
 
user92578
2:02 PM
lol yeah
 
nowhere near 1 row for me
 
hold ctrl and roll your mousewheel
 
user92578
squints
 
Jon
I want a 5000K screen... sick of these companies rolling out mediocre incremental upgrades
 
but wouldn't everything be red?
 
Jon
2:08 PM
5000K resolution man, i want my games to be so damn crisp that I will shit myself and wonder if the shit came from the game
Check this shit out -- this is real.
 
Storm troopers aren't real. I hate to break it to you man...
 
@Wardy pretty much, I mean, unless they want to do something with raytracing, or vulkan, or mantle =p
 
Jon
2:29 PM
 
2:44 PM
@Almo they are now ... this guy got photo evidence of it
@Jon lol
@KevinvanderVelden this is only for management of voxel data
 
Jon
3:19 PM
 
neato
 
Jon
so.... how would you do a side view plane physics implementation?
 
3:40 PM
kind of like what you have
I think
not like this
 
 
1 hour later…
Jon
4:59 PM
how would you calculate the FL here?
when it is at angle == 0 , the FL would be equal to FG to equal it out
 
FL is dependent on the plane's forward velocity and the pitch of the aerleons (or whatever those things are called)
 
Jon
flaps
 
no, flaps are different
flaps are generally used only for landing
 
Jon
the thing is, the FL tops off at FG .. wouldn't it?
 
I don't think so
imagine going supersonic straight up with aerleons set for normal flight lift
 
Jon
5:03 PM
for the purpose of this simulation -- we will assume FLAPS are removed
 
An aileron (French for 'little wing') is a hinged flight control surface usually forming part of the trailing edge of each wing of a fixed-wing aircraft. Ailerons are used in pairs to control the aircraft in roll (or movement around the aircraft's longitudinal axis), which normally results in a change in flight path due to the tilting of the lift vector. Movement around this axis is called 'rolling' or 'banking'. The aileron was first patented by the British scientist and inventor Matthew Piers Watt Boulton in 1868, based on his 1864 paper On Aërial Locomotion. Even though there was extensive prior...
so I guess those aren't for lift, and flaps are for lift
 
Jon
right, however, the wings also provide lift
 
yeah
 
Jon
trying to get this to feel right, is pretty hard
 
5:26 PM
yeah flaps are used mainly for landing, because they increase lift, meaning the plane can fly at a lower speed. they just also increase drag so they're raised when they aren't needed.
iirc from flight sims, flaps are also used to recover from a stall, but I forget the details
 
5:39 PM
@Jon do a normal 3d implementation then always position the camera to the side?
 
 
1 hour later…
6:45 PM
@AlexandreVaillancourt Gorilla vs Shark questions are off-topic :)
valiant answer though :)
 
Hmm, I'm not sure if it's exactly that, as they're not the same "kind of things" as one doesn't have to decide between OpenGL and pygame... but heh! let's close it :P
 
:D
ok now what
I edit the file in VS, hit save and it says "File has been modified outside the editor. reload?"
 
is it that file that has been modified? or is it CMake something related?
I know something like that happen to me once in a while.
 
oooh
VS had two tabs open with the same file
save one tab, other says "hey!"
 
6:52 PM
hahaha
 
Jon
7:50 PM
ugh
 
what's ugh
 
Jon
hard to find a fun plane mechanic
 
@Jon Perhaps one of these would suit you?
 
Jon
lol no
 
7:58 PM
like, flying, shooting, avoiding?
 
Jon
yeah
 
@Almo He deleted his question it seems..
 
AFTER BURNER II!!!!!!
 
I play a SHITLOAD of ABII
on a standup model, I was able to get to level 18 without out continues
the main trick was that if your velocity was changing, the missile would miss. You could also barrel roll to help them miss
so you'd slow down, then when missiles were close slam the throttle for afterburner (high velocity change) and they'd miss then you slow down again.
Really good fun
 
Jon
8:45 PM
meh
 
requires the controls of the arcade machine though
analog stick and throttle that you can really push around hard
in fact, have to.
the throw on the stick was like a foot or more, and you had to move it fast left/right to trigger barrel rolls
playing that on an emulator with a pad will be useless
 
the physical element of using whatever real-world controls is half the fun sometimes
 
woa
 
heh :|
 
wonder what that cost to replace
no prices :(
ok on the order of thousands of dollars
plus the chain
chain costs as much as the anchor looks like
 
9:07 PM
bet the shipping cost is heaps
 
9:23 PM
hahah yeah
having friends who work on steam games is annoying
popup every 10 min XXX is playing YYY
 
I try to go offline sometimes when I'm in a come-and-go testing session like that lol, cuz yeah it's annoying
 
:)
 
 
1 hour later…
10:54 PM
Evening
 
Hello
 
@Steven suggested I move gamedev.stackexchange.com/questions/111964/… here to chat for more open-ended discussion. I'm actually leaving for the evening, though, so this will have to be a multi-day discussion of sorts.
 
Yeah, the main site is more for non-broad questions, less discussion and just straight answers where possible
I think Nintendo's begun shifting their ways
but currently, yeah, have to pay for a devkit
 
Annoying, that is…
 
Their company, their decisions haha
 
11:02 PM
japanese companies seem to operate on completely different principles than companies in the rest of the world, especially western ones
 
Really dunno what the future holds. Worse case scenario, they stop producing hardware and just embrace other consoles and PC and mobile
yeah
 
to me it seems they just do whatever they want and don't give a shit about anything, lol
so predicting what might make them change is pretty hard, at least from my perspective
 
Well, Nintendo has been seeing reduced sales in recent years, triggering the shift to opening up to indies and even trying out stuff on mobile now
so they're at least aware that it's not all smooth sailing haha
 
Well, maybe you guys can pore over your crystal balls while I'm away for the night. I'll see you guys later.
 
see you
 

« first day (1938 days earlier)      last day (3098 days later) »