I'll try a different approach for giving my 2 cents
First, you should come up with a game idea. Then, if that game would play nicely with a touchscreen, go for android. Otherwise PC.
Comparing the development frameworks does not make much sense to me. Both platforms have good tools. I have tried libgdx and it's good. I have not tried SFML but people seem to like it, so it must be good too.
I'm pretty sure they have valid values, the solid value assignments are hardcoded, and don't have any incremental locations.
It could get a bad value if you implement a copy constructor and forget to copy this field.
Also, I'm not sure how it's supposed to work for me with the const reference, I need the event class to be able to be changed, doesn't const lock it from editing?
You can at least easily add this in the comparison method as shown by rip-off. For other places, if you don't want to refactor ... you can try passing around a pointer or shared_ptr of Event, but I'm not sure adding this complexity is a good idea at this point. You should first fix the problem before you think of optimizing.
Sorry no solution, but a few things that you might clarify:
What you are doing in Event destructor is useless, because a destructed Event will not be used again, so all these manipulations that don't release things are not necessary.
Is there a relation between EVENT_COUNT and the size of the event vector given in parameter ? There should be, or your for loop would be dangerous, but then why don't you just use events.size() ?
I also don't think that I'm trying to operate on a deleted event, since while debugging, when the crash occurs, the whole vector's members are intact, and the problem doesn't even happen when messing with the Event vector, but with the string vector inside the Event vector's members, and even goes halfway in there.
Going as far as halfway does not prove much. If you're accessing deleted or corrupted memory, anything can happen. And if you use a delete/corrupted Event, it's precisely *inside* the Event that things are bad.
PS: I still don't see what you call and "event", functionally. For me, an event is something that occurs once. Even if you don't want to break things into many classes, a bit of separation wouldn't hurt, imho.
Edit: another idea: I don't know if a bad comparison function can corrupt a vector while sorting (it can do bad things to map keys at least), but what is compareEvents ? are you sure it is a "strict weak ordering" ?
That class looks like a blob ! Maybe fixing this will lead you to finding the problem (or to making it disappear). What is an Event by the way ? it seems to combine the attributes of an actual event, of an entity, and more ...
There is still the possibility that you are *using* the class incorrectly (ie: the problem is outside the class, like using a deleted Event). How about showing eventResolver ?
Be careful though - your design dictates your flight characteristics. Put all your weight or boosters on one side and you'll fly in circles.
I just replayed it, and indeed, motors seem to just thrust whenever they contribute positively to the wanted control response (but the side effects are one fun aspect of the game).
Let's focus on the translation-only part. We need to eliminate the torque (in 2D, there is only 1 axis of torque, so this is easier). We mark motors which apply negative torque and do the same for motors with positive torque. We compare abs() of those two and proportionately scale down motors.
I'm not sure this is the right solution, because among all motors contributing positively (for example) to the torque, some may contribute more than others to the desired translation. So scaling them all by the same amount is not optimal. You'd have to go for a set of equations, I fear
I am not exactly sure how to do that in 3 dimensions, through. Any ideas?
Sorry I don't see either. It seems easy to me in 2d, but I'm intimidated by 3d and all those angles But I guess a few tutorials about 3d physics/geometry should not be that hard to find.
By the way, how would you express the "desired effect" in response to player controls, in 3d ? (and what kind of controls does your game have)
from itertools import ifilter, takewhile
i = 1
print "(Generating " + str(i) + ")"
i = i + 1
return x % 5 == 0
# First matching
matching = ifilter(criterion, sequence())
# Last before matching
before = takewhile(lambda x : not criterion(x), sequence())
I'm not sure this helps, it seems to me like just naming things, but who knows ...
At least it answers:
* Create a list containing the first n elements or the all elements until a given value.
But if there are many elements in the list, it would be more efficient to use a custom iterator that remembers the previous element, or something like that.
The position is just "where the body is", the body's "origin". It is not a particular center, physically nor geometrically.
When you add shapes to your body, you place them relative to the body's "origin". You can place all shapes on the right if you want, the origin does not have to be at the center or whatever.
This said, the methods for creating a circle or a box shape will have those shapes centered on the body's origin by default.
I also had to think about this for an asteroids game. You not only have to copy the drawable part, but also consider a few other things, for example collision detection (you don't want the character to be visible on both sides, but hittable only on one).
As I was experimenting with a "component system", this resulted in one entity having several copies of various components, but I am not sure this is the best way to go. Maybe at the point you are, it would be easier to just duplicate the collision checks, the same way you do for the drawing method.