Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Lt. Smash

#1
General Discussion / LibGDX. Anyone?
Thu 02/05/2013 11:55:32
Hey guys!

Anyone ever heard of LibGDX (http://libgdx.badlogicgames.com)?
Since a few months it's my favorite cross-platform game development kit (except for adventure games  :-D) and I've been able to create some nice (commercial) projects with it.
For example, the iOS version of my Tangram-like game BlockRam Puzzle: https://itunes.apple.com/app/blockram-puzzle/id632783393.

Just wanted to see if there are some other Gdxers out there or other interested people who also find this library pretty cool ;)
#2
Hey guys!
I've a very noobish question. I have this
Code: ags

spriteBlackLayer = DynamicSprite.Create(320, 200, true);
spriteLightLayer = DynamicSprite.Create(320, 200, true);
	
surfaceBlackLayer = spriteBlackLayer.GetDrawingSurface();
surfaceLightLayer = spriteLightLayer.GetDrawingSurface();
	
surfaceBlackLayer.Clear(0);
surfaceLightLayer.DrawSurface(surfaceBlackLayer, 50);  // 50% transparency

object[1].Graphic = spriteLightLayer.Graphic;


But why the hell does DrawSurface doesn't work with any other transparency than 0? When I pass 0, object[1] becomes pitch black as it should; passing anything above (e.g. 1, 20, 60) results in a 100% transparent object[1].

Some info: Game is 32bit,  Object[1] has no image as default (image = 0).

I hope someone can help me here...
#3
Hey guys!!

I've been reading the forums and were impressed by the different tile-engines some people have coded using AGS. So I thought, why not trying one by myself, maybe making a game out of it. So I quickly wrote some kind of faked "3d" tile map of which I was, at first, very proud of. (although there are just lines :D) But then I tried to generate larger maps (>60x60 tiles) and the frame drop was very high. With a little tweaking I got it to be a little quicker than before but anyhow, it's way too slow. So, here I am, asking how to improve my code to make it go as fast (least FrameDrop) as possible. I hope you can help me.

Here you can download and try out the tilemap:
TileEngine03 (883 Kbyte)

Keys:
[ N ] - Create new random map with random tilesize
[ Q ] / [ E ] - Rotate map
[ + ] / [ - ] - Zoom in/out map
[ Ctrl ]+[ F ] - Show Framerate
[ G ] - Show floor grid

Code info:
The tiles information is stored in an external file and then loaded into a huge array. Every tile has one height-value (this is the height of the top left corner).
I think the big problem here is, that AGS has to read through the whole array every game loop and that there are so many variables stored in memory.

Here's the code to re-calculate the tiles corner point positions:  // Executed only when rotating the map or zooming in/out
Code: ags

void Map::calculateTiles() {
	// Tile X/Y position
	int x, y, id;
	float posX, posY, startX, startY, a, b, c = IntToFloat(this.tileSize) * screen.zoom;
	
	if (abs(screen.rotation) > 90.0) { // mirror map when rotation is between +-90.0 and +-180.0
		screen.mirrored = true;
	}
	else {
		screen.mirrored = false;
	}
	
	// calculate sides a and b of a triangle (trigonometry)
	a = Maths.Sin(Maths.DegreesToRadians(screen.rotation)) * c;
	b = Maths.Sqrt(c * c - a * a);	
	if (screen.mirrored) {
		b = -b;
	}
	
	// Tile Z position (height)
	float tileSizeHalf = c / 2.0;
	float rectDiag = Maths.Sqrt(tileSizeHalf*tileSizeHalf + tileSizeHalf*tileSizeHalf);
	float rectAngle = Maths.ArcTan2(tileSizeHalf, tileSizeHalf);
	float rot = Maths.DegreesToRadians(screen.rotation);
	
	float tlX = (-rectDiag) * Maths.Cos(rectAngle + rot);
	float tlY = (-rectDiag) * Maths.Sin(rectAngle + rot);
	
	while (x < this.rows) {
		posX = startX;
		posY = startY;
		
		while (y < this.cols) {
			posX += b;
			posY += a;
							
			_tile[id].tlX = FloatToInt(posX + tlX, eRoundNearest);
			_tile[id].tlY = FloatToInt(posY + tlY - _tile[id].z * screen.zoom, eRoundNearest);		
			
			y++;
			id++;
		}
		y = 0;
		x++;

		startX -= a;
		startY += b;
	}
	
}


And here's the drawing code:  // Executed in rep_exec...
Code: ags

void Map::draw(bool drawGround) {	
	int id, t = FloatToInt(IntToFloat(this.tileSize)*screen.zoom);
	drGroundLayer = Room.GetDrawingSurfaceForBackground();
	
	drGroundLayer.Clear();
	drGroundLayer.DrawingColor = 15;
		
	while (id < this.maxTiles) {		
		if (_tile[id].tlX < screen.offsetX - t || _tile[id].tlX > screen.offsetX + System.ScreenWidth + t 
		|| _tile[id].tlY < screen.offsetY - t || _tile[id].tlY > screen.offsetY + System.ScreenHeight + t) {
		}
		else {
		/*	if (drawGround) {
				drGroundLayer.DrawingColor = 11;
				//####
				drGroundLayer.DrawingColor = 15;
			}*/

			if (id == this.maxTiles-1) { } // don't draw last tile
			else if (((id+1) % this.cols) == 0) { // just draw one vertical line for each tile of the last column
				drGroundLayer.DrawLine(_tile[id].tlX - screen.offsetX, _tile[id].tlY - screen.offsetY, 
				_tile[id+this.cols].tlX - screen.offsetX, _tile[id+this.cols].tlY - screen.offsetY);
			}
			else if (id > (this.cols * (this.rows-1) - 1)) { // just draw one horizontal line for each tile of the last row
				drGroundLayer.DrawLine(_tile[id].tlX - screen.offsetX, _tile[id].tlY - screen.offsetY, 
				_tile[id+1].tlX - screen.offsetX, _tile[id+1].tlY - screen.offsetY);
			}
			else { // draw one horizontal and one vertical line for each of the other tiles
				drGroundLayer.DrawLine(_tile[id].tlX - screen.offsetX, _tile[id].tlY - screen.offsetY, 
				_tile[id+1].tlX - screen.offsetX, _tile[id+1].tlY - screen.offsetY);
				drGroundLayer.DrawLine(_tile[id].tlX - screen.offsetX, _tile[id].tlY - screen.offsetY, 
				_tile[id+this.cols].tlX - screen.offsetX, _tile[id+this.cols].tlY - screen.offsetY);
			}
		}
		id++;
	}
	drGroundLayer.Release();
}


Thanks in advance...

[EDIT1] Now it calculates just one point for each tile (so less variables are needed). The tiles to the far right and bottom aren't visible. They just finish up the tiles of the row/column before.
#4
what would be the best approach to convert similar things like this into ags code:

Code: ags

String input (String s) {
int i;
char c;

while (i < s.Length -1) {
  if(s.Chars[i] != 'R')
    continue;   //return to top of loop, i++;
  if(s.Chars[i] == 'B')
    break; //continue after while loop
  if(i == 0 || c == '^')
  {
     s = "blabal";
     continue;
  }
  if(c == 'x')
     s = "blabalba";
}
   //break would continue here
...
}

#5
Hey all!

I wanted to make a custom Split() function for Strings* but I found out that I can not set a starting index to IndexOf/Contains.

The code for the split function is here:
Code: ags

void Split(this String*, String separator, String array[])
{
	int n = this.Length;
	int start, stop, i;
	while (start >= 0 && start < n) 
	{
		stop = this.IndexOf(separator, start); //the second parameter is the startingIndex (from that index the function searches)
		if (stop < 0 || stop > n) stop = n;
		array[i] = this.Substring(start, stop);
		start = this.IndexOf(separator, stop+1);
		i++;
	}
}

So I want to ask you if you could help me coding an overloaded version of indexOf.
It would be even better if CJ could add an overloaded version to the next ags version. (Maybe also an String.split(String separator, String array[]?)
#6
hey everyone!

I have a simple question:
I want to make a userinput box where I can write in text with special characters (ascii  128-256).
The behavior of normal textboxes is that they don't allow me to write f.e. "Straße" (german for 'street').
So how can I code that?
Does AGS recognize key presses from ascii >128 at all? If not this would be a suggestion for a future version.

ty for helpful answers.
#7
Hi,
I have this line inside a function:
Code: ags
StrCopy(Tmode[mode].name, name);

and I want to convert it to new style-strings

name is String.
Tmode[mode].name is a char array. Exactly:
Code: ags
char name[200];


Code: ags
Tmode[mode].name=name;
doesn't work. Error: "cannot assign to cursormode::name". I don't know what I typed but one time I got: "cannot convert char* to String*"

so my question is: How can I translate this old code into new one?
Hope someone can help me.

ps: this is code from the foa-template and I'm using AGS 3.0.1.29.
#8
SUGGESTION

Frame Editor



Description:

Double click on a frame in a view(3.0.0) opens the Frame Editor. You can select the sprites you want to use for that frame. You can drag'n'drop them into a zoomed version(you can change the zoom level) of your current frame and combine as many as you want.
And you can set the Z-Axis of that frame. So if the frames aren't the same height the animation isn't jumping.
[not necessarly necessary] And theres a button, if you click on it, you will be able to set the transparent pixels.

It's useful:

- When you have many gesture views.
For example:
You have a character who points to something while he is speaking or not.
So you would have to draw him pointing and pointing while speaking. But with this implemented you could draw him normal pointing(without speaking) and combine him with his speaking head frames. It's the way LucasArts did. (f.e. Indy FoA)
When you create another gesture you would only have to draw it normal and combine it with his head.

- If you have many characters (f.e. background chars) and you don't want to draw them all ,you just create one and change his head or give him something in his hands or (warriors) change his weapon.


This SUGGESTION would save you a lot of drawing work.
I hope that others think too that this is a good addition and it will be implemented.
#9
Hello everyone!

I have decided to make a little fungame with some puzzles like the one where you compare two pictures.

Now I wanted to know from you how to make that work.
Say I have one picture, a normal one, which I change to another one(the fault one) and save them as png. I import them as sprites(make dynamicsprites out of them?)and place them into the room.
Is it possible to code to find out where they aren't the same(fault) and when I click on the faults something happens?

I know that this is a bit to complex for a fungame; I could make hotspots or so; but I wanted to know how to do that, because that could  be maybe helpful for my 'normal' adventure game.

Thanks
#10
I would find it useful when it would be possible to do color-cycling (Palette Cycling) in 16/32bit 'cause then we could use alpha blended sprites, transparent things and color-cycling.
I know you will ask how should we handle this but I found out that there is a palette menu(also in 16/32bit) in the new v.2.8 beta.
When this would be implemented we could use this menu to select/change the colors we want to use for the cycling.

I think there should also be a delay in the function(CyclePalette(int start, int end, int delay))which says how long each color should be displayed.


Hope that this could be implemented.
#11
I wanted to ask how to change the way the text is displayed when I click on a GUI button.
Now when I click on a GUI button the text moves 1px down and 1px to the right. But I wanted it to highlight in yellow and not to move.

Anyone who knows how I can change it?
#12
hi, I wanted you ask if anybody knows what they have already done on FOA2 and what they're doing at the moment.
I heard that they're redoing their engine again, is that true?
And where can I download IP-Scumm 2.0? On their mainsite their is no link to download but I'm sure it has been released sometime ago. Maybe someone could upload it, please?

thanks
#13
hi,
this is my first background I've made in deluxe paint and I wanted you to ask what I should do to improve it.



As you may found out this is Indy's buro and I hope it looks like the style from FOA.

Paintovers would be nice.

thanks
#14
Advanced Technical Forum / Some SUGGESTIONS
Mon 05/03/2007 14:37:28
I've listed some suggestions, which I will probably need in my adventure:


  • Allow to change the dialog options color.
    EXAMPLE: Player speech color is white, dialog options color is brown.

  • Add codes for "+", "-", ".", "," to the ASCII code table.

  • Add a new parameter to the IsKeyPressed function(IsKeyPressed(int keycode, optional RepeatStyle) or make a new function(IsKeyDown(int keycode)).
    RepeatStyle lets you set that the whole script after IsKeyPressed will be either run once or always(repeat).
    EXAMPLE: You want the char to jump up only once when you press "space". It doesn't change anything if you hold down the "space" key because IsKeyPressed is turned to eOnce. So he only jumps once.

  • Add a function to set a key which skips the speech of the character which is currently talking.
    EXAMPLE: Player1 says:"Hi, my name is nobody and I'm somebody." While he is talking and the player presses the "." key, he stops talking and player2 will talk.


Hope that some of these could be implemented in a newer version of ags.
#15
Advanced Technical Forum / Room with plates
Fri 23/02/2007 10:32:54
hi,

I have drawn a room with plates, similar to the second challenge in 'Indiana and the Last Crusade'.

Here's a bit of my plates map:




So my questions now are:

How can I check, if the character is now on the upper left plate or on the 1st plate in the 3rd line?(without using hotspots, regions, etc. because there are more than 50 plates!)

And is it possible to make the character jump(walk) only to one plate at once?

Example: If he's on the first plate(second line) and the player clicks on a plate far away(upper right) he doesn't walk or he only walks to the next plate(which is in the right direction) and than stops.

If it's possible, how?

Hope that someone can help me,

Lt. Smash
SMF spam blocked by CleanTalk