Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


patrrr

Member Since 01 Oct 2005
Offline Last Active Dec 23 2014 05:40 AM

#5174111 Help with ArrayList Java

Posted by patrrr on 16 August 2014 - 11:50 AM

This code should theoretically work, however I haven't tested it ( getting ready for work as I type this message ) .

ArrayList <Object> Something = new ArrayList <Object>() ; 

 "Object" is a generic that should be able to hold any kind of Object .

Which is what ArrayList without the generics will result in, afaik smile.png




#5174062 Help with ArrayList Java

Posted by patrrr on 16 August 2014 - 03:51 AM

Thank you megadan, I now have it reading the ArrayList using Class<?>. Now my problem is adding elements to an ArrayList<Class> from ArrayList<Class<?>>.

 

Example:

ArrayList<Moves> moves;
ArrayList<Class<?>> importedMoves;

for (int x = 0; x < importedMoves.size(); x++){
moves.add(importedMoves.get(x));

Is there a way around this?

Just remove the generics all together, it seems like you don't want type checking. This can cause problems in the future though (you'll need to type cast), and it'll also make the code harder to understand.




#5165748 GPL licence question

Posted by patrrr on 09 July 2014 - 01:14 AM

Some GPL libraries are dual-licensed with LGPL as well, which means that you don't have to release your code if you link to the library as a dynamic library. Also, there are many libraries using, in my opinion, more sane licenses like MIT/Apache/BSD.




#5126283 i tried mingw, ogl, ocl, winsocks and android .. what else

Posted by patrrr on 25 January 2014 - 04:11 AM

 

 

 

1. Unity3D + JavaScript/C#

2. UDK + UnrealScript

3. WebGL --> three.js which you can find here

 

seem to be good options to try for me - maybe yet something more?

More what?  Jack of all trades is master of none, unless your name is John Carmack.

 

"Specialization is for insects." — Robert Heinlein

 

Though it's good to at least become better-than-average in the things you learn.




#5109276 How Languages Compare?

Posted by patrrr on 14 November 2013 - 03:16 PM

Yeah, polymorphism is useful. But thing is, you can implement that in C as well, which is what the large projects I've worked at have done. Structs might contain function pointers for example, implementing a service.




#5109267 How Languages Compare?

Posted by patrrr on 14 November 2013 - 02:49 PM

 

 

I understand what you are saying there (not really, as I lack the experience of writing large programs to claim understanding). I imagine managing any large programming project is not trivial, but I am curious about what it is that makes managing the larger programs in C++ easier? I have heard the quick answer of "classes", and perhaps this is another question that I need to experience as opposed to hear an answer to, as the quick answer does not really feel like it enhances my understanding (I often take this as a sign that I am missing some fundamental understanding that would make the quick answer more complete, if I had the knowledge). I assume that what Winfield said above is a  Edit::workable good::Edit option, so I guess I am wondering if there is something else that I am not familiar with in C++ that makes it easier to manage code for bigger projects, or if perhaps I need to write more C++ before I will really see the benefits?

Sorry if some of these questions are kind of silly (perhaps). I presume the wonderous shield of 'newb', which should be obvious from said questions, should afford me some pity, assuming that I manage to improve....eventually.

 

Edit::I felt like "workable" may have been communicating a negative or perhaps diminished appraisal of the option that I did not intend.

 

 

Without classes you will end up with a function like GetPositionOfWalkableForOutherSystem(). Where with classes this could be broken into something like this:

 

pWalkable = OutherSystem.GetWalkable();

position = pWalkable->GetPosition();

 

I think that this example is much easier and more readable. Lets say that you have 150 functions as in first example, you will start very soon to struggle to find something you want.

As Agony sad C++ saves a huge time. If you use a lot of functions as in  first example they will start to be dependant of each other and you will not be able to find this dependency very quickly. With classes you just know where the things are as classes provide that for you.

Also Agony sad that learning C might make you better at C++. Its true, and if you know assem things will be a lot more clear to you.

 

This is false. Why would you do it that way, and not like this?

othersystem_getposition(pWalkable, &position);

When you start talking about systems that have 1000000+ lines of code, it doesn't really matter much whether you use classes or "not". Encapsulation is still very much possible in C. You could ask Linus Torvalds what he thinks on the subject.




#5094638 ridiculous compiler output...

Posted by patrrr on 17 September 2013 - 04:02 AM


this is the issue.

even if building for debug, this is still a lot of code to accomplish the task...

though, even as such (funky array assignments and being a debug build aside), the codec still gets moderately good performance overall.

 

So the issue is the amount of code that is generated, not the performance hike? Just compile with optimizations. I don't see the problem, and profiling non-optimized code sounds a bit meaningless. Debug symbols are good to have though.

If it's just the bounds checking that is annoying you, you can probably disable it somehow.

Btw. Didn't you find this out during your research? http://www.gamedev.net/blog/1645/entry-2258708-bounds-checking-in-c-it-would-appear-so-sort-of/




#5089490 C++ Optimization week!

Posted by patrrr on 27 August 2013 - 07:26 AM

You can also use precompiled headers, or headers that include things that rarely change.




#5081154 "New" to OOP

Posted by patrrr on 28 July 2013 - 02:17 AM

 

Warnexus, yes I do understand at least that. I also understand how superclass can have children that will inherit all methods and properties (extending).

Taking this simplified theory to actual practice is where I'm having troubles.

 

For example, if I want to design a map system with enemies on it, I'll instantly think of making an array for the map coordinates along with an array that contains all game objects, etc. Unless forced, I will not naturally think in terms of 'objects' & 'classes' because, while I believe I understand the underlying theory, I'm having a rough time applying it in context and leveraging it efficiently.

 

One thing I'd like to do is to code pong in a non-procedural way for example, but I'm having a hard time architecturing my concepts in terms of classes and objects. I can code allright, but I can't think in terms of how it needs to be built if it is to be OOP.

 

Is it any clearer? (its hard to talk about things I only half grasp)

The point of a class is for re-using code which prevents duplicated code and allows for reusability of this class in other projects.

Before jumping ahead to code up the game, take paper and a pencil and think about the general things that are going to be in the game.

 

 

I don't think the major point of classes is really re-use; they're great for re-use of classes, but that's a truism. Often though, you have a pattern of accessing an already existing object and want to reuse that pattern, so you use a function. Functions aren't part of the generic "class" definition but have been added to Java's classes because they are so useful for re-use.

I would say that the point of classes is that their way of describing encapsulation is easy to understand and that their invariants are easy for the environments to enforce, making development more stable due to fewer variables.




#5067583 Uses of 'new' syntax.

Posted by patrrr on 05 June 2013 - 04:36 AM

BloodyEpi: According to section 12.6 of the standard:

Foo foo;
MyClass p(foo);

calls p's constructor which takes a foo while

Foo foo;
MyClass p = foo;

first creates p using the same constructor as in the previous example and then uses MyClass's copy or move constructor if available.

The standard makes room for optimizations in these cases, it's called Copy Elision.




#5052844 Hi .. how much get paid top 3D engine developper at major company?

Posted by patrrr on 13 April 2013 - 11:21 AM

It's very hard to give you a number value, even more so when you're claiming to be a genius. You'll get what someone is willing to pay for you, which means that you will have to apply for jobs and see what kind of figures you'll be hearing. It depends a lot on your ability to directly or indirectly sell yourself.

The closest you'll get is the article Tom pasted, I'm afraid.




#5052096 First time attempting multi-player with UDP sockets, weird error

Posted by patrrr on 11 April 2013 - 07:45 AM

Then it's not static, it would look like this if it was:

 

static DWORD WINAPI RecvThread(LPVOID);

 

I can see you're also using class instance variables in RecvThread; "Socket", "RemoteAddress", etc. They're not accessible due to the function being static.

You can use "knock" as the object instance, like this:

DWORD WINAPI Application::RecvThread(LPVOID knock)
{
	Application *instance = static_cast<Application *>(knock);
	while(true)
	{
		PLAYER Recv;
		recvfrom(instance->Socket, (char*)&Recv, sizeof(PLAYER), 0, (sockaddr*)&instance->RemoteAddress, &SizeInt);

		Player = Recv;
	}
}



#5049937 Xcode Help

Posted by patrrr on 04 April 2013 - 08:07 AM

Is it a "Command line tool" Hello World or Cocoa? If it is, and you compile+run it with cmd-r, you'll see the output in a field that pops up below the code. It doesn't show a terminal window, just that output log.




#5038970 Best Multiplatform IDE?

Posted by patrrr on 04 March 2013 - 02:27 AM

Extending is just a part of it, bare-bones vim/emacs is already a serious development tool. What's wrong with "fancy key commands" if most of what you do in the editor is type? When you sit in the editor, you want efficient manipulation and navigation. Not having to leave the keyboard with your hands is one part of that, but the commands in emacs are more reliable and understandable than an out-of-the-box indexing editor. If I do a recursive file content search in emacs, I know that's what I get. And I have very fast ways of navigating the results. Why complicate it?

 

Also, compiling in emacs: M-x compile. The first time you issue that command, it asks what shell command you want to execute. Type 'make', 'gcc main.c' or whatever. Bind compile to F5 with M-x set-global-key. Navigate the errors from the compiler with some other keys. It's smart and simple.

 

I'm trying not to argue against the larger IDEs, but they tend to give me claustrophobia.




#5037037 Best Multiplatform IDE?

Posted by patrrr on 27 February 2013 - 02:10 AM

You don't really need a multiplatform IDE, you could just pick the CMake build system which can generate project files for Visual Studio, Makefiles and a bunch of other editors and build systems. Qt Creator can even read CMakes directly. And you can definitely use Qt Creator for non-Qt stuff.

 

PS: emacs rocks.






PARTNERS