Jump to content

  • Log In with Google      Sign In   
  • Create Account


SriLumpa

Member Since 03 Mar 2009
Offline Last Active Aug 03 2013 05:54 AM
-----

#4939608 Android or PC?

Posted by SriLumpa on 12 May 2012 - 01:04 PM

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.


#4903152 Debating on what type of game engine to use for android game. Need help

Posted by SriLumpa on 16 January 2012 - 12:38 AM

Not really debating, but you can try libgdx.


#4852685 [HELP] Installing Allegro on Linux

Posted by SriLumpa on 23 August 2011 - 01:35 AM

You can try with just:
-L/usr/lib -lalleg-4.2.2
You can check the lib file for symbols.

Reproducing (or not) manually outside of codeblocks would also give hints.


#4849560 Vectors in copy constructor causes heap corruption.

Posted by SriLumpa on 15 August 2011 - 02:52 PM

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.


#4849456 Vectors in copy constructor causes heap corruption.

Posted by SriLumpa on 15 August 2011 - 11:13 AM

vector::size() complexity is constant, so you'd have to call it a lot to notice performance problems (a suspicious lot).

Sorry I'm out of ideas. You should really strip this down, if not for your readers (including yourself), this could help providing a minimal reproducing case.


#4849419 Vectors in copy constructor causes heap corruption.

Posted by SriLumpa on 15 August 2011 - 09:35 AM

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" ?

Edit2: it seems that it could happen. So, show us compareEvents :)


#4849088 Vectors in copy constructor causes heap corruption.

Posted by SriLumpa on 14 August 2011 - 02:58 PM

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 ?


#4848798 Vectors in copy constructor causes heap corruption.

Posted by SriLumpa on 13 August 2011 - 05:22 PM

Maybe the problem is not in the class Event, but in the usage you make of it (you try to use an invalid event).

Without more code, we can't tell. You should show the full Event class, and also a minimalist usage that reproduces the problem.


#4831504 Spaceship rotation through opposing forces

Posted by SriLumpa on 05 July 2011 - 02:09 PM

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)


#4826274 python generators

Posted by SriLumpa on 21 June 2011 - 11:49 PM

Hi,

What about ?

#!/bin/env python

from itertools import ifilter, takewhile

def sequence():
	i = 1
	while True:
    	print "(Generating " + str(i) + ")"
    	yield i
    	i = i + 1

def criterion(x):
	return x % 5 == 0

# First matching
matching = ifilter(criterion, sequence())
print matching.next()

# Last before matching
before = takewhile(lambda x : not criterion(x), sequence())
print list(before)[-1]


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.

Cheers.


#4824553 Box2d object x y location

Posted by SriLumpa on 17 June 2011 - 12:26 PM

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.


#4815324 [Box2D]Problem with joints - simple moving

Posted by SriLumpa on 24 May 2011 - 03:50 PM

It is not a "force vector", just the velocity. But like a manual force, you have to recalculate the value at each step. So for example when the target is reached, you just set the velocity to 0.


#4793755 Android / Eclipse "R cannot be resolved to a variable"

Posted by SriLumpa on 03 April 2011 - 01:27 AM

R is an auto generated class. Do you have the Android plugin installed, is your project an Android project, and did you activate automatic build ?
If so you should have R.java in some folder named "gen". If not, look again at that Stack Overflow post, many possible solutions to that are mentioned there.


#4793442 Noob needs help with cloning

Posted by SriLumpa on 02 April 2011 - 04:22 AM

Here is the constructor


You are probably not showing the problematic code, because there is no mention of stream here.


#4789424 How to design Entities which can wrap around the map?

Posted by SriLumpa on 23 March 2011 - 12:44 AM

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.




PARTNERS