Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 27, 2024, 07:20:59 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 160 161 [162] 163 164 ... 279
Print
Author Topic: The happy programmer room  (Read 678621 times)
Quarry
Level 10
*****


View Profile
« Reply #3220 on: February 10, 2013, 05:02:29 AM »



SLIDING DOORS (sorry for no gif)
Logged
nikki
Level 10
*****


View Profile
« Reply #3221 on: February 10, 2013, 05:22:18 AM »

sure yeah : to each their own, and many people have differnt preferences.
my point is that it's more then possible in c#.

the operators on number(objects) '3.To()' for example is really tight and normal in languages like Python, Ruby, Smalltalk etc.

and the point thing I couldn't really understand from the c++11 example, so when I undertand what the goal is of that code  I'll show you a c# way of doing that Wink or not Smiley



Logged
Geti
Level 10
*****



View Profile WWW
« Reply #3222 on: February 10, 2013, 06:17:13 AM »

It's an array of objects - I named the type "PointType" to be as clear as possible (though I think his in that example is "Point". The "&" implies that the variable is a reference in C++ (and C, for that matter).
I gave you an example of the "expanded" version. Your point that "it's more than possible in C#" isn't exactly smart to make if you don't understand what the original code means/does. I wouldn't mind seeing a C# way of doing the code he says for argument's sake though. I expect it to look quite similar to your code but with a statement in there using "i" to get the object out of the array at this point.

@Quarry: 43fps seems a bit low for such chunky graphics even on the CPU, what's going on there? Expensive physics or just not bothering to optimise while it's early days? Looks fun either way.

I'm pleased cause I got some hacking in this weekend on my component based framework in Java and although the language has been fighting me the whole way, I've got a simple peer to peer (able to masquerade as client server of course, by having one peer relay all the necessary crap around) networking thing going on top of it, with some built in functionality like accepting connections, keepalive, disconnection and whatnot (requiring a password hash is on the list of things to do) as well as the ability to roll your own messages to send between states.
It's all built on top of the (now very familiar to me) Bitstream class ported from our current engine so it's able to be light on bandwidth where needed and still nice and fast sequential reads and writes.
Got to make built in Sync() functions for each of the components that needs it now plus a way of syncing the message passing system in the container entities as well of course. Been struggling to keep it data-oriented in Java so I've kinda just conceded that it's going to be nicer to program with a hybrid system.

Been missing C++ every time I do Java work recently, spend way too much time handling exceptions that aren't likely to arise and working with 5 different types to accomplish a simple task (InetAddress + port, SocketAddress, byte[], Vector<Byte> (ugh), BitStream, DatagramPacket, DatagramSocket...) when all I want to do is send a chunk of bytes to an address over UDP and handle the rest as part of the protocol.
Should've used Scala to at least alleviate one of the headaches. Might port it later if I get excited.

...This is turning kinda grumpy, haha.

Back to KAG work this week of course either way Smiley
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3223 on: February 10, 2013, 06:33:26 AM »

Got a lot of the performance issues and timing issues fixed on my vita engine done this weekend. Feels like anything I add at this point are additions and not related to optimizing performance. I may move some graphics manipulations to the GPU because the Vita is heavily in favor of the GPU.

So with that done. I actually got to work on my game this weekend lol..
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3224 on: February 10, 2013, 06:39:02 AM »

It's an array of objects - I named the type "PointType" to be as clear as possible (though I think his in that example is "Point". The "&" implies that the variable is a reference in C++ (and C, for that matter).

exactly, that was an Array<Vector>, so an array of at least 10 3D points.
The range() function is valid over any Array object independent on what it contains, so it's a bit more powerful than a thing enumerating ints Smiley

And it even works "to the end"
Code:
for( auto& obj : objects.range( 1 ) )

or in reverse Cool

Code:
for( auto& obj : objects.range( 10, 3 ) );

the stl way of doing this is still pretty horrible and iterator heavy, too.
Logged

nikki
Level 10
*****


View Profile
« Reply #3225 on: February 10, 2013, 06:52:11 AM »

Quote
I wouldn't mind seeing a C# way of doing the code he says for argument's sake though

ok

Code:
            foreach (int i in 3.To(10))
            {
                Console.WriteLine(points[i].ToString());
            }

where points is an array of objects, in this case many int and 1 vector3
Quote
object[] points = new object[] { 1, 4, 5, 3, 2, 4, 5, 6, new Vector3((float) 2, (float) 3, (float) 4), 3, 5 };

edit : removed answer to 'not very smart' stuff
let's be happy instead Wink

« Last Edit: February 10, 2013, 07:51:07 AM by nikki » Logged
Garthy
Level 9
****


Quack, verily


View Profile WWW
« Reply #3226 on: February 10, 2013, 02:27:54 PM »

my game development framework is split up into lots of tiny libraries, each with its own makefile that often has small but important differences from the template. At some point I need to do some work to get them sharing makefile code better, but I haven't figured out the right way to do it yet... The makefile is a hulking monster at nearly 1000 lines, so taking it apart and reassembling it in a more modular way isn't a small task.

Here is an option based on what I did when faced with something similar:

Write a tool (using eg. Ruby, Python, or Perl) to generate the Makefiles from a template for each file. The first pass is easy- your initial template is just the initial file, and the generator just reads the template in, line for line, and prints it out, no changes. Then, as you spot common chunks of code, you add extra features to your generation script, further reducing the size of your various Makefile templates. You then add the ability to specify options to your script inside the template itself. Then, every small but important tweak in individual Makefiles becomes an extra configuration option that your tool can read, understand, and emit code for.

To assist with this, early on you develop a test script that takes a snapshot of all of the Makefiles in your project. Before you change the tool you take a snapshot, then you make changes, then you verify that the output (the Makefiles) is identical for all of the files. All automated of course: You have a script to snapshot, and another to check.

You then repeat until your Makefile template files are about a dozen lines long. Your script allows you to make wide changes to all of your Makefiles easily and simultaneously, and you no longer have a maintenance nightmare.
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #3227 on: February 10, 2013, 04:18:40 PM »

So with that done. I actually got to work on my game this weekend lol..
Hooray! Optimisation slog is a drag. Have you seen your software running on the real device yet? That's always a fun step for me Smiley

the stl way of doing almost anything is still pretty horrible and iterator heavy, too.
ftfy Grin
Here is an option based on what I did when faced with something similar:
You're just solving the same problem addressed by premake et al with this though. Reinventing the wheel can be fun, but for makefile generation?..

Code:
            foreach (int i in 3.To(10))
            {
                Console.WriteLine(points[i].ToString());
            }
This is pretty much what I was expecting - it means that what Tommo posted isn't something that can be done 1:1 in C#. In his loop not only is the expression more descriptive, it gives you a "free" local reference to the object, where in yours you would have to do
Code:
object point = points[i];
to get the local, requiring another line of code and burning more precious seconds of your life Wink
to give you a comparison with the STL way of doing it without auto or ranges:
Code:
vector<Point>::iterator end = points.begin() + 10;
for (vector<Point>::iterator it = points.begin() + 3; it != end; ++it)
{
    point& point = *it;
    //code here
}
So you can understand why he's pleased with removing most of that syntactic overhead.

edit : removed answer to 'not very smart' stuff
let's be happy instead Wink
While I can agree with the happy sentiment, feel free to respond; this is a place for discussion and learning, not just feeling great about everything Coffee
Logged

Garthy
Level 9
****


Quack, verily


View Profile WWW
« Reply #3228 on: February 10, 2013, 04:50:54 PM »

Here is an option based on what I did when faced with something similar:
You're just solving the same problem addressed by premake et al with this though. Reinventing the wheel can be fun, but for makefile generation?..

ThemsAllTook has obviously spent a bit of time in getting the Makefiles how he wants them, and is now running into maintenance problems. The solution I've offered allows him to retain that work whilst reducing the maintenance nightmare that has been arisen. It has served me well in multiple contexts, and I think it could serve him well too. You dismiss it far too quickly.

Perhaps you could instead elaborate on the benefits of premake, so that ThemsAllTook has further options. Premake could very well be the best solution to his problem.
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #3229 on: February 10, 2013, 05:54:42 PM »

Perhaps you could instead elaborate on the benefits of premake, so that ThemsAllTook has further options. Premake could very well be the best solution to his problem.
If it would help.
Premake is a build configuration system that's scripted with Lua. It allows quick, portable description of build solutions, like so: (example ripped from their site, the KAG script is a fair bit heftier, haha)
Code:
-- A solution contains projects, and defines the available configurations
solution "MyApplication"
   configurations { "Debug", "Release" }
 
   -- A project defines one build target
   project "MyApplication"
      kind "ConsoleApp"
      language "C++"
      files { "**.h", "**.cpp" }
 
      configuration "Debug"
         defines { "DEBUG" }
         flags { "Symbols" }
 
      configuration "Release"
         defines { "NDEBUG" }
         flags { "Optimize" }

if you saved this as "example.lua" you'd then generate a makefile from it with "premake4 --file=example.lua gmake".

because it's a lua script, you can do a lot of the programmatic things you'd do in any homebrew makefile generator, just without having to do all the nasty concatenation into parsable text yourself; you just have to build the lists of files to include, defines to set and so on.

It's free, and can be found here: http://industriousone.com/premake/download
Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #3230 on: February 10, 2013, 08:35:03 PM »

Here is an option based on what I did when faced with something similar:

Write a tool (using eg. Ruby, Python, or Perl) to generate the Makefiles from a template for each file. The first pass is easy- your initial template is just the initial file, and the generator just reads the template in, line for line, and prints it out, no changes. Then, as you spot common chunks of code, you add extra features to your generation script, further reducing the size of your various Makefile templates. You then add the ability to specify options to your script inside the template itself. Then, every small but important tweak in individual Makefiles becomes an extra configuration option that your tool can read, understand, and emit code for.

To assist with this, early on you develop a test script that takes a snapshot of all of the Makefiles in your project. Before you change the tool you take a snapshot, then you make changes, then you verify that the output (the Makefiles) is identical for all of the files. All automated of course: You have a script to snapshot, and another to check.

You then repeat until your Makefile template files are about a dozen lines long. Your script allows you to make wide changes to all of your Makefiles easily and simultaneously, and you no longer have a maintenance nightmare.

Wow, why didn't I think of that? Sounds like just what I need, thanks for the suggestion!

You're just solving the same problem addressed by premake et al with this though. Reinventing the wheel can be fun, but for makefile generation?..

I suppose I should look at premake and tools like that to see if they'd fit. I have a knee-jerk reaction that makes me think they won't suit my needs since my makefiles are so meticulously crafted, but that's not a reasonable assumption to make (lol) without having looked into it.
Logged

Garthy
Level 9
****


Quack, verily


View Profile WWW
« Reply #3231 on: February 10, 2013, 09:00:22 PM »

Wow, why didn't I think of that? Sounds like just what I need, thanks for the suggestion!

Not a problem, happy to help. It is a solution that works well for large, established projects, as you can make gradual changes without disrupting your existing work, and it allows you to capture your knowledge of the problem in a single place (eventually), rather than across multiple files that need to be maintained in-sync. It has saved me a lot of time over the years.
Logged
oahda
Level 10
*****



View Profile
« Reply #3232 on: February 11, 2013, 11:42:04 PM »

Time for Android development. \o/

Logged

pxl
Level 0
**


@pixelforge


View Profile
« Reply #3233 on: February 12, 2013, 02:48:11 PM »

Currently working on my first game in between college projects and its a real motivator.
Nice thing to bury my head in when stressed and my first games quite similar to Space Invaders but local multiplayer? I don't know, I have a playable version but one day I'll probably change a whole lot of it and then release it.

Anyway, I'm not grumpy and Game Development makes me happy, so I'll keep doing it  Wink
Logged

pxl
Level 0
**


@pixelforge


View Profile
« Reply #3234 on: February 12, 2013, 02:51:27 PM »

Time for Android development. \o/



\o/  Good luck dude
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3235 on: February 12, 2013, 06:30:29 PM »

So with that done. I actually got to work on my game this weekend lol..
Hooray! Optimisation slog is a drag. Have you seen your software running on the real device yet? That's always a fun step for me Smiley


Oh yeah that's what all the optimization code has been for. It's always run fine on the simulator but the Vita itself was a little rough. I can now draw about 500-600 sprites no problem. If they are colliding it's significantly less though of course Smiley

As for the xperia phone. No way I'm buying that, hopefully it just dies soon.
Logged

pixhead
Guest
« Reply #3236 on: February 13, 2013, 09:35:16 PM »

Dare I say it

I'm starting to like C/C++

After all the pain it put me through, I have begun to understand it's in and outs, and it's making me really appreciate the language.
Logged
impulse9
Guest
« Reply #3237 on: February 14, 2013, 04:55:51 AM »

@pixhead

Welcome to the club. Smiley
Logged
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #3238 on: February 14, 2013, 11:33:07 AM »

Code:
FreeMotion::FreeMotion(Bone *a, Bone *b) :
Joint(a, b),
{
}
FreeMotion::~FreeMotion()
{
}

String FreeMotion::nameDOF(Uint32 i) const
{
String s = ((i/3) ? L"Rotation " : L"Translation ");
s.push_back(L"XYZ"[i%3]);
}

Pos FreeMotion::transform(const Bend &b) const
{
return Pos(Point3D(b[0], b[1], b[2]), Quat(Point3D(b[3], b[4], b[5])));
}

Vel FreeMotion::dTransform(const Bend &b, Uint32 i) const
{
return Vel(Point3D(i==0, i==1, i==2),
Rotate(Point3D(i==3, i==4, i==5), -.5f*Point3D(b[3], b[4], b[5]));
}

Simplicity is robustness, says the engineer.
Speak little, tell much, says the artist.
They realize they are not so different.
Logged

Creativity births expression.  Curiosity births exploration.
Our work is as soil to these seeds; our art is what grows from them...


Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3239 on: February 16, 2013, 04:54:03 AM »

Took me about 30-40 minutes, but finally got my fill tool done :3
Turns out it was only 56 lines.
Logged

Pages: 1 ... 160 161 [162] 163 164 ... 279
Print
Jump to:  

Theme orange-lt created by panic