138 Forum Posts by "NecroBlight"
is it possible to store a function in xml, and the attach/pass it into runtime?
At 10/6/14 08:34 AM, Sam wrote: Store it however you want, though a lot of people seem to prefer JSON to XML recently.
Whether it's good practice - I'm not sure what you mean. You're just storing volatile data, whether it's in XML or your own format is irrelevant.
Should've used differnt wording, I didn't mean database as something outside the program, but a data collection the program uses during runtime, so it uses alot of it, so I guessed it might impact performance.
To use XML as a runtime database?
sorry, didn't notice I already replied.
At 8/15/14 01:58 PM, MintPaw wrote: If you're making it just for fun then I'm not sure why you'd be worried about copyright law.
I'm not doing it solely for fun, I plan to use it, just happens that it became more of the 'take examples' to completely copy it because I enjoyed it.
At 8/15/14 10:40 AM, milchreis wrote:At 8/15/14 09:38 AM, NecroBlight wrote: No, I'm not copying from the source code, just from documination, I mean I just looke at all the names of public and protected properties and methods and what arguments they handle, that means I don't have acess to the actual code of any function and private properties and function, exactly like adobe has flash documination on its site (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html), and just from that I try to replicate the whole program.These are just names.
It's called a MouseEvent in As3 and it is called a MouseEvent in js.
The real question is why you want to reinvent the wheel.
Because it's fun, feels like a puzzle, also I get to practice good approaches. And what better way to learn how to use a certain engine, then create it from scratch yourself. But mostly its just fun.
At 8/15/14 09:05 AM, bumblefish wrote:At 8/15/14 07:45 AM, NecroBlight wrote: If I make a one to one copy of any as3 engine just based on its public/protected documintation, do I have the rights to use it as my own?Hmm.. Not really sure exactly what you are looking for.
Say you use Flixel: It's free and open source, which means you have the right to modify and/or redistribute at your own free will.
If you have access to the source code for a closed source engine, you can pretty much do what you want, as far as building from it as long as you don't redistribute the source code, as (I assume) it could get you in some type of trouble if the original programmers were to find out.
I can't really say for sure. I don't think you can copyright source code.
No, I'm not copying from the source code, just from documination, I mean I just looke at all the names of public and protected properties and methods and what arguments they handle, that means I don't have acess to the actual code of any function and private properties and function, exactly like adobe has flash documination on its site (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html), and just from that I try to replicate the whole program.
If I make a one to one copy of any as3 engine just based on its public/protected documintation, do I have the rights to use it as my own?
As a fun challenge I decided to make a complete copy of the UI components of flash instead of directly using it. And while I figured out most of the things, I'm not quite sure about a few things, how styles and skins are really stored (because I somewhat doubt it's just a simple private var. And also how drawing and redrawing work on a few thing, because when I checked the displaylist of a lablebutton, it shows only one symbol, the label, but not the skin itself, is it graphically drawn?
As a fun challenge I decided to make a complete copy of the UI components of flash instead of directly using it. And while I figured out most of the things, I'm not quite sure about a few things, how styles and skins are really stored (because I somewhat doubt it's just a simple private var. And also how drawing and redrawing work on a few thing, because when I checked the displaylist of a lablebutton, it shows only one symbol, the label, but not the skin itself, is it graphically drawn?
public function Update() {
if (xVelocity != 0 || yVelocity != 0) {
var obj
Motion()
for (var i:int; i < parent.numChildren; i++) {
obj = parent.getChildAt(i)
if (this.hitTestObject(parent.getChildAt(i)) && parent.getChildAt(i) != this) {
if (parent.getChildAt(i) is Engine.Physics.Object) {
Collision(parent.getChildAt(i))
}
}
}
}
}
public function Collision(object) {
dispatchEvent(new Event("collision", true))
if (object.solid && solid) {
if (y + height >= object.y && y + height - yVelocity <= object.y && (x + width >= object.x && x <= object.x + object.width)) {
y = object.y - height
Deflect("horizontal")
}
if (y <= object.y + object.height && y - yVelocity >= object.y + object.height && (x + width >= object.x && x <= object.x + object.width)) {
y = object.y + object.height
Deflect("horizontal")
}
if (x + width >= object.x && x + width - xVelocity <= object.x){
x = object.x - width
Deflect("vertical")
}
if (x < object.x + object.width && x - xVelocity >= object.x + object.width) {
x = object.x + object.width
Deflect("vertical")
}
}
}
Here's my cllision mechanics is there something I should change about in particular or is it no good and I should completely ovehaul it?
Is it a good practice to create the physics class as MovieClip which later extended to object types which then extended to the objects themselves?
To put it simply, instead of a central hub to handle all objects, each object has its own physics handler.
I know that it takes more RAM, but is there any other particular reason as not to use it?
Are there any tips for creating a physics engine?
At 9/30/13 12:01 PM, milchreis wrote:At 9/30/13 11:40 AM, NecroBlight wrote: I was thinking of using bitmap, but I don't see there a simple function to draw lines and squares dynamically during runtime.The general trade off is to give up on the dynamic side of things and therefore gain some performance.
So depending on what you want to draw, you can use tiles.
Tell us what you want to draw exactly.
I have array like that;
00000000000001000
00000000000001000
11111111111111000
And then there's a loop to check every letter and when it's on letter 1, it check if there's letter 1 above, or under or on the side, and where there isn't it draws a line as in the end to draw a continuous wall.
At 9/30/13 11:47 AM, Sandremss128 wrote: Every time you use the drawing API it will create a vector graphical object within the sprite. Every vector has to be rendered and calculated by the CPU, so it adds up quickly to the overhead.
You could use the drawing API in conjunction with bitmaps by drawing what you want on a sprite, then drawing that on a bitmap. Also cacheAsBitmap might be an option here, that will make the sprite cache instead of recalculating the many vectors every time.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#cacheAsBitmap
Thanks, the cacheAsBitmap helped significantly. Tho I still notice small lags, but still much better than the previous lags. Will doing the way you first mentioned would be better?
I have a function that draws on my sprite in the run time, but I noticed when I draw one big piece of chunk it doesn't lag but when I drawn it by tiles (draw many squares) it starts to lag (after it finished drawing), why does it lag?
I was thinking of using bitmap, but I don't see there a simple function to draw lines and squares dynamically during runtime.
At 9/30/13 09:51 AM, PSvils wrote:At 9/30/13 09:41 AM, NecroBlight wrote: Not exactly what I was looking for, but thanks for the explanation, enlightened me. Ok, here's another question, is it ok if I load database from XML and then convert it to regular objects?What do you mean? The point of loading in anything is to get data...so...yes?
I don't know, I'm just new to the part of loading data, so I just wanna be sure.
Not exactly what I was looking for, but thanks for the explanation, enlightened me. Ok, here's another question, is it ok if I load database from XML and then convert it to regular objects?
At 9/30/13 06:38 AM, slugrail wrote:At 9/30/13 06:17 AM, NecroBlight wrote: for storing objects like different items, enemies, characters and all the information about them, and just process them when needed? I shouldn't create class instances to represent certain objects and items?You mentioned "process them when needed" and I'm guessing you're referring to lazy loading. It is a good idea to load the data before the actual gameplay starts. In terms of storing data of certain enemies, I'd have to say it is better than hardcoding them through classes via an Entity based system. You might want to search for Component-based systems to understand how to create a very flexible system especially for an RPG where you need to have different types of enemies, items and complex features for each object.
What is "Entity based system"? and by "Component-based systems" for RPG you mean when I create a class for certain type of functions like attack, defend, and another class for certain types of skills, and another class for health related functions and then implement them into a character object?
To be absolutely clear on what I mean, that's how I use it; I have XML file (serves as an database for pre-made objects) alongside my other files, when I start my game it load that XML file into XML classs withing my game, and my game simply use that class to read and write whatever and whenever needed.
also to be clear, by enemy I don't mean enemy instances, but enemy archtypes.
At 9/30/13 06:21 AM, PSvils wrote:At 9/30/13 06:17 AM, NecroBlight wrote: for storing objects like different items, enemies, characters and all the information about them, and just process them when needed? I shouldn't create class instances to represent certain objects and items?You mean during runtime? Definitely not.
XML is a good format when you need to have a config file or saving something in a format that you can easily edit in a .txt file. Otherwise, if you need to store the state of some objects, use JSON, or your own format of storing objects.
Is there a reason why it isn't good to use XML during runtime? also it's good to use it just as a database for pre-run?
for storing objects like different items, enemies, characters and all the information about them, and just process them when needed? I shouldn't create class instances to represent certain objects and items?
At 9/10/13 01:59 PM, MSGhero wrote:At 9/10/13 01:54 PM, NecroBlight wrote: But I don't want to create a separate class just for mouse click functionality.Then don't. Pushbutton is one example of something that extends component. Slider also extends component, and it has its own click handler. They don't extend "clickable component" or whatever you're thinking. Combobox extends component but it doesn't have a click listener (it addChilds pushbuttons and gives them a listener).
If everything that extends your super class should be clickable, then defining it there is ok. But it's dead weight if you have something that doesn't make use of it, and even dead-er weight if it's a button and you can't give it a custom handler function from another class.
All of the classes use a click listener somewhere in its inheritance. So if I'll define it in each class that uses it, there can be only more extra click listeners. My biggest issue is that not all classes uses Enter_Frame, but still almost all inheritance chains use it.
At 9/10/13 01:49 PM, milchreis wrote: That's a god object.
I'm not familiar with that term, but it used with only a specific spectrum of objects.
At 9/10/13 01:47 PM, MSGhero wrote: Look at how minimalcomps does it: github
Component is the base ui class, and it doesn't have any listeners (the enterframe gimmick doesn't count). PushButton has a click listener unless you specify a function you want it to call instead of that.
But I don't want to create a separate class just for mouse click functionality.
At 9/10/13 01:36 PM, milchreis wrote:At 9/10/13 01:33 PM, NecroBlight wrote: Because the other 10% have no use for that listener.Why do they extend this superclass then?
Because it still uses some of the listeners and/or it needs the other class that extends it.
At 9/10/13 01:27 PM, milchreis wrote: If only 90% of the subclasses override that method, why do 10% not override that method?
What is so "one hub" like about a super class that adds empty listener methods to events if the methods that implement the functionality are in their respective subclasses anyway?
Because the other 10% have no use for that listener.
I just said "hub" in the sense where all the key listener function are, nothing more.
At 9/10/13 11:18 AM, milchreis wrote: Why don't you add it to just those 90% of your classes?
And if you ask why I don't add to all my classes, then not all classes need this listener, only a specific spectrum of my classes needs it, and it is that spectrum of classes that inherits that hub.
At 9/10/13 11:18 AM, milchreis wrote: Why don't you add it to just those 90% of your classes?
because as I said, I don't want an inheritance line to have to have more than one listener that listens to the same thing, so instead I just have the listener in the base of the inheritense, and whenever I want to do something on click iI just override the onclick function + super.[onclick function].
Or you meant something else with your question?
At 9/10/13 10:39 AM, milchreis wrote:At 9/10/13 10:19 AM, NecroBlight wrote: How is it inflexible? it doesn't limit me in no way.It limits you to adding listeners by overriding methods.
What you mean? what's the problem with it? how is it a limit? (And if you mean listeners ther than the key listeners, I still can normally add other listeners)
Also I found it much easier to maintain (having one hub to control my event listening) than the normal way, can't see how it makes it harder to maintain.But there's no "one hub" for all UI components event wise, because they all behave differently.
Yeah, and there's where the override function comes, and if I need a listener for something else I just add the listener in the class itself, but my key listeners are in one place.
Not every object need a click listener.
That's the thing, I only put a key listeners there which 90% of my child objects of that class use.
It was a type, I meant to say "I'm" on my laptop, so I can't post the code, unless I rewrite it on my laptop.Why can't you post it from your other computer?
Because I don't have access to it right now, away from home.
I think you misunderstood me abit, I didn't say that ALL my listeners are in the super class, only the key listeners that I use 90% of the time, other listeners I use less commonly I still add normally.

