Skip to main content

Posts

Showing posts from January, 2007

The Isometric soldier now shoots

I finished the GML code to make the soldier shoot in a isometric environment. The bullet consists of two parts: the graphic bullet and its shadow. The graphic bullet takes care of holding the information about the bullet and how to draw it. The shadow is always at certain distance below the graphic bullet depending on the bullet's height and takes care of collisions (it checks at ground surface for realistic isometric collisions). This is the code to create the bullet in a Game Maker script that runs from the isometric player object's perspective: { the_bullet = instance_create(x,y - height - 5,bullet); the_bullet.direction = point_direction(the_bullet.x,the_bullet.y,user_hud.x,user_hud.y) the_bullet.speed = 5 the_bullet.user_hud = user_hud; the_bullet._height = height - 5; the_bullet._shadow = instance_create(the_bullet.x,the_bullet.y,bullet_shadow); }

Why I prefer GameMaker over Multimedia Fusion

Update (5/1/12): I wrote a new article about Construct2 and why I think is now a better solution than both MMF and GameMaker for making games. Please check that new article. MMF doesn't have enough power for me. Yes, it has all those hundreds of extensions, but you can't just re-use your code in a practical way. Let's face it, GameMaker is ages more object-oriented than MMF and it has as well many extensions (such as physics and 3d) anyways. Also, the GM graphic editor has advance features such as colorize (useful in RTSs), outline, multiple crop, scaling sequence (for your mod 7 games), blur and more. Another advantage is price, GM is free and it's more powerful registered version is only around 20 bucks. Now, GM can be daunting to learn and use, but once you master it you will love it. Furthermore, I am working on a GM big template that will allow the user to have handy pre-made code just like in MMF making the use of GM much simpler. The screen shot is another

Let my memory go!

The function that frees allocated memory when a C++ ruby object is no longer referenced now works. The function is called freeme and is sent to Ruby via Data_Wrap_Struct. The freeme function takes as a parameter a pointer to the actual C++ object. Ruby passes that object when ruby objects no longer reference the Ruby object that encapsulates the C++ object. Unfortunately I could not make the character control work. The md2 models didn't get imported well into Irrlicht either. Also, the physics callback allows the C++ app class to inform Ruby when a collision occurred and who collided. I will try to work more on that feature to make it more powerful.

Solved the problem with bounding boxes

The ball in my test was not being stopped by the box blocks. All the blocks use the same 3ds mesh but modified for each of the 4 using irrEdit. The problem lied on the code trying to get the non-transformed bounding box from the irrlicht scene node and using that wrong sized bounding box to create the shape for the Bullet physics engine. I replaced the getBoundingBox () call in my code for getTransformedBoundingBox(). Now the ball does get stopped.

Another day of hard work

The grades publishing software that we use at the school is not really nice. We will try to change it to something better and easier to use. I have not switched to Dvorak layout yet. CalvaryGDK is the focus of my attention. I am working on making a platform controller that will enable an object to jump, run and more with the user input. For running the plan is to apply force only if the current velocity of the object is less than the maximum velocity. Still don't know what I am going to do for jumping, but could be something similar taking the Y component of velocity into account.

CalvaryGDK is taking shape

CalvaryGDK now has the ability to apply forces relative to another object such as a camera, e.g.: a controller class can direct the player in 4 directions of the view of the camera and not the absolute coordinates. When using this feature, the physics class object will rotate the given force vector by the degrees of rotation of the reference node on the specified axis. I also tried Webgen, a very nice ruby program to generate web sites. I may use it to do the projects websites.

More troops???

Bush wants to put more troops in Iraq. The majority of American people doesn't want him to do it and wants the troops to come back soon. My favorite news magazine, The New America wants the troops to come home too and denounce the war as unconstitutional. I kinda I agree with them. I have seen many TV shows discussing the war but none of them answered my questions: 1. Are more troops the answer for guerrilla warfare? By that I mean: is there any statistical proof from any country that solved its insurgency problems by military strength? 2. Is there any country that has solved its insurgency problems? 3. What it means to win ? Chenney's wife asked an interviewer if he wanted the U.S. to win. But what exactly is winning? Getting rid of Saddam, disabling WMDs threats, force democracy in Iraq, making Iraq a perfect paradise or protecting the U.S. from terrorist's hate? 3. if winning means making Iraq a perfect paradise, there were more than 1000 homicide victims in just Ne

First day of work

I finally got back to work at the school today. Only teaching one class tho. It is a pretty nice computer class. Got lots of work because we are sending report cards this week. I really don't like WinSchool; it is too complicate to use for the average user. I am gonna look for a better alternative, probably open source one. Seems like it is going to be a blessed semester tho, Praise the Lord. Pastor Schettler is here preaching the revival and the people like him a lot, he is very good.

Don't make! just wrap!

I finally got rid of the segmentation fault. rubynative.h had the problem. When initializing the ruby version of the C++ class, the code was using Data_Make_Struct. While looking over the web I found that other people have trouble with it and C++. I decided to try Data_Wrap_Struct instead. To accomplish that I first create a normal instance of my C++ class using new . Then, I pass the created object to the modified construct(VALUE &object, T *obj) function in rubynative.h : static T* construct(VALUE &object, T *obj) { object = Data_Wrap_Struct(rubyClass(), 0, free, obj); return obj; } Now it works, but the C++ class' destructor is never called so I guess I have a memory leak. However, the ruby script works now using the extension and it actually displays a ball affected by gravity falling into a table. I already coded the feature to allow changing of cameras from ruby and passing of physical parameters through the node's name defined in Irre

Searching for the truth in my extension

After having the segmentation fault, I did what any good developer does: put cout to print messages all over my code. Thanks to it I was able to "fix" the line: *instance = CApp2(RubyInt::internal(width), RubyInt::internal(height), RubyString::internal(scene_file)); into: instance = new CApp2(RubyInt::internal(width), RubyInt::internal(height), RubyString::internal(scene_file)); I also found out that somehow some of my pointers that are instance variables of the C++ class are getting set to zero. That is why I now get a segmentation fault again because I try to use them when they are zero. Maybe Ruby is setting them to zero? but why? I could not find anything on the web to help. Look at the output from the ruby program: >ruby Test.rb *** initialized CApp2 module *** *** Done initialized CApp2 module *** *** Creating instance *** In contructor b4 Assigning static m_pPhysicsWorld = 03016000 Assigning static Finished static Irrdevice = 03000EF0 *** Done Crea

Switched to Bullet Physics engine

I completely revamped my CalvaryGDK to use somebody else's example of Bullet + Irrlicht. I am working now on building the Ruby extension. When I tested it I got this nasty message: "[BUG] Segmentation fault"