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 - Terrorcell

#1
The TBitField Module

So this is my first module and it's something that I've used a few times before but haven't seen on the forums so far, so I decided to put it up on here.
If anyone has any suggestions or criticisms, then have at it :) I always welcome constructive feedback.

What is it?
It's a pretty basic struct with some bit manipulation functionality. Usually I use it to mask flags to save memory (just for fun), hence the name.
Sometimes bitwise operators all over the place can look a bit dirty, so maybe this will clean some of it up at least.

How do I use it?
Code: AGS

TMASK mask = 10; // can be any number from 0 to 255
TBitField field;
field.setMask(mask); // or just field.setMask(10) if you so desire
// away you go

In case the method names aren't clear enough, or if you just want to be sure, I've provided documentation with the module.

Where can I get it?
Works with AGS 2.71 and above.
Current version: TBitField Module v1.0
Mirror: TBitField Module v1.0
#2
I'm not sure if this has been asked before, but I can't seem to use eKeyCtrlV in on_key_press at all. Is this reserved specifically for displaying the version info, or is there a work-around for using eKeyCtrlV?
#3
I have a grid made up of tiles (15 x 15 pixels) that I would like an object to snap to (the object is 15 x 15 pixels). The problem is that the object has to follow the cursor, snapping to the grid as it moves. I've tried a few different methods to get this to work but they've turned out a bit ugly. For example, at the moment, my script checks which direction the cursor is moving and whether its position is divisible by 15 before setting the position of the object. But once the cursor starts to move in a bit of a diagonal fashion, the object doesn't quite snap to the grid.

Code: AGS

    // in global space of the room script
    bool isDragging = false; // used to stop mouseX and mouseY from being continuously set to the cursor's current position
    int mouseX, mouseY; // used to hold the position of where the mouse used to be before it moved
    int tileSize = 15;

    // ...
    // in room_RepExec()
    if (!isDragging)
    {
      mouseX = mouse.x;
      mouseY = mouse.y;
      isDragging = true;
    }
    
    if (mouseX > mouse.x) // mouse is moving left
    {
      int i = 0;
      while (i < tileSize)
      {
        if ((mouse.x + i) % tileSize == 0)
        {
          oPlaceHold.SetPosition(mouse.x + i + 5, mouse.y); // oPlaceHold is the object
          i = tileSize;                                     // also, +5 because the grid is 5 pixels away from the left and top of the screen
        }
        i++;
      }
      isDragging = false;
    }
    else if (mouseX < mouse.x) // mouse is moving right
    {
      int i = 0;
      while (i < tileSize)
      {
        if ((mouse.x - i) % tileSize == 0)
        {
          oPlaceHold.SetPosition(mouse.x - i + 5, mouse.y);
          i = tileSize;
        }
        i++;
      }
      isDragging = false;
    }
    if (mouseY > mouse.y) // mouse is moving up
    {
      int i = 0;
      while (i < tileSize)
      {
        if ((mouse.y + i) % tileSize == 0)
        {
          oPlaceHold.SetPosition(mouse.x, mouse.y + i + 5);
          i = tileSize;
        }
        i++;
      }
      isDragging = false;
    }
    else if (mouseY < mouse.y) // mouse is moving down
    {
      int i = 0;
      while (i < tileSize)
      {
        if ((mouse.y - i) % tileSize == 0)
        {
          oPlaceHold.SetPosition(mouse.x, mouse.y - i + 5);
          i = tileSize;
        }
        i++;
      }
      isDragging = false;
    }


I'm very sure that this code could be more efficient and that there is a better way, but I'm stumped, so any ideas would be great.
Cheers, Terrorcell.
#4
So I have been trying my hand at an RTS game in AGS. I chose AGS for its engine as a sought of challenge.
Basically, I've been going at it for some time now, and I've found a fair few things that, due to some of AGS' restrictions in the coding department, have become rather difficult to implement.

I need someone to take a look at the code (I will comment it heavily) and point out any issues, give suggestions, etc, etc.
You will be added in the credits for your troubles, but I really only need maybe two people to help out. Everything will be sent over pm's here.
I started this topic in the Advanced Technical Forum because I don't want a team (so there are no time limits and so I can work on it whenever I like) and because the game is by no means complete.
Also, I would like the code and any discussions of this to be private, as it is my first attempt at something as challenging as this.

Anyway, cheers for any help, pm me if you're at all interested,
   - Terrorcell
#5
So I'm creating a game that requires fog of war to shroud the map for the player. So far, the fog of war is made up of an array of a fog of war struct (array size depends on the map size, my test map's FOW array size is 5120, but that's a small map in regards to my bigger plans) that holds variables such as 'bool isVisible' and the sprite slot number that it uses (the sprite is a 15x15 black square).
Basically, everything is drawn onto the background every game loop, and every time a character is drawn the fog of war array is updated, changing its isVisible variable to true if the character has uncovered that tile (pretty much a view distance). Every game loop, the fog of war is also drawn onto the background, tile by tile:

Code: ags

function drawFOW()
{
  roomsurface = Room.GetDrawingSurfaceForBackground();
  
  int y = 0;
  while (y < tilesHeight) // the fog of war array is actually a 2d array, but is represented through the index() function, so tilesHeight is the width of the map (1200) / the tile size (15)
  {
    int x = 0;
    
    while(x < tilesWidth) // same goes for the width here, 960 / 15
    {
      if (!Tiles[index(x, y)].isVisible) // checks to see if the current tile in the loop is already visible, skips the drawing if it is
      {
        roomsurface.DrawImage(x * tileSize, y * tileSize, fog.Graphic); // fog.Graphic is the sprite slot used for each tile, tileSize is 15
      }
      
      x++;
    }
    
    y++;
  }
}


This is very heavy on the games FPS, as you can imagine, and I'm having a bit of trouble thinking of ways to optimise this :(
Iterating through an array that size doesn't hurt the FPS very much at all, but the DrawImage() function being called that many times (5120) every game loop drops it by about 10-12 FPS.
I can't just draw what can be seen in the view screen because the whole background, after the fog of war has been drawn onto it, is then drawn onto a minimap.

So I was wondering if anyone had any ideas? Would be very much appreciated :)
#6
I'm a little unsure as to how to go about drawing a dynamic sprite image onto a room surface and somehow being able to remove that image from the background later, returning the background to how it was before it was first drawn onto.
I can't use overlays because it's a scrollable room, and it gets even more difficult when multiple of these dynamic sprites need to be moving around the room surface at the same time (as close to 'at the same time' as computers can manage).
I'm sorry if this seems like a bit of a poor effort but it's late and I'm tired :P.
Any ideas?
#7
General Discussion / Internet trouble
Wed 12/05/2010 13:23:55
Ok here's my problem:

I don't know when this started, or how, but sometimes when I'm searching the web using Google and I click on a link to a website I get the following error in firefox:

Unable to connect

Firefox can't establish a connection to the server at download.microsoft.com.

    *   The site could be temporarily unavailable or too busy. Try again in a few
          moments.

    *   If you are unable to load any pages, check your computer's network
          connection.

    *   If your computer or network is protected by a firewall or proxy, make sure
          that Firefox is permitted to access the Web.

And this happens frequently, not with all sites, but even with links that I should be able to connect to. E.g. I tried to download Microsoft Security Essentials Windows Vista 32bit version from the official site

http://www.microsoft.com/security_essentials/default.aspx?mkt=en-us#dlbutton

but i still get that error.

Another annoying example is the Windows Live Messenger games page. With a conversation window open, and after I click on the 'games' button I get:

This program cannot display the webpage

Most likely causes:

     * You are not connected to the internet.

     * The website is encountering problems.

     * There might be a typing error in the address.



Or when I'm trying to update the Windows Security Essentials program, the download bar rests close to halfway, then after a short wait comes up with:

Virus & spyware definitions update failed.

Microsoft Security Essentials wasn't able to check for viruses & spyware definition updates.

Make sure your computer is connected to the internet and try again.

I know for a fact that my computer is connected to the internet as my Windows Live Messenger works, as well as updating the AVG definitions without any problems, or browsing the internet (apart from the already mentioned issues).

I don't know what could be wrong, none of my Ethernet cords are loose and I've run multiple anti-virus and anti-malware checks with no viruses or malware found...
#8
Hello my fellow AGSers.
I'd like to ask everyone reading this post to take the time to tell me what your favourite difficulty setting is. Whether it be that you like a really hard challenge or that you want to be able to get past the game in no time at all, share your thoughts.
I'll also be noting your answers as I believe they will come in handy when creating future games.

Thanks all, Terrorcell.
#9
So I've had my computer for about two years now. I've got windows XP Home Edition on it and most of it runs fine.
My problem is that when I shut it down (by going to start, shutdown) , and this only started recently, just when the computer is about turn turn off, a big blue error screen comes up with the message:

Code: ags

STOP: c000021a {Fatal System Error}
The Windows Logon Process System process terminated unexpectedly with a status of 0x00000000 (0x00000000 0x00000000).
The system has been shut down.


I've run a check useing Trend Micro PC-Cillan 2008 and nothing came up. I've also run a defrag and a disk check aswell as a registry check and repair. I don't understand what the problem is :(

Any insight to how to fix my problem would be greatly appreciated, Terrorcell.
#10
General Discussion / Tetris
Wed 08/10/2008 01:30:24
Does anyone know a safe site where I can download a freeware copy of testris?

Thanks, much appreciated, Terrorcell.
#11
When you have your room script open and you want to type, for example, int car = Random(5); for whatever reason, it will pass that integer on but if you typed the same thing in the Global Script, it will come up with an error.

Just a question that I've been pondering for a while now,

Terrorcell.
#12
Does anyone know how to make the screen scroll left, right, up or down when the player moves their mouse to the sides of the screen?
Your help will be greatly appreciated.
#13
AGS Games in Production / RAMPAGE Reborn
Mon 17/12/2007 00:24:16
For those of you who know the classic version of 'Rampage', I am re-creating the classic in AGS.
For those of you who don't know about the classic version, the story basically is that three people mutated into giant monsters. The monsters were named after the people that transformed. George (the giant ape), Lizzie (the giant lizzard) and Ralph (the giant wolf).
Each character has their own special ability in some form.
In this game you have to destroy all the buildings before moving on to next level, but you will be constantly harrased by helicopters, tanks and soldiers. But you can destroy them. You can also eat the soldiers.

Here are some screenshots:

The Main Menu


George in Los Angeles


This is the 'level completed' screen. The reason why there is no score is because I skipped right through the level to get to it.


Lizzie up close


Current Progress:
Scripting 30%
Backgrounds 10%
Character Art 10%
Story 100%
Music/Sound 40 %

I need a Scripter/Coder to help finish this project as I constantly get stuck.

Terrorcell.
#14
Can you have more than four background frames for background animations?
#15
Beginners' Technical Questions / the text box
Wed 22/08/2007 23:01:01
Im trying to use the code btnSavegame.Enable = true;.
I wanted to know what the code for a text box is. e.g. txtSavegame.Enable = true; or something.
#16
I have recently read a book called Halo:The Fall of Reach and I thought it was awsome.

Anyone else read it?
#17
Hi, Im trying to create a new game called Halo: The Fall of Reach, and I am going to need some recruits that have read the book 'Halo: The Fall of Reach'.
I will also need a pretty good artist, so if there is anyone out there with some good skill then mail me and Ill see what you've got.
More information will be revealed to the people that are working on the project. :D

Give it a go, Terrorcell.
#18
hi, say I want one text box to appear if I type the right thing into the first text box. So I have one text box to begin with. if I type the right number into this text box, then right below it, another appears. IU dont know whether this is in the help or not but how do I do this?
#19
Ive been creating a new game and I have tried using the text parser. I have been having trouble with the parser, for example, if I was in one room and i typed 'look at door', it would display 'Its a red door'. But if I was in a new room, and i made a new parse for the new rooms door, i would type 'look at door' and it would display 'Its a blue door' but what i dont want it to say is 'Its a blue door' 'Its a red door'. How do I make it so that when i type in 'look at door, it displays the text in each room?
#20
hi, im making a start menu for my game. I have all the things like load and quit but I can't find out how to make the start button work. i want it so if you click the start button, it starts the game at room 1.
how do I do this?
SMF spam blocked by CleanTalk