Site Navigation
QuakeOne News
» Latest News
» News Archives
» QuakeOne Movies

QuakeOne Help
» File Downloads
» Quake Help
» Quake Servers

QuakeOne Community
» Forums
» Chat *new*
» Poll Booth
» Memberlist
» Member Map

Site Info
» Community Rules
» Moderator List

» Buy Quake

Visit QuakeOne.com On Facebook!Visit QuakeOne
on Facebook

Log in
User Name:

Password:

Not a member yet?
Register Now!
Online Users: 202
7 members and 195 guests
Bloodshot, Focalor, Mathuzzz, QwertyKb, Six-Shoota
Most users ever online was 2,542, 06-04-2016 at 12:58 AM.
Go Back Home > Forums > Quake Mod Releases > Works-In-Progress > WorldSpawn official WIP thread Search Forums

Reply
LinkBack Thread Tools
Unread 03-19-2017, 11:49 AM   #391 (permalink)
The man who sold the world
MadGypsy's Avatar
USER INFO »
Posts: 5,016
+/-  Reputation: MadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura about
Join Date: Feb 2011
Currently: Offline
Macros, macros, macros...

I finished up a bunch of stuff and then decided to go find all the reasons why it's "bad". I already knew what I was doing was not optimal but, I didn't know why... didn't really care. It took some searching cause this shit is so poorly documented but, I finally found some Google group talking about it. In short, using reflection is bad because of dynamic vs static targets. In order to make one code harmonious for both target types involves doing a bunch of bloated background stuff and, as the use of reflection becomes more frequent it can actually cause performance issues (hooray to me for making it as easy as possible to have terrible performance :pats self on back: )

The solution is macros. What is a macro, you may ask... Well, mostly, I have little to no real idea. I could show you one but, I haven't had a chance to really pick it apart yet. Some in the HaXe community refer to it as "dark magic" so, it's safe to assume I will be spinning my wheels and playing with lots of hornets while I master it. The good news is, this is the final frontier for me. I went over the HaXe docs (skim style) last night and macros are the only thing left that I couldn't write an essay on.

This means I am just a short time away from taking this education I have given myself and using it to properly make useful things. As always, I have no regrets regarding any time I have wasted working on things that aren't optimal. I didn't teach myself 20 some-odd languages by worrying about best practices and optimizations right out of the starting gates. I learned these languages by writing tons of terrible code and then realizing why it is terrible...

Need to make an order... Be back in a bit to finish my thoughts.
__________________
X_Michael
Reply With Quote
Unread 03-19-2017, 12:21 PM   #392 (permalink)
The man who sold the world
MadGypsy's Avatar
USER INFO »
Posts: 5,016
+/-  Reputation: MadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura about
Join Date: Feb 2011
Currently: Offline
Back...

...terrible code. I have always been of the mind that it is more important to lay a foundation of working code and then make it better by doing research, when first learning a language. I've also always been of the mind that making a virtual nothing is better than attempting a something, and the reason is simple... virtual nothing's force you to worry more about how you are programming and less about what you are programming. For instance, do I really give a shit if dynamics are keyable... not at all. I could have written a simple class that remaps dynamic to map and called it a day. What all this focus really did was put me in a position to "solve problems" and dig really deep on the various things that are available to me to accomplish the solution. In other words, it was a "discovery" exercise but, by treating it with all seriousness I kept forcing my brain to invent ways to use other possibilities to accomplish my goals... and much more was discovered. I believe it was Ben Franklin that said something to the effect of "On the contrary, I did not fail 100 times. I discovered 100 ways that do not work." That guy was the greatest inventor of his time and for generations to come.

If I stopped right now I would still be a good HaXe programmer. I intend to be a great one. I intend to get my avatar on the HaXe contributors page and go on to make sizable and notable contributions. I will master this language AND the underlying nuances of all the most common languages it ports to. One way I intend to do this is by eventually writing the HaXe package for QC. Nobody else is ever going to do it and I know plenty enough about QC to make it possible. I may be the only person in the world that knows enough about both (QC and haxe) to get it done at all. I do need to learn a bit more about HaXe hidden internals before taking this idea serious though. My plan is to rip apart haxe PHP internals cause I am the strongest in that language vs the other haxe transpile languages. If I can make all the connections with PHP I can recreate them with QC.

For the record I don't care if no one ever uses my haxe to QC package. It's not as much about creating something for interested developers as it is about taking a simple language that I mostly know and using it to connect all the final dots in haxe.
__________________
X_Michael
Reply With Quote
Unread 03-19-2017, 02:08 PM   #393 (permalink)
The man who sold the world
MadGypsy's Avatar
USER INFO »
Posts: 5,016
+/-  Reputation: MadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura about
Join Date: Feb 2011
Currently: Offline
I'm bored at work (super slow) and I was rereading some of my posts here. A recent one stated that I was too embarrassed to explain an oversight. Well, I'm still embarrassed but, I don't have anything else to do so...

My system relied on using enum constructors to strong type values. The one big oversight is that meant every single value is an enum. Consider...

Name:value

That would have become

Name:someEnum(value)

Now, if name was a key of MY object that wasn't a big deal cause I could reroute the @:arrayAccess to point to the enum constructor BUT what if name was a key of a "natural" type (ie map, array, etc) .... everything falls apart.

In short, I turned everything into enums and now that's what they are, systematically breaking everything except the keyable object I was inventing... genius! They should hire me at microsoft. I'd fit right in with terrible ideas like this.
__________________
X_Michael

Last edited by MadGypsy; 03-19-2017 at 10:16 PM..
Reply With Quote
Unread 03-19-2017, 10:56 PM   #394 (permalink)
The man who sold the world
MadGypsy's Avatar
USER INFO »
Posts: 5,016
+/-  Reputation: MadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura about
Join Date: Feb 2011
Currently: Offline
Holy shitcakes, Batman! Where the hell has this been in my thousands of searches for haxe tutorials/info/etc?

For those that don't care to click that: It's nothing but a fairly sizable cookbook for the haxe language. It's nothing but (probably) every example I ever needed. Psssh, I really wish I would have found that 11 months ago when it first went live. I've been using haxe APIs as a cookbook (of sorts) this entire time. There's nothing like trying to learn a language by "figuring it out" through observation. Oh shammalammadingdong... meh, I'm probably more bad-ass overall by doing it the hardest fucking way possible this whole time. Make no mistake though, you can call me Chef with all the recipes I'm about to mix.

::cracks knuckles::
::brews coffee::

It's about to be one of those don't sleep for 2 days situations that I'm famous for. I can sleep all I want when I die from this dumb shit I do to myself.
__________________
X_Michael
Reply With Quote
Unread 03-20-2017, 01:16 PM   #395 (permalink)
The man who sold the world
MadGypsy's Avatar
USER INFO »
Posts: 5,016
+/-  Reputation: MadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura about
Join Date: Feb 2011
Currently: Offline
Not literally cause I seriously need to learn this but,

FUCK MACROS!

I knew this was going to be really hard but this is so damn hard I almost feel like I might as well throw away everything I know about programming, wipe my mind clean and start completely over. Dark Magic indeed. It's not really all that funny that the haxe docs says something like "It's not magic and it's definitely not dark" but this other guy that is like a macro god or some shit told some beginner "good fucking luck" in response to him learning macros....

I think it may be time to befriend back2dos. He's basically the "spike" of this shit and I could really use a spike right about now. I'm faced with 2 options. Learn macros, fix my code accordingly and receive a bunch of optimizations or don't do that and live with somewhat bloated/slow code. I seriously can't see myself doing the latter but I'm 14 hours into this shit and I feel like I made about 2 steps of progress.

::cracks knuckles:: Fuck that, this shit is NOT going to defeat me. I'll never sleep again if that's what it takes to nail this!

edit: You know what the problem is?... Old dog/new tricks. ALL of my programming experience has been very similar. Objects are objects...arrays are arrays...etc and you just use them. You don't worry about highly complicated underground ways of doing things because the stuff is as good as it's gonna get. Haxe though, does not work like that. Sure you CAN "just use it" but there is a penalty and that penalty is directly related to how good you really want to be. In a sense Haxe allows you to be an "it works" programmer so it wont completely scare you away from even attempting to learn it but, then you get better and learn more and haxe basically says "forget all that 'it works' crap. Learn this far superior and incredibly powerful way that is nothing like anything you are used to". Macros, in short, are a way to write code that writes code. The macros I write are basically a preprocessor. I wish it was easy to do as it is to explain. Imagine if someone was teaching you how to walk. "You just put one leg in front of the other" but only problem is... you don't have any feet and you have no idea how to get some.

It may even be true to say that most programming languages try to remove you as much as possible from the lowest levels. I mean this in a writing script sense. Haxe however, goes the other way. Sure there is plenty of separation for most things regarding built-ins and what-not that make your code lighter but, not for objects, not if you want them to be optimal. It's practically a rule "never create an object and stay as far as you can from reflection". Macros seem to let you create object behavior without ever actually instantiating an object. Super tricky.

I'm almost afraid to go dig in the away3d source and realize that there are about 50 bazillion optimizations that could be made regarding macros. I honestly don't recall a bunch of object creation in the source but I also don't recall seeing a bunch of macros. The truth is, I know if I learn macros and realize that away3d is not using them I'm going to end up fixing as much of that api as possible. It's gonna take the rest of my life.
__________________
X_Michael

Last edited by MadGypsy; 03-20-2017 at 01:48 PM..
Reply With Quote
Unread 03-20-2017, 06:08 PM   #396 (permalink)
The man who sold the world
MadGypsy's Avatar
USER INFO »
Posts: 5,016
+/-  Reputation: MadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura aboutMadGypsy has a spectacular aura about
Join Date: Feb 2011
Currently: Offline
Hah! Check out this stream of thoughts, observations and realizations that just happened in my head.

I took a mini break from macros for a couple of hours and did some investigation on objects. I came across the same info I already knew, objects are slower on static targets because a reverse look up needs to be performed every time you access a field. This time however, I had a different thought "What are all the static targets?". I came across this:



On a side note, I noticed flash and cpp are static but, javascript and neko are not. This made me wonder if that's why flash and cpp substantially outperform these targets but, that isn't necessary info to where I am going with this.

I also noticed that they listed the targets which are compatible with the filesystem package. That got me thinking about my content manager. My content manager uses openfl to pretty much "blanket solution" the filesystem issues for all targets. I really don't like that. In the past I would have boasted that I am writing code that doesn't have compiler conditions but, I'm really starting to lean the other way on that idea. I am more of the mind that I would like to eliminate my sparse use of openfl and then eliminate openfl. I'm using this massive library just to avoid some compiler conditions and in reality all this massive library is doing is providing the compiler conditions. This all brought me to another thought... Macros run at compile time and more or less write script where you tell it to...some targets support the filesystem package and others don't...that's something a macro could determine...I only want to import the filesystem package for targets that support it...that's an import a macro could write, the same macro that made the determination...

In other words, say hello to my first real usage macro. That's all I really needed. Sure, there is plenty of uphill left with macros but, now it's uphill with momentum. It's awesome. I have only been awake like 36 hours so, I haven't even hit the part where you start having all kinds of free thought and getting messages from god and stuff. I'm already at real-world usage for something much bigger than the macro ~ a more target specific content manager and the elimination of a massive api.

I can be really slow to results sometimes but, supposedly, that and steady wins the race, so....
__________________
X_Michael

Last edited by MadGypsy; 03-20-2017 at 06:18 PM..
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 01:10 PM.


eXTReMe Tracker