Recent posts by Flexcool354 on Kongregate

Flag Post

Topic: Game Programming / Open Source Isometric Game

static public var _screenContainer:Sprite;

You need to learn your naming conventions pal.

 
Flag Post

Topic: Collaborations / This is not really a collab topic, but rather a question

Originally posted by kahootbird:
I’m unsure how hard porting some systems like Xbox would be from actionscript but it doesn’t sound easy.

It depends on how you implement things. Here’s a rule of thumb. If you want to have an easy time porting, stay away from vector graphics. If you do that porting is relatively easy, as long as you are familiar with the target language.

 
Flag Post

Topic: Game Programming / In Game defined script?

Originally posted by Draco18s:
Originally posted by RTL_Shadow:

Like Draco said- this can usually be called “Code Injection” and is most commonly used with SQL Databases. AFAIK there isn’t TOO much harmful stuff you can do with AS3, but you might want to look into it.

No, there aren’t harmful things you could inject into a flash application, but you could make the application do things it isn’t supposed to (such as telling the game to tell Kongregate that the user achieved a score of a billion….if they knew what your score-reporting function name is).

They can inject code anyway. Through bytecode or by simply replacing the swf with their own in some cases. All swf logic is run client side so an eval function doesn’t pose any increased threat

 
Flag Post

Topic: Game Programming / Updating to flash player 11.2

I’m interested in some of the new features and want to try them out, but flash spits compiler errors at me whenever i attempt to use them.

I’ve tried manually updating my flash player but it didn’t do anything. Furthermore i’d like to update flashdevelop in order to get the code completion to work with the new features.

 
Flag Post

Topic: Game Programming / Game with levels (SOLVED)

Not all flash portals supports uploading of external files along with the games. So your approach might restrict you from uploading to certain websites

 
Flag Post

Topic: The Arts / Can someone resize/redraw this?

Now stop bitching about it

 
Flag Post

Topic: Off-topic / What would the function for this graph be?

It’s for a game, but it isn’t that programming related so I posted it here.

 
Flag Post

Topic: The Arts / Help me with this portrait

I tried to draw this person but I don’t really think it looks like her, or perhaps I’ve just looked too much at the drawing. It would be nice if you could point out some of the areas I didn’t quite match and the shading is pretty bad too so I’d like some tips on that too.

Here’s a link to the original image, I didn’t want to tell who I drew to see if you could recognize her. You see people differently when you’ve stared at them for two hours…

 
Flag Post

Topic: Game Programming / Multiplayer capabilities

It depends on three things:

Server speed. How fast the server can read and send data.

How much data you are sending. Just like when optimizing for speed in singleplayer games, you can optimize the speed in multiplayer games, by decreasing the amount of data sent. Make sure you aren’t sending stuff multiple times, and perhaps cut some information and let the client predict it instead.

Interpolation. Let the client predict things, if the server’s message is delayed, let the client predict what the server would have send it. When the data from the server then arrives the client can correct itself.

 
Flag Post

Topic: Game Programming / Compiler Error

The problem is that death is a function that varies for each instance while damage is static.
Doing “death()” is the same as doing “this.death()” and you can’t use the “this” tag in static functions since you aren’t having an instance to reference. However you can do Damage(x) in your death function since non-static functions can call static ones.

I am pretty sure you would want your Damage not to be static, if you are only having one object that can take damage then make that object static in another object instead of making every field in it static.

The other option would be making death static

 
Flag Post

Topic: Game Programming / Copyright and Trademarks

Anyways, the chances of your game becoming big enough for anyone to actually care are very low so if you aren’t aiming for the big market don’t bother going into all of this. If you however plan to release the game and make money on it you shouldn’t call it chocobo. I don’t think you’d get into trouble for calling it Schokobo, but that makes your game seem like some kind of parody of the original game and may disappoint your players if it isn’t.
Like truefire said, the music can be quite tricky. You can’t copy major parts from their song, but using the same chords and order shouldn’t cause trouble. I don’t recommend having the exact same riff in the game, but minor changes should make it alright.
Keep in mind you are allowed to make parodies of songs and a parody doesn’t have to be different lyrics…

 
Flag Post

Topic: Game Programming / Socket Programming in Flash?

It’s a library, as long as you can compile flash you should be able to compile player.io
You can code a socket server yourself though, I did once. Look at this link: http://www.giantflyingsaucer.com/blog/?p=15
I personally couldn’t get the XmlSocket class to work in the flash client and used Socket instead. Flash cannot be the host, but it can connect to another application. This sample is for c# but you can use pretty much any language you want.

 
Flag Post

Topic: Game Programming / Google AI Challenge 2011

I find artificial intelligence so extremely fascinating, yet I have no idea on how to tackle some simple problems… I don’t think i’ll make an entry, but I can wait to see what wins

 
Flag Post

Topic: Game Programming / coding for ragdoll Avalanche

First of all i would suggest you rendered the character dynamically, so it’s technically a wireframe of body parts.
When the player hits a spike, you check what parts of the wireframe intersects with it and cut it up there.

 
Flag Post

Topic: Game Programming / Game controls

I would give the player a speed variable and move him accordingly to that every frame
When the player press a correct key, the speed will be increased
If he press a wrong key or doesn’t press anything it will be decrease slightly
The correct keys will then swap between left and right every time a correct key is pressed

 
Flag Post

Topic: Game Programming / Do Events depend on the target being on the Display List?

Originally posted by Senekis93:

It’s like if you give a watch to a man and then wonder why the watch doesn’t stop once the man is dead. There’s no relation between them, unless you make a condition that causes the watch to stop working if the man dies.

Interesting example, but yes, there is no direct connection between the object being on the display list and the object having an enter-frame listener. You can set the listener as a weak reference when adding it. I am not sure what it does, but I think it prevents the listener from counting as a reference and therefor allowing the object to be garbage collected when every other reference is removed.

 
Flag Post

Topic: Game Programming / AS3 is dead. Long live Haxe

I just started using haxe today, and from what I can see you can indeed convert flash to c++ and the other way around, as long as you don’t use any of the c++ base classes. Just use the nme library and remap all flash files to it when creating c++ games

 
Flag Post

Topic: Game Design / Designing Programs

Stencyl, Unity and FlashDevelop are the three best free programs for making flashgames. FlashDevelop is code only and can be very difficult to use for beginners so I won’t recommend it in your situation. There are other free programs though, look at this post:
http://www.kongregate.com/forums/4-game-programming/topics/89-faq-making-games-read-first

Also if you are ready to pay, but just don’t want to pay the very high price for adobe flash, Sothink swf-quicker is a fine program. It’s a lot like flash, but costs a lot less.

 
Flag Post

Topic: Game Programming / Cheats Menu Problem

Don’t have it on any layers at all. Use classes, not only is it easier to organise your projects and be object orientated. Classes actually allow you to program things that you otherwise wouldn’t be able to

 
Flag Post

Topic: Game Programming / UrlRequest and Byte Question

What do you mean? Every image on a website has a location on the server, and in most of the cases that location is public. There aren’t any bytes flying around on the webpage containing the image though, you would need to find the direct link to the image in order to download it. That link can usually be found in html displaying it

That’s also how browsers work. The image isn’t send along with the rest of the page, but when the browsers reach a html tag saying: Display image from this location. It downloads the image to a temp folder and displays it

 
Flag Post

Topic: Game Programming / UrlRequest and Byte Question

Can’t you download the image and serialize it afterwards?

 
Flag Post

Topic: Game Programming / as3 connecting to c# socket server

I’ll look at it anyway, it might be usefull

I think I can get it to work, I mean the XML-socket connects to the same type of server it just handles the bytes for you

EDIT: Using the socket class instead of the xml-socket worked perfectly and I only had to change a few lines of code

 
Flag Post

Topic: Game Programming / as3 connecting to c# socket server

I’ve been experimenting with c# and tcp sockets and managed to create a server that flash can connect to without any problems. Flash can then send messages to the server and it receives them perfectly. The problem comes when the server sends messages to flash. In flash I use the XMLSocket class to connect. It dispatches a data event when getting data. So I have a handler on that, but for some reason the event won’t get activated when I send to the client. Only when the client sends to the server and the server echos back the client’s message. Then the event is called and it has collected all previous messages from the server and merged them all into on long string. I don’t know what I am doing wrong, but it could be that I am sending the messages in the wrong way.

Here’s my as3 code:

		protected function init(myEvent:Event):void
		{
//Hamachi is used, since I can't figure up the port setup. It should work the same way without though
			ourXMLSocket = new XMLSocket("5.5.38.20", 4444);
			
			ourXMLSocket.addEventListener(DataEvent.DATA, onServerData);
			ourXMLSocket.addEventListener(Event.CONNECT, connectedToServer);			
		}
		
		protected function connectedToServer(myEvent:Event):void
		{
			ourPing = flash.utils.getTimer() - ourStartRequestTime;
			trace("Connected to server");
                        //Sends a quick message to the server that it receives without problems, if I comment out that line it won't receive the server messages
			passEventToServer(new SocketRequestEvent("UserMessage", { Content:"Hello" } ));
			stage.dispatchEvent(myResponseEvent);
		}
		
		protected function connectToServer(myEvent:SocketRequestEvent):void
		{
			ourServerAddress = myEvent.parameters.address;
			ourServerPort = myEvent.parameters.port;
			
			ourStartRequestTime = flash.utils.getTimer();
			ourXMLSocket.connect(ourServerAddress, ourServerPort);
			
		}
		
		protected function passEventToServer(myEvent:SocketRequestEvent):void
		{
			if(!ourXMLSocket.connected)
				return;
				
			ourXMLSocket.send(buildXMLRequest(myEvent));
		}
		
		protected function buildXMLRequest(myEvent:SocketRequestEvent):XML
		{
			var myXML:XML = 
			<request>
			<type></type>
			<data></data>
			</request>
			
			myXML.type = myEvent.type;
			myXML.data.ping = ourPing;
			
			for(var myStr:String in myEvent.parameters)
			{
				trace(myEvent.parameters[myStr]+":"+typeof myEvent.parameters[myStr]);
				
				if(myEvent.parameters[myStr] is Number || myEvent.parameters[myStr] is String)
				{
					var xmlParam:XML = new XML("<"+myStr+">"+myEvent.parameters[myStr]+"</"+myStr+">");
					myXML.data.appendChild(xmlParam);
					
				}
				else
				{
					//trace("it is object");
					var xmlParamNode:XML = new XML("<"+myStr+"></"+myStr+">");
					
					for(var myInnerStr:String in myEvent.parameters[myStr])
					{
						var xmlInnerParam:XML = new XML("<"+myInnerStr+">"+myEvent.parameters[myStr][myInnerStr]+"</"+myInnerStr+">");
						xmlParamNode.appendChild(xmlInnerParam);	
					}
					
					myXML.data.appendChild(xmlParamNode);
				}	
			}
			//trace(myXML);
			return myXML;			
		}		
		
		protected function onServerData(myEvent:DataEvent):void
		{
//Since all the server messages are coming as one string I am splitting it here
			for each (var data:String in myEvent.data.split(String.fromCharCode(2)))
			{
				trace(data);
			}
		}

Also, most of my as3 code is based on this tutorial: http://www.kirupa.com/forum/showthread.php?289815-PHP-AS3-XML-Socket-Game-Server

c# code

//This is initialized later
public Socket tcpSock;
 public int Send(string type, Dictionary<string, object> parameters)
        {
            MemoryStream tempStream = new MemoryStream();
            XmlWriterSettings settings = new XmlWriterSettings {Encoding = Encoding.UTF8, Indent = true};
            XmlWriter writer = XmlWriter.Create(tempStream, settings);
            writer.WriteStartElement("response");

            //The type
            writer.WriteStartElement("type");
            writer.WriteString(type);
            writer.WriteEndElement();

            //The parameters
            writer.WriteStartElement("data");
            foreach (KeyValuePair<string, object> entry in parameters)
            {
                writer.WriteStartElement(entry.Key);
                if (entry.Value is string || entry.Value is int || entry.Value is double)
                    writer.WriteString(entry.Value.ToString());
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Flush();
            writer.Close();
            byte[] newLine = new System.Text.UTF8Encoding().GetBytes(Char.ConvertFromUtf32(2));
            tempStream.Write(newLine, 0, newLine.Length);

            tempStream.Position = 0;
            byte[] xmlData = new byte[tempStream.Length];
            tempStream.Read(xmlData, 0, (int)tempStream.Length);
            tempStream.Close();
            //MessageBox.Show(new System.Text.UTF8Encoding().GetString(xmlData));

            return tcpSock.Send(xmlData);
        }
 
Flag Post

Topic: Game Programming / Test my game?

No freezing here, but 40-50% cpu usage
Edit: now it froze, the freezing is most likely caused by an unending loop, I’m not sure what the memory leak could be

 
Flag Post

Topic: Game Programming / Forum Project

Can I still get in?

Username: Flexcool354
Contact: Flexcool354@gmail.com

Field: Programmer
Prefered languages: c#, as3
Other languages: php, html, sql, javascript
Software used: Flashdevelop, Adobe flash, Microsoft visual studio (express edition)
Other info: I wont have much time in the next couple of weeks, I'm working on another game and a big school thing is coming up. After that is the summer holidays though and I should have plenty of time

Sounds like a good idea, i mean we are all programmers and we know each other. We know what each other can do, and can not. The only thing that worries me is the size of the team, it would require quite a bit of work to organize a team of this size and keep everyone working