January 2009
2 posts
Valve's take on materials →
UML
Suddenly occured to me that I may have drawn the UML diagram in my PS2 report with the generalisation arrows the wrong way around :O
Oops.
Anyway, ArgoUML is going pretty well. About as many bugs as Umbrello but it has some nice features and runs under Windows at least.
December 2008
57 posts
Tasks
Implement Queries
Implement Actions
Display better errors and warnings with line numbers - seperate file?
Queries
isBigger[A,B] ? A:size > B:size
-> if (a.size > b.size) { }
isScarier[A,B] ? A.scariness > B.scariness
-> if (a.scariness > b.scariness) { }
isInitimidating[A,B] ? isScaries[A,B] & isBigger[A,B]
-> if ( (a.size > b.size) && (a.scariness > b.scariness) ) { }
action_Attack[A,B] ? isIntimidating[A,B] & A:aggression > 40
->...
Case Sensitivity
Orignally I also wanted this language to be case insensitive so I may need to add functionality to take all new names and convert them to lower or upper case.
Should be a tolower function in the ctype header.
Errors
It would be good to get some better error reporting - have something to count line numbers and have a few functions which deal with error logging, possibly to a file.
Tools Progress
Ok, I have one linked list working. Easier than I expected.
First tasks for tomorrow:
change file names to something more meaningful. Linked list to something symbol table related. animalfuncs to something animal related.
Implement a linked list for animals
start writing function for when new animals are created etc
The solution looks something like this
list of animals, and meta animals,...
Better Linked List →
C Linked List →
Also
this means I don’t need to make children of the animals class - just instances of it :)
Oops!
I forgot how my language works - it queries *any* two (or three, or more) animals, not two specific animals. So it doesn’t matter if an animal has been declared before the query or not. Animals can be defined anywhere in any order :D This makes everything much simpler :D
Project
So, Tools coursework is:
yacc file
lex file
header & c file with functions for yacc
Producing
animals.cpp and animals.h
animalmanger.cpp and animalmanager.h
PerGen
Ok, so parser generator has a 16-bit installer, which wont work uder 64-bit Vista :/
Hope just copying it works, or I’ll have to use a VM or work from my laptop
Singleton Some More
I’m going to modify my cam/light classes so they only return data, and have no functions to set it (apart from possibly resetting it).
Whilst less flexible, this will maintain data integrity within these classes, and ensure there is only a one-way data flow from them.
Oh dear god I am a MONSTER
Lamps->getEntity(i)->getEntity(1)->setWorldMatrix(S*T);
Meh
Vector - fine.
Random Access - seems fine.
Clones - not fine.
Random Access
Looks like I will need to access individual items in my tree after all :(
Vector time I guess.
Clone Wars
Added functionality for leaves/composites to clone themselves, might need to overwrite the function in child classes though to ensure data isn’t loaded into memory more than once.
Bob: "Hey Fred, how do I model a Loop?"
Fred: "Easy! Make a Loop class."
Bob: "OK. What operations should it have?"
Fred: "Um, lemme look. Prolly give it a parent, and instantiate it with a number of iterations and a stopping point."
Bob: "Wow, this OOP solves everything! What code should I put in the doLoop() method?"
Fred: "I think that's where you instantiate it"
Bob: "That's so cool, it's almost... confusing."
Fred: "Make sure you make it a Singleton. I've never seen a reason not to."
I Can Change, I Swear →
Texture Manager
Ok, so even after reading the previous article I made my texture manager singleton.
I figure the need toonly have one instance and access the texture manager from multiple locations outweighs the problems with creating a global class.
Also, it should be noted that data only flows one way, from object classes to the texture manager, not in two directions. Which makes things not so bad somehow.
...
I'm HEARTBROKEN →
:O
Naming Patterns →
“Anyway, you shouldn’t be using singletons anymore anyway.” :O - makes sense, given that suddenly you have global access to a whole class (which always seemed a little dodgy) but at the same time surely sometimes they are relevant? Will have to look further into the reasons behind this comment.
“Composite - “One of the goals of the Composite pattern is to make clients...
References
I’m not sure entirely how much I need to reference. I mean there are some books/websites which have had an obvious influence on the project - those that solve a specific problem or provided me with background info on patterns.
At the same time though, there are the websites which helped in the background, such as those on SVN. Obviously I found them useful, but using svn isn’t really...
Prototype
Since I wont need to change the numbers of objects shown onscreen at runtime (I’m just rendering a 3D scene) it won’t be necessary to implement a manager for prototype objects - I can know for sure that I wont delete any classes objects which have made clones of themselves until the game is ended.
If the scene was to be expanded to be included in a game, it would probably need to...
GoF
Nevermind; borrowed from Phil and my parents have a copy.
Read almost half so far.
Disappointed, but I guess that’s just because Head First actually did a decent job of selecting the most important points and summarising them.
Definitely wouldn’t want to be reading this one first though :/
Class Names
Naming classes forming the composite patterns with names more specific to my problem was probably a bad move.
Changing the names to reflect those traditionally associated with the pattern would make it obvious to anyone familiar with it what it being done.
GoF
Christmas Present maybe?
AHA! THIS! YES! Composite with Clone(); →
That’s exactly what I want, and as ever stupidly simple now I look at it. I just have the “Object” class implement a clone object which returns an identical object to itself, and Composite move through the tree calling it.
Maybe Helpful on Composite/Prototype →
Facade Example →
Looking at this example, the class acting as a facade seems to simply forward data to other classes and manage it between them, but not actually perform any actions relating specifically to a class which already exists.
The one place in SceneManager where this is not the case is with input and controls. Perhaps abstracting this power from SceneManager would enhance my solution.
Rules Of Thumb
(from the previous link)
Facade defines a new interface, whereas Adapter uses an old interface. Remember that Adapter makes two existing interfaces work together as opposed to defining an entirely new one. This is true here, SceneManager defines a completely new interface for setting up and rendering the scene.
Whereas Flyweight shows how to make lots of little objects, Facade shows how to make...
Facade Pattern →
So what is the difference between this and a God class? How do you stop it becoming one?
I don’t think my scene manager knows any more than it should - this is demonstrated by the fact the it simply calls functions and preforms action previously left in main, thus grouping actions and creating a single, simplified interface. It is still flexible in that it is not the only point of call for...
SVN Revision Specifiers →
SVN
AArgh tortoise svn apparently doesn’t include all new files when you commit by default… and the one time I forget to check the box to get them I actually need to use the repo :(
I could recreate the lamp class but not the model :(
Guess I’ll find something else to do until I get back.
No-one showed up...
to the C++ lab so I’m getting PS2 stuff done I guess :/
I still don’t have the solution to my problem and I don’t have my notepad to make some notes, which is annoying.
Not sure I actually need anything that complicated tbh :/
Prototype Design Pattern →
Looks like I need moar patterns :/
need to create allow entities to clone themselves I guess - create an virtual “clone()” function which can be implemented by subclasses.
Sure there must be examples of composite+prototype patterns used in conjunction somewhere since it’s apprently common practice…
Designs that make heavy use of the Composite and Decorator patterns often can...
– (GoF, p126) - http://en.wikipedia.org/wiki/Prototype_pattern
grr
p = iterator to pointer to Entity
*p = pointer to Entity
**p = Entity
&(**p) = Address of Entity
temp = &(**p) = address of Entity
need to use this to copy entity :(
POINTURS
GWAAARR MY GAWD WUT IS HAPPENING!?
have a class
class has a list of pointers, to objects
need to make a copy of the class
need to make new instances of the objects the pointers in the list point to
WUT?
Composite Pattern (It isn't what you think) →
This looks interesting will read it later
Lamps
alright, so I started some work on the lamps. Got texture blending with the wall working fine, and it all plays nice with my framework. Need to add sn ms3d model, and maybe get point lighting to work.
So...
at worst I guess this means I can render the whole scene again upside down under the floor :P
Linux for PlayStation 2 Community →
w00t
No Transparency for *anyone*
loi 0 ; Load 128 and put it into the alpha value
lol wut?