Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (649)
Games in Android Showcase (181)
games submitted by our members
Games in WIP (700)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 3 [4] 5 6 ... 10
 31 
 on: 2016-02-13 08:53:52 
Started by steveyg90 - Last post by steveyg90
Thanks all,

Ultimately I draw my tile map as follows:

1  
   worldMap[col][row].draw(batch, region);


Where worldMap is a 'tile' object whose draw method looks like:


1  
2  
3  
public void draw(Batch batch, TextureRegion[][] t) {
   batch.draw(t[2][1], x << 4, y << 4);
}


Full code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
   for (int row = sy; row < ey + 1; row++)
            for (int col = sx; col < ex + 1; col++)
               if (getEntity(col, row) != null)
               {
                  BlankEntity entity = getEntity(col, row);
                  if (entity instanceof WaterEntity)
                     batch.setColor(0, 0, 0.4f, 1);
                  else if (entity.lightUp)
                     batch.setColor(entity.r, entity.g, entity.b, 1);
                  else
                     batch.setColor(0.4f, 0.4f, 0.8f, 1);
                  worldMap[col][row].draw(batch, region);
               }


Thus I draw 64 tiles x 32 tiles in the loop - is this not efficient the way I am calling the batch.draw for each tile?  Should I be sending the 64x32 tiles
in one batch.draw method?

Thanks for your help.

 32 
 on: 2016-02-13 08:08:25 
Started by gzuzboey - Last post by dentmaged
Try something like this:

[CODE]
        // This controls the bullet moving forwards, to move backwards, make the bulletSpeed negative.
        position.x += (Math.sin(angle / 180 * pi)) * bulletSpeed;
        position.y -= (Math.cos(angle / 180 * pi)) * bulletSpeed;

        // This controls the bullet moving sideways
        position.x += (Math.sin((angle - 90) / 180 * pi)) * bulletSpeed;
        position.y -= (Math.cos((angle - 90) / 180 * pi)) * bulletSpeed;
[/CODE]

I haven't tested this, but I use the same calculations for first person controls.
I would put this code in a Bullet class, and when the turret fires, a new bullet is created, with the turret's current angle, and location, so this allows for the turret to be moved around on screen.

Good luck with your project!

 33 
 on: 2016-02-13 05:24:01 
Started by steveyg90 - Last post by ziozio
I think I may have miss understood your question, KaiHH is right, uniforms are used to pass general parameters to a shader but they are not used to pass vertex information. The values are global in nature and once set are accessible across multiple draw calls. Some examples of good usages are when you want to pass light parameters, pass in the model /  view / projection matrix, etc. They are constant values for at least a single draw call and typically an entire render cycle.


 34 
 on: 2016-02-13 04:28:23 
Started by steveyg90 - Last post by Some1epic123
I use very few bodies for my tiles and haven't encountered any issues with Box2dlights. You will need a Box2D world to initiate Box2dlights, but otherwise Box2D is not required unless of course you need shadows.

 35 
 on: 2016-02-13 04:25:05 
Started by BurntPizza - Last post by SHC
Got GWT-AL to play audio in the browser through OpenAL API. Here's a screenshot:



And of course some code here.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
// Create the context and make it current
ALContext context = ALContext.create();
AL.setCurrentContext(context);

// Create the source
int alSource = AL10.alGenSources();

// You need the AudioDecoder to decode audio using the browser's WebAudioAPI
AudioDecoder.decodeAudio
(
    // The 'ArrayBuffer' containing the data (just binary, along with the container and header, not samples)
    data,

    // Upon success, we are returned a OpenAL buffer ID, and the decoded data is uploaded
    alBufferID ->
    {
        // Attach the buffer to the source and play it
        AL10.alSourcei(alSource, AL10.AL_BUFFER, alBufferID);
        AL10.alSourcePlay(alSource);
    },

    // Upon error, you are returned a reason, which is a String explaining what failed.
    reason -> GWT.log("decodeAudio error: " + reason)
);

There is also the original alBufferData function, but it is only usable if you have PCM samples and not a binary file. The example will be hosted online very soon.

 36 
 on: 2016-02-13 03:50:46 
Started by mercenarius - Last post by mercenarius
Thanks, Cas.

Quote
The point of VolatileImage is that it has no system RAM backing store

Of course you are right. And that's what has me puzzled. My machine does have an integrated graphics chip but I don't have a driver installed for it and I use a stand-alone card. But your suggestion has gotten me thinking. I should do some testing with one of my other machines to see if I can duplicate this behavior.

I'll check that and report my results.

 37 
 on: 2016-02-13 02:52:42 
Started by ShadedVertex - Last post by ShadedVertex
Isn't FXAA that anti-aliasing technique that Nvidea developed? Which is the fastest and most efficient anti-aliasing technique?

 38 
 on: 2016-02-13 02:51:33 
Started by BurntPizza - Last post by ShadedVertex
my engine now has scripting support. currently actors can be told to follow paths, speak sentences, enter vehicles, and look around.
<a href="http://www.youtube.com/v/rt6C9ti7n2w?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/rt6C9ti7n2w?version=3&amp;hl=en_US&amp;start=</a>


here's an example of defining paths, and being able to show them on the map you're editing

I see lots of potential in the engine, especially since there aren't that many Java game engines with visual workflows.

 39 
 on: 2016-02-13 00:41:40 
Started by BurntPizza - Last post by Archive
Added a church to the god in Shard Master, Lazzar, complete with pews, stained glass, and a stone altar.


also started working on necromancer swamp

 40 
 on: 2016-02-13 00:19:28 
Started by kasi - Last post by CoDi^R
I don't know what IDE you are using, but it doesn't seem to assist you very much. You didn't implement (override) the right function. Pointing

1  
2  
3  
4  
5  
6  
7  
8  
9  
exitButton.addListener(new ClickListener() {

    @Override
    public void clicked(InputEvent event, float x, float y) {
        System.out.println("X:" + x + " Y:" + y);
        //return true;
    }

});

Pages: 1 2 3 [4] 5 6 ... 10
 
KaiHH (164 views)
2016-01-31 23:15:29

sci4me (157 views)
2016-01-23 21:47:05

sci4me (141 views)
2016-01-23 21:46:58

KaiHH (175 views)
2016-01-19 13:26:42

theagentd (261 views)
2016-01-05 17:10:00

ClaasJG (277 views)
2016-01-03 16:58:36

chrisdalke (266 views)
2015-12-28 06:31:21

Guerra2442 (278 views)
2015-12-25 03:42:55

Guerra2442 (280 views)
2015-12-25 03:27:21

theagentd (301 views)
2015-12-21 14:43:24
List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!