Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 10:36 pm

All times are UTC




Post new topic Reply to topic  [ 170 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 12  Next
Author Message
 Post subject:
PostPosted: Wed Jun 08, 2011 6:21 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Yup, that's right, Biki. The properly working camera is just in my devtommy branch.
It's not merged into the official master branch yet. The code still needs to be reviewed by Gornova.

But of course you could just pull my branch and work with that :wink:

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2011 6:41 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
Tommy arrive first :D Yes, camera is broken see tommy branch or dev branch for fixed version :D

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2011 11:32 am 
Offline
Regular

Joined: Sun Oct 25, 2009 5:24 pm
Posts: 118
Ah thank you, appreciate the help :D


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2011 12:13 pm 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
thanks to you, I don't have so many time to work on MartEngine, but from time to time, I'm pushing little commits and trying to solving issues to release next MarteEngine version (0.3 on my dev branch currently)

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2011 4:01 pm 
Offline
Regular

Joined: Sun Oct 25, 2009 5:24 pm
Posts: 118
I've downloaded tommys branch, but the camera is still the same? Same problem for me still.

Am I doing it right? Is the "setCameraOn" enough for the camera to work?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2011 6:18 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
You need to specify the width and the height of your level inside your World.
So somewhere you have to say:
Code:
myworld.width = 10000;
myworld.height = 10000;


Your entity toFollow is not always centered. The camera just forbids to leave the world (=map) boundaries. So if you are near the edges of your level the entity will leave the middle of the screen.

Also you have to detect in your code that the entity leaves the screen and forbid that if you want.

The MoveAvatarTest test case for example does not forbid to leave the visible area but keeps the avatar centered if the distance to the level borders are wide enough.

Does that help?

When in doubt feel free to look at the source code of my competition entry "Back to the past" or ask here :wink:

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2011 7:45 pm 
Offline

Joined: Wed Jun 29, 2011 5:55 am
Posts: 32
Location: United States
Hey, I'm really enjoying using the Marte Engine, but I sense a problem in my future. I want to implement ice, which can either be built into the level, or shot onto a piece of the terrain with an ice gun.

While I'm still inexperienced with the ME, I'm worried that the only way to implement this would be to keep a list of blocks (collision bodies?) that are icy, and when checking for button presses, run through that list every frame.

Obviously, this would not be good. Is there a simpler way to implement something along these lines?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2011 8:50 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Yes, I think there is a simpler way.

If I understood it right, you'll have icy blocks. Those are either part of the level design or normal blocks can transform into icy blocks when you shoot them.

Have a look at my game Star Cleaner (see my signature). The code is part of Marte.

Each level is made up of entities. So also every block is an entity. There are special blocks for the moving platforms. If you look at their source code you'll find that those platform entities can "carry" another entity.
Your icy blocks sound similar. But instead of carrying another entity when they move your icy blocks keep their position but they constantly move the "carried" entity until it left them (hint: collision and gravity are key here).

Your icy blocks can be added during level design. When you shoot with your ice gun you have to detect which block is hit and replace that block entity with an icy block entity.

So you should be able to implement it all with Marte's builtin collision and gravity stuff.
I suggest you just copy parts of the Star Cleaner code to create your icy blocks.
If you're stuck feel free to ask me, I'm convinced it's easily doable with Marte like I described above.

Hope that helps,
Tommy

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2011 12:36 am 
Offline

Joined: Wed Jun 29, 2011 5:55 am
Posts: 32
Location: United States
Sweet! I know that to get the old-school "feel" to the game, I'm going to have to tweak things (read: hack away), and I feel it will be much simpler in Marte than it would be with a full physics-engine.

The real fun part is when I get around to implementing the grappling hook.

Thanks for the quick response!!

EDIT: I'm basically copying the alpha demo code into my project (line by line, so I can comment it and try to reason my way through it), and I have a question:

in FuzzyGameWorld.java->loadEntityFromMap(), is the method for loading the map entities optimized?

To my eyes, it looks like it could be streamlined a bit, perhaps losing at least one of the nested for loops. However, I by no means consider you guys to be poor coders, and you may well have already written this function optimally. I just thought I'd ask.

The tiny idea I've got floating around in my head would involve changing how the map files are read, so it might not be worth it, from a cost-benefit standpoint.

Either way, I'm really enjoying using Marte Engine, thanks for sharing all the hard work!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2011 7:04 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
FlowState wrote:
Sweet! I know that to get the old-school "feel" to the game, I'm going to have to tweak things (read: hack away), and I feel it will be much simpler in Marte than it would be with a full physics-engine.


cool :D if you can share code, feel free, with full source code, classess only, branch on github, patch or so on :D

Quote:
The real fun part is when I get around to implementing the grappling hook.


It's time for a demo :D

Quote:
in FuzzyGameWorld.java->loadEntityFromMap(), is the method for loading the map entities optimized?


no it's not :D

Quote:
To my eyes, it looks like it could be streamlined a bit, perhaps losing at least one of the nested for loops. However, I by no means consider you guys to be poor coders, and you may well have already written this function optimally. I just thought I'd ask.

The tiny idea I've got floating around in my head would involve changing how the map files are read, so it might not be worth it, from a cost-benefit standpoint.


well it's not optmized but it works :D in my mind need some kind of optmization (for example have one spritesheet for enemies, one for static element of maps on tiled side and polish a bit code on loading) but keep in mind main rule: keep it simple :D

Quote:
Either way, I'm really enjoying using Marte Engine, thanks for sharing all the hard work!!


thanks :D

about ice: I agree with tommy it's matter of collision with player and how you define ice block entity, if you need help, just ask :D

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2011 9:48 pm 
Offline

Joined: Wed Jun 29, 2011 5:55 am
Posts: 32
Location: United States
Okay, I'm having a bit of a bother getting dashing to work, specifically in having a Dash timer. I'm trying to implement a 2-second timer for the full dash. Here's my issue:

I don't want to make it one-shot, because adding a new alarm for each dash feels insanely wasteful, but I'm unsure how to just use one alarm.

I suppose that after I set it up, whenever I want to "restart it", I call the restart method, and then pause it? Obviously, I can just create a new method to do that, I guess call it "reset()". Is this how you would do it?

Also, I want to make sure I understand the "alarmTriggered()" function. Basically, I just check for the name of the triggered alarm and handle the event as appropriate?



Code:

@Override
public void alarmTriggered(String name)
{

    if(name.isEqualIgnoreCase("dashalarm")
    {
        // switch maxSpeed to running speed
        currentSpeedModel = NORMAL_SPEED;
       
        // (added to Entity)
        resetAlarm("dashAlarm", DASH_TIME);
        isDashing = false;
       
    }

}

public void resetAlarm(String name, int fullCounter)
{
    Alarm tempAlarm = alarms.get(name);
   
    tempAlarm.setActive(false);
    tempAlarm.setCounter(fullCounter);
}



Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2011 9:59 pm 
Offline

Joined: Wed Jun 29, 2011 5:55 am
Posts: 32
Location: United States
Oh, and we should definitely make Entity.alarms protected for when someone wants to add Alarm functionality.

Edit: obviously, I mean add alarm functionality to a subclass of Entity.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2011 7:06 am 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
@FlowState:
Alarms are already pretty powerful.
If your dash alarm shall happen every two seconds, no matter what, you can create the alarm like this:
Code:
myEntity.setAlarm("dash", 2000, false, true);

This alarm will be triggered every 2 seconds (assuming you use delta timing, not frame rate timing) for ever. You don't need to do anything else.

Should you ever want to pause the alarm you call
Code:
myEntity.pauseAlarm("dash");

Triggering the alarm will stop.
You can of course resume the alarm and it continues where you paused it. Means if you paused it after 1 second passed it will trigger again in 1 more second after resuming.
Code:
myEntity.resumeAlarm("dash");

If you just want to "reset" the alarm to start again from 0 you call
Code:
myEntity.restartAlarm("dash");


You can call the destroyAlarm("dash") method if you really want to get rid of the alarm at all. You would need to call setAlarm() to create it again.

In the alarmTriggered() method you just check for the name of the triggered alarm. You can have multiple different alarms per entity and because Java doesn't properly support callback methods and I found inner classes to be too complicated for beginners with Java and game dev I came up with this simple approach.

I wouldn't want to make Alarms protected inside Entity. There is builtin logic in World and Entity that ensures that alarms work the way they are supposed to. Opening that could cause incorrect behavior of alarms.

Do you have some requirement that should be added to alarms? Then I would happily add it if it does improve the alarm stuff!

Note to self: I should update the Wiki page for alarms and add some improved example to the testcases...

Hope that helps,
Tommy

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2011 7:07 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
just in case :D if you have new ideas, please use MarteEngine issues on github, so we can track and work on every idea :D

@Tommy: about explain better, I'm thinking this too, we need to write more examples :D

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 04, 2011 7:04 pm 
Offline

Joined: Wed Jun 29, 2011 5:55 am
Posts: 32
Location: United States
Well basically, what I need is an alarm that is triggered every time the player hits the dash button, and after X seconds, sets isDashing to false. Any chance you could write up a code example for that? Or perhaps it's already in StarCleaner? :D

What I have now plain doesn't work, but I'm hesitant to make it into a gitHub issue because I'm sure that the problem is my lack of understanding, not bad code in the engine.

I'm sorry that I'm not understanding how the system works, but I will definitely be submitting my code as a tutorial once I'm done with the basic stuff.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 170 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 12  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group